【发布时间】:2022-12-13 21:37:04
【问题描述】:
在 Vertex AI 工作台笔记本中,我尝试使用 Cloud Storage FUSE 从 Cloud Storage 读取数据。
Cloud Storage 中数据集的文件路径为:
gs://my_bucket_name/cola_public/raw/in_domain_train.tsv 这样我就可以将它读入 pandas dataframe,如下所示:
import pandas as pd
# Load the dataset into a pandas dataframe.
df = pd.read_csv("gs://my_bucket_name/cola_public/raw/in_domain_train.tsv", delimiter='\t', header=None, names=['sentence_source', 'label', 'label_notes', 'sentence'])
# Report the number of sentences.
print('Number of training sentences: {:,}\n'.format(df.shape[0]))
# Display 10 random rows from the data.
df.sample(10)
前面的代码可以无缝运行。但是,我想更新我的代码以使用 Cloud Storage FUSE 读取数据(用于稍后的 Vertex AI 训练)。基于Read and write Cloud Storage files with Cloud Storage FUSE和this Codelab,我应该能够使用以下代码加载我的数据:
df = pd.read_csv("/gcs/my_bucket_name/cola_public/raw/in_domain_train.tsv", delimiter='\t', header=None, names=['sentence_source', 'label', 'label_notes', 'sentence'])
不幸的是,它对我不起作用。错误信息是:
FileNotFoundError: [Errno 2] No such file or directory: '/gcs/my_bucket_name/cola_public/raw/in_domain_train.tsv'
我该如何解决这个问题? 先感谢您!
【问题讨论】:
标签: google-cloud-platform google-cloud-storage google-cloud-vertex-ai gcsfuse