如何在不使用 GCP 的情况下在 Colab 中加载用于 TPU 推理的数据?

How to load data for TPU inference in Colab, without using GCP?

对于 colab TPU 上的训练模型,数据需要位于 GCP 存储桶上。但是,对于少量数据,我想知道是否可以直接从本地colab环境直接推断数据。

您可以使用 Python 读取文件:

with open(image_path, "rb") as local_file:
  img = local_file.read()

遗憾的是,目前无法使用 Colab 将本地数据加载到 TPU 中。您将需要继续使用 GCS 存储桶将任何数据加载到 TPU 中。