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 - 在 TensorflowJS 中构建神经网络

python - tensorflow 张量板错误: you must feed a value for placeholder tensor

Tensorflow多项式线性回归曲线拟合

python - 重命名失败;访问被拒绝的 Tensorflow

python - Tensorflow 2 -Keras SAVE/LOAD 模型错误(DenseFeatures 和 DistributionLambda 层)

python - 如何在Tensorflow中生成静态随机常数?

python - 在 tensorflow 中初始化一个基本的一次性迭代器

python - 将 tf.dataset 作为字典的键传递

tensorflow - 如何使用自定义函数在 TF 2 中使用 tf.data.Dataset.interleave()?

tensorflow - 获取文件名示例来自 tf,parse_example