Comments (7)
ValueError Traceback (most recent call last)
in
5 vae = VAE(encoder, decoder)
6 vae.compile(optimizer=keras.optimizers.Adam())
----> 7 vae.fit(mnist_digits, epochs=30, batch_size=128)
/opt/conda/lib/python3.6/site-packages/tensorflow/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)
641 max_queue_size=max_queue_size,
642 workers=workers,
--> 643 use_multiprocessing=use_multiprocessing)
644
645 def evaluate(self,
/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/engine/training_arrays.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)
630 steps=steps_per_epoch,
631 validation_split=validation_split,
--> 632 shuffle=shuffle)
633
634 if validation_data:
/opt/conda/lib/python3.6/site-packages/tensorflow/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)
2388 target_tensors=target_tensors,
2389 run_eagerly=self.run_eagerly,
-> 2390 cloning=self._cloning)
2391
2392 # In graph mode, if we had just set inputs and targets as symbolic tensors
/opt/conda/lib/python3.6/site-packages/tensorflow/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
456 self._self_setattr_tracking = False # pylint: disable=protected-access
457 try:
--> 458 result = method(self, *args, **kwargs)
459 finally:
460 self._self_setattr_tracking = previous_value # pylint: disable=protected-access
/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py in compile(self, optimizer, loss, metrics, loss_weights, sample_weight_mode, weighted_metrics, target_tensors, distribute, **kwargs)
335
336 # Creates the model loss and weighted metrics sub-graphs.
--> 337 self._compile_weights_loss_and_weighted_metrics()
338
339 # Functions for train, test and predict will
/opt/conda/lib/python3.6/site-packages/tensorflow/python/training/tracking/base.py in _method_wrapper(self, *args, **kwargs)
456 self._self_setattr_tracking = False # pylint: disable=protected-access
457 try:
--> 458 result = method(self, *args, **kwargs)
459 finally:
460 self._self_setattr_tracking = previous_value # pylint: disable=protected-access
/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py in _compile_weights_loss_and_weighted_metrics(self, sample_weights)
1492 # loss_weight_2 * output_2_loss_fn(...) +
1493 # layer losses.
-> 1494 self.total_loss = self._prepare_total_loss(masks)
1495
1496 def _prepare_skip_target_masks(self):
/opt/conda/lib/python3.6/site-packages/tensorflow/python/keras/engine/training.py in _prepare_total_loss(self, masks)
1593 if total_loss is None:
1594 if not self.losses:
-> 1595 raise ValueError('The model cannot be compiled '
1596 'because it has no loss to optimize.')
1597 else:
ValueError: The model cannot be compiled because it has no loss to optimize.
from keras-io.
I wasn't able to reproduce this issue while running tensorflow 2.2. What version are you using?
from keras-io.
I also met this issue with tensorflow 2.1, but fixed it by updating to 2.2
However, there is a warning:
WARNING:tensorflow:AutoGraph could not transform <bound method VAE.train_step of <main.VAE object at 0x7f8319e7da90>> and will run it as-is.
Please report this to the TensorFlow team. When filing the bug, set the verbosity to 10 (on Linux, export AUTOGRAPH_VERBOSITY=10
) and attach the full output.
from keras-io.
I encountered this issue using TF 2.1.0. Please update the example - some environments are still using TF 2.1.0 and older versions. For instance see conda's offering TD 2.1.0 for Windows here:
from keras-io.
Hi,
Please upgrade to the latest Keras/ Tensorflow version
You can use Keras using Tensorflow import as below.
import tensorflow as tf
input_layer = tf.keras.Input(shape=[100])
Let us know if you still face any error in latest version. Thanks!
from keras-io.
This issue is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.
from keras-io.
This issue was closed because it has been inactive for 28 days. Please reopen if you'd like to work on this further.
from keras-io.
Related Issues (20)
- Error occurred in the Named Entity Recognition using Transformers example HOT 6
- Support Distributed Training for Fine-tuning Stable Diffusion Example HOT 5
- kagglecatsanddogs_5340.zip not available to downoad - image_classification_from_scratch.py HOT 4
- Problem with training yolov8 on TPU
- model not converging the sparse categorical accuracy stays same for the whole epochs. HOT 6
- batch out of range & loss value becomes 'nan' when running monocular depth estimation HOT 6
- How to make individual predictions using the FNet example? HOT 4
- Multi-GPU distributed training with PyTorch
- [Movielens Example] Impossibile to save model: Cannot serialize object Ellipsis HOT 4
- TypeError: Sampler.__call__() got an unexpected keyword argument 'end_token_id' HOT 2
- ValueError: The filepath provided must end in `.keras` (Keras model format). Received: filepath=Model_ckpt.h5 HOT 10
- Hardware requirement for examples/rl/deep_q_network_breakout.py? HOT 5
- bayesian_neural_networks failed with Mixed Precision enabled HOT 3
- Would it be possible to make lstm_seq2seq support mixed precision? HOT 1
- Will it be a good Idea to add a tutorial to train a Image Classification suing ViT using CLS token. HOT 2
- Cannot export a slightly customized XLMRoberta model from keras_nlp HOT 1
- tutorial bug in consistency_training HOT 4
- Help runing the lastest version of ".\examples\vision\captcha_ocr.py" HOT 1
- Timeseries Classification Transformer: Last -> First HOT 4
- GTP miniature model don't load. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from keras-io.