首页 > 解决方案 > 下载 food101 时 Tensorflow_datasets 挂起,我该怎么办?

问题描述

我在本地机器上遇到了一些 tensorflow_datasets 问题。我可以在 MNIST 数据集上调用 tfds.load(params) 就好了,但是当我尝试在 food101 上调用它时,它会运行到大约 20%,然后就挂起。结果是食物图像数据的不完整下载。我尝试使用 builder.download_and_prepare() 手动构建它,但它再次挂起,所以我认为它不是我的 tfds.load() 参数或包装器本身的问题。我完全无法完成下载,因为我昨晚在睡觉时让它运行,它只达到了 20% 并停止了。我什至检查了 tar.gz 下载文件,只发现了十几个已完成的课程,还有一个部分完成了。此外,访问 ETH Zurich 网站并尝试直接下载数据集,似乎不起作用(chrome 根据控制台日志阻止了它,没有尝试 Edge 或 MozFF)而且我不知道如何处理该文件,即使它确实如此(前提是它与从下载的格式不完全相同) download_and_prepare() 函数)。我正在研究:

-windows 10 19042.1083

-tf 版本 2.4.1

-python 版本 3.8.8

-anaconda 4.10.3

-VSCode 1.58.2

-jupyter 核心 4.7.1

-jupyter笔记本6.3.0

我相信这在 google collab 中可以正常工作,但我想在我的本地机器上执行此操作,或者至少从 colab 目录中提取数据集并将其缓存在本地。谁能帮我?这是在终端中运行代码的输出:

>>> import tensorflow_datasets as tfds
2021-07-16 17:52:30.018664: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
>>> import tensorflow as tf
>>> physical_devices = tf.config.list_physical_devices('GPU')
2021-07-16 17:52:32.256224: I tensorflow/compiler/jit/xla_cpu_device.cc:41] Not creating XLA devices, tf_xla_enable_xla_devices not set
2021-07-16 17:52:32.256751: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library nvcuda.dll
2021-07-16 17:52:32.279277: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:26:00.0 name: NVIDIA GeForce RTX 3070 computeCapability: 8.6
coreClock: 1.725GHz coreCount: 46 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 417.29GiB/s
2021-07-16 17:52:32.279387: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll
2021-07-16 17:52:32.283584: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-07-16 17:52:32.283670: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2021-07-16 17:52:32.286536: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-07-16 17:52:32.288181: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-07-16 17:52:32.291650: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2021-07-16 17:52:32.293735: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2021-07-16 17:52:32.294652: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
2021-07-16 17:52:32.294948: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
>>> tf.config.experimental.set_memory_growth(physical_devices[0], True)
>>> from tensorflow.compat.v1 import ConfigProto
>>> from tensorflow.compat.v1 import InteractiveSession
>>> config = ConfigProto()
>>> config.gpu_options.allow_growth = True
>>> session = InteractiveSession(config=config)
 following CPU instructions in performance-critical operations:  AVX2
49] Successfully opened dynamic library cudart64_110.dll
2021-07-16 17:52:32.482718: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll
2021-07-16 17:52:32.482822: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll
2021-07-16 17:52:32.482929: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-07-16 17:52:32.483061: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-07-16 17:52:32.483166: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2021-07-16 17:52:32.483289: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll
2021-07-16 17:52:32.483411: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll
2021-07-16 17:52:32.483546: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1862] Adding visible gpu devices: 0
2021-07-16 17:52:32.874427: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-07-16 17:52:32.874704: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267]    
  0
2021-07-16 17:52:32.874851: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0: 
  N
2021-07-16 17:52:32.875127: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1406] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 6589 MB memory) -> physical GPU (device: 0, name: NVIDIA GeForce RTX 3070, pci bus id: 0000:26:00.0, compute capability: 8.6)
2021-07-16 17:52:32.875744: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
>>> datasets_list = tfds.list_builders()
>>> print("food101" in datasets_list)
True
>>> (train_data, test_data), ds_info = tfds.load(
...     name="food101",
...     split=["train","validation"],
...     shuffle_files=True,
...     batch_size=-1,
...     as_supervised=True,
...     data_dir="fooddata",
...     with_info=True)
Downloading and preparing dataset Unknown size (download: Unknown size, generated: Unknown size, total: Unknown size) to fooddata\food101\2.0.0...
Dl Completed...:   0%|                                         | 0/1 [00:16<?, ? url/s] 
Dl Size...:   6%|██                               | 292/4764 [00:30<03:44, 19.89 MiB/s] 
Extraction completed...: 0 file [00:16, ? file/s]

它刚刚挂在6%。

标签: pythontensorflow

解决方案


推荐阅读