【问题标题】:Cloud AI Platform Training Fails to Read from BucketCloud AI Platform Training 无法读取存储桶
【发布时间】:2020-10-09 02:58:05
【问题描述】:

我正在尝试使用 Cloud AI Platform 进行培训(gcloud ai-platform jobs 提交培训)。 我创建了我的存储桶,并确定训练文件在那里 (gsutil ls gs://sat3_0_bucket/data/train_input.csv)。

但是,我的工作因日志消息而失败:

File "/root/.local/lib/python3.7/site-packages/ktrain/text/data.py", line 175, in texts_from_csv
    with open(train_filepath, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: 'gs://sat3_0_bucket/data/train_input.csv'

我错过了什么吗?

【问题讨论】:

  • 你能分享你读取文件的代码部分吗?

标签: google-cloud-platform google-cloud-ml gcp-ai-platform-training


【解决方案1】:

该错误可能是因为 ktrain 尝试使用 open(train_filepath, 'rb') 自动检测字符编码,这可能与 Google Cloud Storage 存在问题。一种解决方案是显式提供encodingtexts_from_csv 作为参数,这样就可以跳过这一步(默认为None,表示自动检测)。

或者,您可以使用these methods 之一将自己的数据作为pandas DataFrame 读取。例如,pandas 显然支持 GCS,所以你可以简单地这样做:df = pd.read_csv('gs://bucket/your_path.csv')

然后,使用ktrain,您可以使用ktrain.text.texts_from_df(或ktrain.text.texts_from_array)来加载和预处理您的数据。

【讨论】:

  • 非常感谢!您的建议有效,但还需要通过 setup.py 安装“gcsfs”。错误是:ImportError: Missing optional dependency 'gcsfs'. The gcsfs library is required to handle GCS files Use pip or conda to install gcsfs. Pandas:gcsfs: necessary for Google Cloud Storage access (gcsfs >= 0.1.0).
猜你喜欢
  • 1970-01-01
  • 2021-07-06
  • 2022-06-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-22
  • 1970-01-01
  • 2019-10-12
相关资源
最近更新 更多