gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 01:23:28 24 4
gpt4 key购买 nike

我正在尝试使用 mnist 数据集在 jupyter 中使用 tensorflow 2.0 构建机器学习代码。数据集是从 tensorflow-datasets 中获取的,但在数据集的初始下载期间,下载后显示错误,无法重命名数据集,然后中止整个过程。

这是用于加载数据集的行
mnist_dataset, mnist_info = tfds.load(name='mnist', with_info=True, as_supervised=True)
这是错误

Downloading and preparing dataset mnist (11.06 MiB) to C:\Users\Main\tensorflow_datasets\mnist\1.0.0...
Dl Completed...:
0/0 [00:00<?, ? url/s]
Dl Size...:
0/0 [00:00<?, ? MiB/s]
Extraction completed...:
0/0 [00:00<?, ? file/s]






WARNING:tensorflow:From C:\Python38\Anaconda3\envs\py3-TF2.0\lib\site-packages\tensorflow_datasets\core\file_format_adapter.py:209: tf_record_iterator (from tensorflow.python.lib.io.tf_record) is deprecated and will be removed in a future version.
Instructions for updating:
Use eager execution and:
`tf.data.TFRecordDataset(path)`
WARNING:tensorflow:From C:\Python38\Anaconda3\envs\py3-TF2.0\lib\site-packages\tensorflow_datasets\core\file_format_adapter.py:209: tf_record_iterator (from tensorflow.python.lib.io.tf_record) is deprecated and will be removed in a future version.
Instructions for updating:
Use eager execution and:
`tf.data.TFRecordDataset(path)`
---------------------------------------------------------------------------
UnknownError Traceback (most recent call last)
<ipython-input-2-6bf2983938fb> in <module>
----> 1 mnist_dataset, mnist_info = tfds.load(name='mnist', with_info=True, as_supervised=True)

C:\Python38\Anaconda3\envs\py3-TF2.0\lib\site-packages\tensorflow_datasets\core\api_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

C:\Python38\Anaconda3\envs\py3-TF2.0\lib\site-packages\tensorflow_datasets\core\registered.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:

C:\Python38\Anaconda3\envs\py3-TF2.0\lib\site-packages\tensorflow_datasets\core\api_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

C:\Python38\Anaconda3\envs\py3-TF2.0\lib\site-packages\tensorflow_datasets\core\dataset_builder.py in download_and_prepare(self, download_dir, download_config)
305 self.info.size_in_bytes = dl_manager.downloaded_size
306 # Write DatasetInfo to disk, even if we haven't computed the statistics.
--> 307 self.info.write_to_directory(self._data_dir)
308 self._log_download_done()
309

C:\Python38\Anaconda3\envs\py3-TF2.0\lib\contextlib.py in __exit__(self, type, value, traceback)
117 if type is None:
118 try:
--> 119 next(self.gen)
120 except StopIteration:
121 return False

C:\Python38\Anaconda3\envs\py3-TF2.0\lib\site-packages\tensorflow_datasets\core\file_format_adapter.py in incomplete_dir(dirname)
198 try:
199 yield tmp_dir
--> 200 tf.io.gfile.rename(tmp_dir, dirname)
201 finally:
202 if tf.io.gfile.exists(tmp_dir):

C:\Python38\Anaconda3\envs\py3-TF2.0\lib\site-packages\tensorflow\python\lib\io\file_io.py in rename_v2(src, dst, overwrite)
506 """
507 _pywrap_file_io.RenameFile(
--> 508 compat.as_bytes(src), compat.as_bytes(dst), overwrite)
509
510

UnknownError: Failed to rename: C:\Users\Main\tensorflow_datasets\mnist\1.0.0.incompleteI3ZU6X to: C:\Users\Main\tensorflow_datasets\mnist\1.0.0 : Access is denied.
; Input/output error

最佳答案

一个 GitHub 问题已被打开以解决它。
在该线程中,提出了一个时间解决方案,尽管它意味着手动修改一些 TensorFlow 函数。我不确定它是否会对模型性能产生影响,但如果您想尝试一下,我会在下面发布链接:
Windows - tensorflow.python.framework.errors_impl.UnknownError: Failed to rename: #41380

关于python - 重命名失败;访问被拒绝的 Tensorflow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62258549/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com