[英]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.