ValueError:没有足够的值在tfds.load中解包



我是Python和Tensorflow的新手。在执行tfds.load函数时,我得到了以下错误。我花了几个小时试图理解这个错误,但我不知所措。如有任何帮助,我们将不胜感激。我使用以下版本:python 3.8、tensorflow 2.3和tensorflow数据集1.2

ValueError                                Traceback (most recent call last)
<ipython-input-2-41baf13b8c3f> in <module>
----> 1 mnistdataset, mnist_info = tfds.load("mnist", 
with_info=True, as_supervised=True)
~anaconda3envspy3-TF2.0libsite-packagestensorflow_datasetscoreapi_utils.py in 
disallow_positional_args_dec(fn, instance, args, kwargs)
50     _check_no_positional(fn, args, ismethod, allowed=allowed)
51     _check_required(fn, kwargs)
---> 52     return fn(*args, **kwargs)
53 
54   return disallow_positional_args_dec(wrapped)  # pylint: disable=no-value-for-parameter
~anaconda3envspy3-TF2.0libsite-packagestensorflow_datasetscoreregistered.py in load(name, 
split, data_dir, batch_size, in_memory, shuffle_files, download, as_supervised, decoders, with_info, 
builder_kwargs, download_and_prepare_kwargs, as_dataset_kwargs, try_gcs)
298   if download:
299     download_and_prepare_kwargs = download_and_prepare_kwargs or {}
--> 300     dbuilder.download_and_prepare(**download_and_prepare_kwargs)
301 
302   if as_dataset_kwargs is None:
~anaconda3envspy3-TF2.0libsite-packagestensorflow_datasetscoreapi_utils.py in 
disallow_positional_args_dec(fn, instance, args, kwargs)
50     _check_no_positional(fn, args, ismethod, allowed=allowed)
51     _check_required(fn, kwargs)
---> 52     return fn(*args, **kwargs)
53 
54   return disallow_positional_args_dec(wrapped)  # pylint: disable=no-value-for-parameter
~anaconda3envspy3-TF2.0libsite-packagestensorflow_datasetscoredataset_builder.py in 
download_and_prepare(self, download_dir, download_config)
260     dl_manager = self._make_download_manager(
261         download_dir=download_dir,
--> 262         download_config=download_config)
263 
264     # Currently it's not possible to overwrite the data because it would
~anaconda3envspy3-TF2.0libsite-packagestensorflow_datasetscoredataset_builder.py in 
_make_download_manager(self, download_dir, download_config)
660         force_download=(download_config.download_mode == FORCE_REDOWNLOAD),
661         force_extraction=(download_config.download_mode == FORCE_REDOWNLOAD),
--> 662         register_checksums=download_config.register_checksums,
663     )
664 
~anaconda3envspy3-TF2.0libsite-packagestensorflow_datasetscoreapi_utils.py in 
disallow_positional_args_dec(fn, instance, args, kwargs)
50     _check_no_positional(fn, args, ismethod, allowed=allowed)
51     _check_required(fn, kwargs)
---> 52     return fn(*args, **kwargs)
53 
54   return disallow_positional_args_dec(wrapped)  # pylint: disable=no-value-for-parameter
~anaconda3envspy3-TF2.0libsite-packagestensorflow_datasetscoredownloaddownload_manager.py in 
__init__(self, download_dir, extract_dir, manual_dir, dataset_name, force_download, force_extraction, 
register_checksums)
175     self._register_checksums = register_checksums
176     # All known URLs: {url: (size, checksum)}
--> 177     self._sizes_checksums = checksums.get_all_sizes_checksums()
178     # To record what is being used: {url: (size, checksum)}
179     self._recorded_sizes_checksums = {}
~anaconda3envspy3-TF2.0libsite-packagestensorflow_datasetscoredownloadchecksums.py in 
get_all_sizes_checksums()
127   sizes_checksums = {}
128   for path in _checksum_paths().values():
--> 129     data = _get_sizes_checksums(path)
130     for url, size_checksum in data.items():
131       if (url in sizes_checksums and
~anaconda3envspy3-TF2.0libsite-packagestensorflow_datasetscoredownloadchecksums.py in 
_get_sizes_checksums(checksums_path)
117       continue
118     # URL might have spaces inside, but size and checksum will not.
--> 119     url, size, checksum = line.rsplit(' ', 2)
120     checksums[url] = (int(size), checksum)
121   return checksums

ValueError:没有足够的值来解压缩(应为3,得到1(

来自评论

将tensorflow数据集从1.2升级到4.2后,问题是解决。(转述自Niteya Shah(

我也遇到了问题,这将解决问题:

pip install tensorflow-datasets=4.3

我遇到了同样的问题,我的解决方案,只使用创建了一个新环境

conda create --name py3-TF2.0 python=3  
conda activate py3-TF2.0      
pip install --upgrade pip
pip install tensorflow
pip install --upgrade tensorflow
pip install tensorflow-datasets
pip install ipykernel

相关内容

  • 没有找到相关文章

最新更新