ageron/handson-ml2

[QUESTION] Chapter 14 error

moghalis opened this issue · 0 comments

When trying to load tensorflow dataset tf_flowers, I receive this error:
import tensorflow_datasets as tfds

dataset, info = tfds.load("tf_flowers", as_supervised=True, with_info=True)

Downloading and preparing dataset Unknown size (download: Unknown size, generated: Unknown size, total: Unknown size) to C:\Users\Mohamed Almoghalis\tensorflow_datasets\tf_flowers\3.0.1...
Dl Completed...: 100%
1/1 [00:00<00:00, 8.41 url/s]
Dl Size...: 100%
228813984/228813984 [00:00<00:00, 9545797691.89 MiB/s]
Generating splits...: 0%
0/1 [00:00<?, ? splits/s]

TypeError Traceback (most recent call last)
in
1 import tensorflow_datasets as tfds
2
----> 3 dataset, info = tfds.load("tf_flowers", as_supervised=True, with_info=True)

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\wrapt\wrappers.py in call(self, *args, **kwargs)
564 # wrapped using the staticmethod decorator.
565
--> 566 return self._self_wrapper(self.wrapped, self._self_instance,
567 args, kwargs)
568

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tensorflow_datasets\core\logging_init_.py in call(self, function, instance, args, kwargs)
167 metadata = self._start_call()
168 try:
--> 169 return function(*args, **kwargs)
170 except Exception:
171 metadata.mark_error()

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tensorflow_datasets\core\load.py in load(name, split, data_dir, batch_size, shuffle_files, download, as_supervised, decoders, read_config, with_info, builder_kwargs, download_and_prepare_kwargs, as_dataset_kwargs, try_gcs)
638 try_gcs,
639 )
--> 640 _download_and_prepare_builder(dbuilder, download, download_and_prepare_kwargs)
641
642 if as_dataset_kwargs is None:

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tensorflow_datasets\core\load.py in _download_and_prepare_builder(dbuilder, download, download_and_prepare_kwargs)
497 if download:
498 download_and_prepare_kwargs = download_and_prepare_kwargs or {}
--> 499 dbuilder.download_and_prepare(**download_and_prepare_kwargs)
500
501

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\wrapt\wrappers.py in call(self, *args, **kwargs)
603 return self._self_wrapper(wrapped, instance, args, kwargs)
604
--> 605 return self._self_wrapper(self.wrapped, self._self_instance,
606 args, kwargs)
607

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tensorflow_datasets\core\logging_init_.py in call(self, function, instance, args, kwargs)
167 metadata = self._start_call()
168 try:
--> 169 return function(*args, **kwargs)
170 except Exception:
171 metadata.mark_error()

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tensorflow_datasets\core\dataset_builder.py in download_and_prepare(self, download_dir, download_config, file_format)
644 self.info.read_from_directory(self._data_dir)
645 else:
--> 646 self._download_and_prepare(
647 dl_manager=dl_manager,
648 download_config=download_config,

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tensorflow_datasets\core\dataset_builder.py in _download_and_prepare(self, dl_manager, download_config)
1533 filetype_suffix=path_suffix,
1534 )
-> 1535 future = split_builder.submit_split_generation(
1536 split_name=split_name,
1537 generator=generator,

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tensorflow_datasets\core\split_builder.py in submit_split_generation(self, split_name, generator, filename_template, disable_shuffling)
339 # _build_from_xyz method.
340 if isinstance(generator, collections.abc.Iterable):
--> 341 return self._build_from_generator(**build_kwargs)
342 else: # Otherwise, beam required
343 unknown_generator_type = TypeError(

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tensorflow_datasets\core\split_builder.py in _build_from_generator(self, split_name, generator, filename_template, disable_shuffling)
404 shard_config=self._shard_config,
405 )
--> 406 for key, example in utils.tqdm(
407 generator,
408 desc=f'Generating {split_name} examples...',

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tqdm\notebook.py in iter(self)
255 def iter(self):
256 try:
--> 257 for obj in super(tqdm_notebook, self).iter():
258 # return super(tqdm...) will not catch exception
259 yield obj

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tqdm\std.py in iter(self)
1178
1179 try:
-> 1180 for obj in iterable:
1181 yield obj
1182 # Update and possibly print the progressbar.

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tensorflow_datasets\datasets\tf_flowers\tf_flowers_dataset_builder.py in _generate_examples(self, images_dir_path)
60 The image path and its corresponding label.
61 """
---> 62 for fname, fobj in images_dir_path:
63 if fname.endswith(".jpg"):
64 image_dir, image_file = os.path.split(fname)

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tensorflow_datasets\core\download\extractor.py in iter_tar(arch_f, stream)
177
178 with _open_or_pass(arch_f) as fobj:
--> 179 tar = tarfile.open(mode=read_type, fileobj=fobj)
180 for member in tar:
181 if stream and (member.islnk() or member.issym()):

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\tarfile.py in open(cls, name, mode, fileobj, bufsize, **kwargs)
1595 func = getattr(cls, cls.OPEN_METH[comptype])
1596 if fileobj is not None:
-> 1597 saved_pos = fileobj.tell()
1598 try:
1599 return func(name, "r", fileobj, **kwargs)

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\lib\io\file_io.py in tell(self)
184 """Returns the current position in the file."""
185 if self._read_check_passed:
--> 186 self._preread_check()
187 return self._read_buf.tell()
188 else:

c:\users\mohamed almoghalis\appdata\local\programs\python\python38\lib\site-packages\tensorflow\python\lib\io\file_io.py in _preread_check(self)
76 raise errors.PermissionDeniedError(None, None,
77 "File isn't open for reading")
---> 78 self._read_buf = _pywrap_file_io.BufferedInputStream(
79 self.__name, 1024 * 512)
80

TypeError: init(): incompatible constructor arguments. The following argument types are supported:
1. tensorflow.python._pywrap_file_io.BufferedInputStream(arg0: str, arg1: int)

Invoked with: WindowsGPath('C:\Users\Mohamed Almoghalis\tensorflow_datasets\downloads\downl.tenso.org_examp_image_flowe_photoTFSs55Ear_4To2XDT2UOcd1b8b4KWLRk5acYPj5ZXZw.tgz'), 524288