在我的系统上使用OpenAI Gym的“ CarRacing-v0”环境训练VAE时,调用.fit函数时出错。相同的模型在Google Colab上训练得很好。
下面显示的错误:
Track generation: 1077..1354 -> 277-tiles track
EPISODE: 0
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-22-c9f30896c44b> in <module>
14
15 vae_train_data = batch(STORAGE)
---> 16 vae.fit(vae_train_data, vae_train_data, batch_size=step, epochs =1)
17 STORAGE.clear()
18
~\anaconda3\envs\new\lib\site-packages\tensorflow_core\python\keras\engine\training.py in
fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data, shuffle,
class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps, validation_freq,
max_queue_size, workers, use_multiprocessing, **kwargs)
726 max_queue_size=max_queue_size,
727 workers=workers,
--> 728 use_multiprocessing=use_multiprocessing)
729
730 def evaluate(self,
~\anaconda3\envs\new\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py in
fit(self, model, x, y, batch_size, epochs, verbose, callbacks, validation_split, validation_data,
shuffle, class_weight, sample_weight, initial_epoch, steps_per_epoch, validation_steps,
validation_freq, **kwargs)
222 validation_data=validation_data,
223 validation_steps=validation_steps,
--> 224 distribution_strategy=strategy)
225
226 total_samples = _get_total_number_of_samples(training_data_adapter)
~\anaconda3\envs\new\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py in _
process_training_inputs(model, x, y, batch_size, epochs, sample_weights, class_weights,
steps_per_epoch, validation_split, validation_data, validation_steps, shuffle, distribution_strategy,
max_queue_size, workers, use_multiprocessing)
545 max_queue_size=max_queue_size,
546 workers=workers,
--> 547 use_multiprocessing=use_multiprocessing)
548 val_adapter = None
549 if validation_data:
~\anaconda3\envs\new\lib\site-packages\tensorflow_core\python\keras\engine\training_v2.py in
_process_inputs(model, x, y, batch_size, epochs, sample_weights, class_weights, shuffle, steps,
distribution_strategy, max_queue_size, workers, use_multiprocessing)
592 batch_size=batch_size,
593 check_steps=False,
--> 594 steps=steps)
595 adapter = adapter_cls(
596 x,
~\anaconda3\envs\new\lib\site-packages\tensorflow_core\python\keras\engine\training.py in
_standardize_user_data(self, x, y, sample_weight, class_weight, batch_size, check_steps, steps_name,
steps, validation_split, shuffle, extract_tensors_from_dataset)
2517 shapes=None,
2518 check_batch_axis=False, # Don't enforce the batch size.
-> 2519 exception_prefix='target')
2520
2521 # Generate sample-wise weight values given the `sample_weight` and
~\anaconda3\envs\new\lib\site-packages\tensorflow_core\python\keras\engine\training_utils.py in
standardize_input_data(data, names, shapes, check_batch_axis, exception_prefix)
487 raise ValueError(
488 'Error when checking model ' + exception_prefix + ': '
--> 489 'expected no data, but got:', data)
490 return []
491 if data is None:
ValueError: ('Error when checking model target: expected no data, but got:', array([[[[0.
, 0. , 0. ],
[0. , 0. , 0. ],
[0. , 0. , 0. ],
...,
我很好奇:这个问题与张量流的不同版本的使用有关吗?我正在使用Tensorflow-gpu 2.0