Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 谷歌云存储没有此类文件或目录错误_Python_Google Cloud Platform_Google Cloud Storage - Fatal编程技术网

Python 谷歌云存储没有此类文件或目录错误

Python 谷歌云存储没有此类文件或目录错误,python,google-cloud-platform,google-cloud-storage,Python,Google Cloud Platform,Google Cloud Storage,我对谷歌云平台还很陌生,我正在尝试用TPU训练一个模型。我遵循这一点,用Google Colab设置TPU。下面的所有代码都遵循教程 这是我所做的步骤: import datetime import json import os import pprint import random import string import sys import tensorflow as tf assert 'COLAB_TPU_ADDR' in os.environ, 'ERROR: Not connec

我对谷歌云平台还很陌生,我正在尝试用TPU训练一个模型。我遵循这一点,用Google Colab设置TPU。下面的所有代码都遵循教程

这是我所做的步骤:

import datetime
import json
import os
import pprint
import random
import string
import sys
import tensorflow as tf

assert 'COLAB_TPU_ADDR' in os.environ, 'ERROR: Not connected to a TPU runtime; please see the first cell in this notebook for instructions!'
TPU_ADDRESS = 'grpc://' + os.environ['COLAB_TPU_ADDR']
print('TPU address is => ', TPU_ADDRESS)

from google.colab import auth
auth.authenticate_user()
with tf.Session(TPU_ADDRESS) as session:
  print('TPU devices:')
  pprint.pprint(session.list_devices())

  # Upload credentials to TPU.
  with open('/content/adc.json', 'r') as f:
    auth_info = json.load(f)
  tf.contrib.cloud.configure_gcs(session, credentials=auth_info)
  # Now credentials are set for all future sessions on this TPU.
输出:

TPU address is =>  grpc://10.4.89.154:8470
...
Operation completed over 5 objects/1.3 GiB.   
提供我的
存储桶
名称和
输出目录
名称:

BUCKET = 'my_xlnet' #@param {type:"string"}
assert BUCKET, '*** Must specify an existing GCS bucket name ***'
output_dir_name = 'xlnet_output' #@param {type:"string"}
BUCKET_NAME = 'gs://{}'.format(BUCKET)
OUTPUT_DIR = 'gs://{}/{}'.format(BUCKET,output_dir_name)
tf.gfile.MakeDirs(OUTPUT_DIR)
print('***** Model output directory: {} *****'.format(OUTPUT_DIR))
将预训练模型移动到GCS铲斗:

!gsutil mv /content/xlnet_extension_tf/model/xlnet_cased_L-24_H-1024_A-16 $BUCKET_NAME
输出:

TPU address is =>  grpc://10.4.89.154:8470
...
Operation completed over 5 objects/1.3 GiB.   
然后运行主代码:

!python /content/xlnet_extension_tf/run_coqa.py \
--use_tpu=True \
--tpu_name=grpc://10.4.89.154:8470 \
--spiece_model_file=$BUCKET_NAME/xlnet_cased_L-24_H-1024_A-16/spiece.model \
--model_config_path=$BUCKET_NAME/xlnet_cased_L-24_H-1024_A-16/xlnet_config.json \
--init_checkpoint=$BUCKET_NAME/xlnet_cased_L-24_H-1024_A-16/xlnet_model.ckpt \
...
然后我得到了这个错误:

OSError: Not found: "gs://my_xlnet/xlnet_cased_L-24_H-1024_A-16/spiece.model": No such file or directory Error #2
这是地面军事系统铲斗屏幕:

我不知道为什么会出现这个错误,因为我可以成功地将我的预训练模型移动到桶中

你们知道怎么解决这个问题吗

更新:


run\u coqa.py
文件:

你能在
run\u coqa.py
打开文件的地方发布这个部分吗


似乎您正在尝试使用常规的
操作系统打开它。
命令,您应该在其中使用GCP的sdk。

您可以发布
run\u coqa.py
打开文件的部分吗


似乎您正试图使用常规的
操作系统打开它。
命令,您应该在其中使用GCP的sdk。

本教程是由第三方创建的。我现在看不到任何常见问题会阻止代码运行。

本教程是由第三方创建的。我现在看不到任何常见问题会阻止此代码运行。

我刚刚用
run\u coqa.py
文件的链接更新了我的帖子。我在这里有点不知所措,但这似乎是相关的。似乎您需要一个特定的实现才能打开
gs://
文件。检查回复huy:aldarisbm的建议对你有帮助吗?我刚刚用
run\u coqa.py
文件的链接更新了我的帖子。我在这里有点不知所措,但这似乎是相关的。似乎您需要一个特定的实现才能打开
gs://
文件。检查回答huy:Aldaribm的建议对你有帮助吗?