Closed barvinog closed 2 years ago
very difficult to help you there, as I cannot reproduce this bug. I would guess that either your tensorflow installation is not working or a version incompatibility. To get you started; here is my setup; I am using python 3.8 with keras 2.5:
python --version
-> python 3.8.10
python -c "import keras; print(keras.__version__)"
-> 2.5.0
(I guess this can be closed)
Thank you for the source code of Chapter 5. I executed python mnx_generateTrainingData.py - OK Then python sup_network.py - OK
Then I executed python sup_eval.py and got the error :
Traceback (most recent call last): File "sup_eval.py", line 6, in
model = keras.models.load_model("supervised_model.keras")
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/engine/saving.py", line 492, in load_wrapper
return load_function(*args, *kwargs)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/engine/saving.py", line 584, in load_model
model = _deserialize_model(h5dict, custom_objects, compile)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/engine/saving.py", line 369, in _deserialize_model
sample_weight_mode=sample_weight_mode)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 75, in symbolic_fn_wrapper
return func(args, **kwargs)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/engine/training.py", line 229, in compile
self.total_loss = self._prepare_total_loss(masks)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/engine/training.py", line 692, in _prepare_total_loss
y_true, y_pred, sample_weight=sample_weight)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/losses.py", line 73, in call
losses, sample_weight, reduction=self.reduction)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/utils/losses_utils.py", line 156, in compute_weighted_loss
Reduction.validate(reduction)
File "/home/barvinog/anaconda3/lib/python3.7/site-packages/keras/utils/losses_utils.py", line 35, in validate
raise ValueError('Invalid Reduction Key %s.' % key)
ValueError: Invalid Reduction Key auto.