简体   繁体   English

使用 tf.saved_model.save() 从本地保存一个 model 到 GCS bucket

[英]Using tf.saved_model.save() to save a model to GCS bucket from local

I'm trying to save a tensorflow model to a GCS bucket from my local machine(Jupyter Notebook).我正在尝试将 tensorflow model 从我的本地计算机(Jupyter Notebook)保存到 GCS 存储桶。 I do have the google cloud storage credentails json. How do I save the model to the bucket since Tensorflow supports gcs links in saved_model我确实有谷歌云存储凭证 json。如何将 model 保存到存储桶中,因为 Tensorflow 支持 saved_model 中的 gcs 链接

I used it as follows: tf.saved_model.save(model, "gs://your_bucket")我按如下方式使用它: tf.saved_model.save(model, "gs://your_bucket")

This throws the following error:这会引发以下错误:

PermissionDeniedError: Error executing an HTTP request: HTTP response code 401 with body
Anonymous caller does not have storage.objects.get access to the Google Cloud Storage object.",

How do I use my credentials json I have?我如何使用我的凭据 json?

Edit: How to authenticate tf.saved_model.save() before calling it.编辑:如何在调用 tf.saved_model.save() 之前对其进行身份验证。 I have the following service account credentials as a json.我有以下服务帐户凭据作为 json。

In the Python Script os.environ["GOOGLE_APPLICATION_CREDENTIALS"]='credentials.json' and then model.save('gs://your_model_path_in_bucket') works在 Python 脚本os.environ["GOOGLE_APPLICATION_CREDENTIALS"]='credentials.json'然后model.save('gs://your_model_path_in_bucket')工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从 GCS 存储桶在 GCP 数据流中加载 Fasttext model 时出错 - Error Loading Fasttext model in GCP Dataflow from GCS Bucket 将 spacy model 保存并加载到谷歌云存储桶 - Save and load a spacy model to a google cloud storage bucket Airflow 将最新文件从 GCS 存储桶复制到本地 - Airflow to copy most recent file from GCS bucket to local 将 tensorflow model 从本地机器转移到 AWS SageMaker 时读取 S3 存储桶时出现问题 - Having issues reading S3 bucket when transitioning a tensorflow model from local machine to AWS SageMaker 如何使用 joblib.dump 在 s3 上保存 sklearn 模型? - How to save sklearn model on s3 using joblib.dump? 在 GCS 中将文件从一个存储桶移动到另一个存储桶 - Moving files from one bucket to another in GCS 将文件从 GCS 存储桶传输到 Webdav 服务器 - Transfer files from GCS bucket to Webdav server 从 GCS 存储桶中的文件夹中删除数百万个对象 - Delete millions of objects from a folder in GCS bucket 如何使用 Glue 作业将 JSON 从 s3 转换为 CSV 文件并将其保存在同一个 s3 存储桶中 - How to convert JSON to CSV file from s3 and save it in same s3 bucket using Glue job 限制特定 GCS 存储桶的存储管理员 - Restrict Storage Admins from specific GCS bucket
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM