我在googlecloudtpu上运行XLNet代码时遇到了一些问题。当我选择gs://{model_path}/...
作为模型路径时,结果是IOError
。在
像这样:
Traceback (most recent call last):
File "run_classifier.py", line 903, in <module>
tf.app.run()
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 125, in run
_sys.exit(main(argv))
File "run_classifier.py", line 722, in main
sp.Load(FLAGS.spiece_model_file)
File "/usr/local/lib/python2.7/dist-packages/sentencepiece.py", line 118, in Load
return _sentencepiece.SentencePieceProcessor_Load(self, filename)
IOError: Not found: "gs://ykproject/pre-trained/xlnet_cased_L-24_H-1024_A-16/spiece.model": No such file or directory Error #2
原始代码是:
^{pr2}$我试图找出原因。所以我决定在Python文件中加载GCS文件:
f = open("gs://ykproject/test.txt". "r")
错误仍然存在:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: 'gs://ykproject/test.txt'
似乎您正在尝试访问对象文件,就像它们在计算机的文件系统中一样。要访问云存储上的对象(通过Python),您需要实例化客户机,访问特定的bucket并获取对象的数据:
{下载有关云存储的更多信息}
另外,确保您的云TPU服务帐户可以访问云存储,如果没有,您可以使用“gsutil”CLI工具更新权限。像这样(阅读):
^{pr2}$或者像这样(写作):
有关它的信息here。在
相关问题 更多 >
编程相关推荐