I am in my third round of hyperparameter tuning and I wanted to check the best model on my test set. Unfortunately it did not work out. Moreover, a lot of function such as the "lr_normalizer", "multiple_gpu", "recover_best_model" or "Deploy" does not work either.
First I though I have this problem (https://stackoverflow.com/questions/58878421/unexpected-keyword-argument-ragged-in-keras), but even after taking care that I only import tensorflow.keras packages neither of the above mentioned functions worked.
4) My Code:
Imports:
import tensorflow as tf
import tensorflow.keras as keras
/opt/conda/lib/python3.7/site-packages/talos/commands/evaluate.py in evaluate(self, x, y, task, metric, model_id, folds, shuffle, asc, print_out)
63
64 from ..utils.best_model import activate_model
---> 65 model = activate_model(self.scan_object, model_id)
66
67 from ..utils.validation_split import kfold
/opt/conda/lib/python3.7/site-packages/talos/utils/best_model.py in activate_model(self, model_id)
18 '''Loads the model from the json that is stored in the Scan object'''
19
---> 20 model = model_from_json(self.saved_models[model_id])
21 model.set_weights(self.saved_weights[model_id])
22
/opt/conda/lib/python3.7/site-packages/keras/engine/saving.py in model_from_json(json_string, custom_objects)
659 config = json.loads(json_string)
660 from ..layers import deserialize
--> 661 return deserialize(config, custom_objects=custom_objects)
662
663
/opt/conda/lib/python3.7/site-packages/keras/utils/generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
145 config['config'],
146 custom_objects=dict(list(_GLOBAL_CUSTOM_OBJECTS.items()) +
--> 147 list(custom_objects.items())))
148 with CustomObjectScope(custom_objects):
149 return cls.from_config(config['config'])
/opt/conda/lib/python3.7/site-packages/keras/engine/network.py in from_config(cls, config, custom_objects)
1054 # First, we create all layers and enqueue nodes to be processed
1055 for layer_data in config['layers']:
-> 1056 process_layer(layer_data)
1057
1058 # Then we process nodes in order of layer depth.
/opt/conda/lib/python3.7/site-packages/keras/utils/generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
147 list(custom_objects.items())))
148 with CustomObjectScope(custom_objects):
--> 149 return cls.from_config(config['config'])
150 else:
151 # Then cls may be a function returning a class.
/opt/conda/lib/python3.7/site-packages/keras/engine/base_layer.py in from_config(cls, config)
1177 A layer instance.
1178 """
-> 1179 return cls(**config)
1180
1181 def count_params(self):
/opt/conda/lib/python3.7/site-packages/keras/legacy/interfaces.py in wrapper(*args, *kwargs)
89 warnings.warn('Update your ' + object_name + ' call to the ' +
90 'Keras 2 API: ' + signature, stacklevel=2)
---> 91 return func(args, **kwargs)
92 wrapper._original_function = func
93 return wrapper
TypeError: init() got an unexpected keyword argument 'ragged'
1) Confirm the below
2) Include the output of:
talos.__version__ == 0.6.4
tf.__version__ == 2.1.0
tf.keras.__version__ == 2.2.4-tf
3) Explain clearly what you are trying to achieve
I am in my third round of hyperparameter tuning and I wanted to check the best model on my test set. Unfortunately it did not work out. Moreover, a lot of function such as the "lr_normalizer", "multiple_gpu", "recover_best_model" or "Deploy" does not work either. First I though I have this problem (https://stackoverflow.com/questions/58878421/unexpected-keyword-argument-ragged-in-keras), but even after taking care that I only import tensorflow.keras packages neither of the above mentioned functions worked.
4) My Code:
5) Error:
/opt/conda/lib/python3.7/site-packages/talos/commands/evaluate.py in evaluate(self, x, y, task, metric, model_id, folds, shuffle, asc, print_out) 63 64 from ..utils.best_model import activate_model ---> 65 model = activate_model(self.scan_object, model_id) 66 67 from ..utils.validation_split import kfold
/opt/conda/lib/python3.7/site-packages/talos/utils/best_model.py in activate_model(self, model_id) 18 '''Loads the model from the json that is stored in the Scan object''' 19 ---> 20 model = model_from_json(self.saved_models[model_id]) 21 model.set_weights(self.saved_weights[model_id]) 22
/opt/conda/lib/python3.7/site-packages/keras/engine/saving.py in model_from_json(json_string, custom_objects) 659 config = json.loads(json_string) 660 from ..layers import deserialize --> 661 return deserialize(config, custom_objects=custom_objects) 662 663
/opt/conda/lib/python3.7/site-packages/keras/layers/init.py in deserialize(config, custom_objects) 166 module_objects=globs, 167 custom_objects=custom_objects, --> 168 printable_module_name='layer')
/opt/conda/lib/python3.7/site-packages/keras/utils/generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name) 145 config['config'], 146 custom_objects=dict(list(_GLOBAL_CUSTOM_OBJECTS.items()) + --> 147 list(custom_objects.items()))) 148 with CustomObjectScope(custom_objects): 149 return cls.from_config(config['config'])
/opt/conda/lib/python3.7/site-packages/keras/engine/network.py in from_config(cls, config, custom_objects) 1054 # First, we create all layers and enqueue nodes to be processed 1055 for layer_data in config['layers']: -> 1056 process_layer(layer_data) 1057 1058 # Then we process nodes in order of layer depth.
/opt/conda/lib/python3.7/site-packages/keras/engine/network.py in process_layer(layer_data) 1040 1041 layer = deserialize_layer(layer_data, -> 1042 custom_objects=custom_objects) 1043 created_layers[layer_name] = layer 1044
/opt/conda/lib/python3.7/site-packages/keras/layers/init.py in deserialize(config, custom_objects) 166 module_objects=globs, 167 custom_objects=custom_objects, --> 168 printable_module_name='layer')
/opt/conda/lib/python3.7/site-packages/keras/utils/generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name) 147 list(custom_objects.items()))) 148 with CustomObjectScope(custom_objects): --> 149 return cls.from_config(config['config']) 150 else: 151 # Then
cls
may be a function returning a class./opt/conda/lib/python3.7/site-packages/keras/engine/base_layer.py in from_config(cls, config) 1177 A layer instance. 1178 """ -> 1179 return cls(**config) 1180 1181 def count_params(self):
/opt/conda/lib/python3.7/site-packages/keras/legacy/interfaces.py in wrapper(*args, *kwargs) 89 warnings.warn('Update your
' + object_name + '
call to the ' + 90 'Keras 2 API: ' + signature, stacklevel=2) ---> 91 return func(args, **kwargs) 92 wrapper._original_function = func 93 return wrapperTypeError: init() got an unexpected keyword argument 'ragged'