Tensorflow 数据加载问题

标签 tensorflow tensorflow-datasets

我正在使用一个使用 MNIST 数据集的示例程序。

它尝试使用这一行加载数据集:

dataset = tfds.load(name='mnist', split=split)

但是,这会产生以下错误:

2020-07-30 12:08:17.926262: W tensorflow/core/platform/cloud/google_auth_provider.cc:184] All attempts to get a Google authentication bearer token failed, returning an empty token. Retrieving token from files failed with "Not found: Could not locate the credentials file.". Retrieving token from GCE failed with "Failed precondition: Error executing an HTTP request: libcurl code 6 meaning 'Couldn't resolve host name', error details: Couldn't resolve host 'metadata'".
Traceback (most recent call last):
File "/home/tflynn/pylocal/lib/python3.7/site- 
packages/tensorflow_datasets/core/utils/py_utils.py", line 399, in try_reraise
yield
File "/home/tflynn/pylocal/lib/python3.7/site- 
packages/tensorflow_datasets/core/registered.py", line 244, in builder
return builder_cls(name)(**builder_kwargs)
File "/home/tflynn/pylocal/lib/python3.7/site- 
packages/tensorflow_datasets/core/api_utils.py", line 69, in disallow_positional_args_dec
return fn(*args, **kwargs)
File "/home/tflynn/pylocal/lib/python3.7/site- 
packages/tensorflow_datasets/core/dataset_builder.py", line 206, in __init__
self.info.initialize_from_bucket()
File "/home/tflynn/pylocal/lib/python3.7/site- 
packages/tensorflow_datasets/core/dataset_info.py", line 423, in initialize_from_bucket
data_files = gcs_utils.gcs_dataset_info_files(self.full_name)
File "/home/tflynn/pylocal/lib/python3.7/site- 
packages/tensorflow_datasets/core/utils/gcs_utils.py", line 71, in gcs_dataset_info_files
return gcs_listdir(posixpath.join(GCS_DATASET_INFO_DIR, dataset_dir))
File "/home/tflynn/pylocal/lib/python3.7/site- 
packages/tensorflow_datasets/core/utils/gcs_utils.py", line 64, in gcs_listdir
if is_gcs_disabled() or not tf.io.gfile.exists(root_dir):
File "/home/tflynn/.local/lib/python3.7/site-packages/tensorflow/python/lib/io/file_io.py", 
line 267, in file_exists_v2
_pywrap_file_io.FileExists(compat.as_bytes(path))
tensorflow.python.framework.errors_impl.FailedPreconditionError: Error executing an HTTP 
request: libcurl code 77 meaning 'Problem with the SSL CA cert (path? access rights?)', 
error details: error setting certificate verify locations:
CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: none
when reading metadata of gs://tfds-data/dataset_info/mnist/3.0.1

我在谷歌上搜索过,但找不到任何其他与 tensorflow 相关的错误实例。该节点已连接到互联网,如果这有所不同的话。

最佳答案

我在 Fedora32 系统上遇到过同样的问题。目录/etc/ssl/certs/存在,并且有一个文件 ca-bundle.crt。以下命令解决了这个问题:

sudo ln -s/etc/ssl/certs/ca-bundle.crt/etc/ssl/certs/ca-certificates.crt

关于Tensorflow 数据加载问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63177156/

相关文章:

python - 谷歌云机器学习引擎: Create model version failed

python - ValueError : Trying to create optimizer slot variable under the scope for tf. 分发。策略

machine-learning - 为什么训练损失在每个 epoch 开始时都会增加?

python-3.x - 导入 tensorflow_datasets 时出现错误

python - 如何创建 Cifar-10 子集?

python - 让 TensorFlow 在 ARM Mac 上使用 GPU

tensorflow - 无法将 EfficientNet 与迁移学习结合使用

python - Keras 损失和度量值在每个函数中与相同的函数不匹配

python - TensorFlow 数据集 API 中的 IDE 断点映射 py_function?

python - TensorFlow:在我自己的图像上进行训练