다음을 실행하면 에러가 납니다.
송정현
11달 전
from __future__ import absolute_import, division, print_function, unicode_literals
import numpy as np
import tensorflow as tf
import tensorflow_hub as hub
import tensorflow_datasets as tfds
train_validation_split = tfds.Split.TRAIN.subsplit([6, 4])
(train_data, validation_data), test_data = tfds.load(
name="imdb_reviews",
split=(train_validation_split, tfds.Split.TEST),
as_supervised=True)
print("Version: ", tf.__version__)
print("Eager mode: ", tf.executing_eagerly())
print("Hub version: ", hub.__version__)
print("GPU is", "available" if tf.config.experimental.list_physical_devices("GPU") else "NOT AVAILABLE")
Version: 2.0.0
Eager mode: True
Hub version: 0.7.0
GPU is NOT AVAILABLE
다음과 같은 에러가 납니다.
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-6-55c5f5ff433f> in <module>
6 name="imdb_reviews",
7 split=(train_validation_split, tfds.Split.TEST),
----> 8 as_supervised=True)
~\Anaconda3\envs\jhsong37\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
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\registered.py in load(name, split, data_dir, batch_size, in_memory, shuffle_files, download, as_supervised, decoders, read_config, with_info, builder_kwargs, download_and_prepare_kwargs, as_dataset_kwargs, try_gcs)
316 as_dataset_kwargs.setdefault("read_config", read_config)
317
--> 318 ds = dbuilder.as_dataset(**as_dataset_kwargs)
319 if with_info:
320 return ds, dbuilder.info
~\Anaconda3\envs\jhsong37\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
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\dataset_builder.py in as_dataset(self, split, batch_size, shuffle_files, decoders, read_config, as_supervised, in_memory)
474 in_memory=in_memory,
475 )
--> 476 datasets = utils.map_nested(build_single_dataset, split, map_tuple=True)
477 return datasets
478
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\utils\py_utils.py in map_nested(function, data_struct, dict_only, map_tuple)
151 if isinstance(data_struct, tuple(types)):
152 mapped = [map_nested(function, v, dict_only, map_tuple)
--> 153 for v in data_struct]
154 if isinstance(data_struct, list):
155 return mapped
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\utils\py_utils.py in <listcomp>(.0)
151 if isinstance(data_struct, tuple(types)):
152 mapped = [map_nested(function, v, dict_only, map_tuple)
--> 153 for v in data_struct]
154 if isinstance(data_struct, list):
155 return mapped
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\utils\py_utils.py in map_nested(function, data_struct, dict_only, map_tuple)
151 if isinstance(data_struct, tuple(types)):
152 mapped = [map_nested(function, v, dict_only, map_tuple)
--> 153 for v in data_struct]
154 if isinstance(data_struct, list):
155 return mapped
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\utils\py_utils.py in <listcomp>(.0)
151 if isinstance(data_struct, tuple(types)):
152 mapped = [map_nested(function, v, dict_only, map_tuple)
--> 153 for v in data_struct]
154 if isinstance(data_struct, list):
155 return mapped
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\utils\py_utils.py in map_nested(function, data_struct, dict_only, map_tuple)
157 return tuple(mapped)
158 # Singleton
--> 159 return function(data_struct)
160
161
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\dataset_builder.py in _build_single_dataset(self, split, shuffle_files, batch_size, decoders, read_config, as_supervised, in_memory)
542 shuffle_files=shuffle_files,
543 decoders=decoders,
--> 544 read_config=read_config,
545 )
546
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\dataset_builder.py in _as_dataset(self, split, decoders, read_config, shuffle_files)
899 split_infos=self.info.splits.values(),
900 read_config=read_config,
--> 901 shuffle_files=shuffle_files,
902 )
903 else:
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\tfrecords_reader.py in read(self, name, instructions, split_infos, read_config, shuffle_files)
244 name2len=name2len, name2shard_lengths=name2shard_lengths,
245 shuffle_files=shuffle_files)
--> 246 datasets = utils.map_nested(read_instruction, instructions, map_tuple=True)
247 return datasets
248
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\utils\py_utils.py in map_nested(function, data_struct, dict_only, map_tuple)
157 return tuple(mapped)
158 # Singleton
--> 159 return function(data_struct)
160
161
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\tfrecords_reader.py in _read_single_instruction(instruction, parse_fn, read_config, name, path, name2len, name2shard_lengths, shuffle_files)
138 """
139 if not isinstance(instruction, ReadInstruction):
--> 140 instruction = ReadInstruction.from_spec(instruction)
141 absolute_instructions = instruction.to_absolute(name2len)
142 files = list(itertools.chain.from_iterable([
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\tfrecords_reader.py in from_spec(cls, spec)
436 if not subs:
437 raise AssertionError('No instructions could be built out of %s' % spec)
--> 438 instruction = _str_to_relative_instruction(subs[0])
439 return sum([_str_to_relative_instruction(sub) for sub in subs[1:]],
440 instruction)
~\Anaconda3\envs\jhsong37\lib\site-packages\tensorflow_datasets\core\tfrecords_reader.py in _str_to_relative_instruction(spec)
277 res = _SUB_SPEC_RE.match(spec)
278 if not res:
--> 279 raise AssertionError('Unrecognized instruction format: %s' % spec)
280 unit = '%' if res.group('from_pct') or res.group('to_pct') else 'abs'
281 return ReadInstruction(
AssertionError: Unrecognized instruction format: NamedSplit('train')(tfds.percent[0:60])