【问题标题】:Unable to access mounted GCS bucket from within Vertex AI Jupyter Notebook无法从 Vertex AI Jupyter Notebook 中访问已安装的 GCS 存储桶
【发布时间】:2023-01-13 13:26:13
【问题描述】:

我使用以下命令在 Vertex AI 笔记本中安装了一个 GCS 存储桶:


MY_BUCKET=cloud-ai-platform-a013866a-a18a-470f-9d35-f485abb17e82

cd ~/

mkdir -p gcs

gcsfuse --implicit-dirs --rename-dir-limit=100 --disable-http2 --max-conns-per-host=100 $MY_BUCKET "/home/jupyter/gcs"

在终端中,我可以执行 ls gcs/ 并获取已安装存储桶 (test uncorrupted_split_heightmaps) 中的目录列表,但是当我尝试从 Jupyter Notebook 中访问这些目录时,找不到它们。

在 Jupyter Notebook 中运行以下代码:

import os
print(os.listdir('../gcs'))

给出输出:

[]

而不是预期的输出:

[test, uncorrupted_split_heightmaps]

和

from tensorflow.keras.preprocessing.image import ImageDataGenerator
idg = ImageDataGenerator()
heightmap_iterator = idg.flow_from_directory('../gcs/test', 
                                             target_size = (256, 256), 
                                             batch_size = 8,
                                             color_mode = 'grayscale',
                                             classes = [''])

给出输出:

Found 0 images belonging to 1 classes.

而不是预期的输出:

Found 732458 images belonging to 1 classes.

如何从 Jupyter Notebook 中访问已安装的 GCS 存储桶?

【问题讨论】:

    标签: jupyter-notebook google-cloud-vertex-ai gcs gcsfuse


    【解决方案1】:

    在 gcsfuse 中启用调试日志应该可以深入了解运行 os.listdir('../gcs') 时发生的情况。 您能否使用以下 cmd 共享日志: “gcsfuse --implicit-dirs --rename-dir-limit=100 --disable-http2 --max-conns-per-host=100 --debug_gcs --debug_fs --debug_fuse --log-format 'text' - -日志文件 log.txt $MY_BUCKET“/home/jupyter/gcs”?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-25
      • 1970-01-01
      • 2017-02-12
      • 1970-01-01
      • 1970-01-01
      • 2022-01-12
      相关资源
      最近更新 更多