Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: __init__() got an unexpected keyword argument 'ragged' #41

Closed
digvijay77 opened this issue Nov 13, 2019 · 2 comments
Closed
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@digvijay77
Copy link

TypeError Traceback (most recent call last)
in ()
----> 1 model=load_model('keras_model.h5')

~\Anaconda3\lib\site-packages\keras\engine\saving.py in load_model(filepath, custom_objects, compile)
417 f = h5dict(filepath, 'r')
418 try:
--> 419 model = _deserialize_model(f, custom_objects, compile)
420 finally:
421 if opened_new_file:

~\Anaconda3\lib\site-packages\keras\engine\saving.py in _deserialize_model(f, custom_objects, compile)
223 raise ValueError('No model found in config.')
224 model_config = json.loads(model_config.decode('utf-8'))
--> 225 model = model_from_config(model_config, custom_objects=custom_objects)
226 model_weights_group = f['model_weights']
227

~\Anaconda3\lib\site-packages\keras\engine\saving.py in model_from_config(config, custom_objects)
456 'Sequential.from_config(config)?')
457 from ..layers import deserialize
--> 458 return deserialize(config, custom_objects=custom_objects)
459
460

~\Anaconda3\lib\site-packages\keras\layers_init_.py in deserialize(config, custom_objects)
53 module_objects=globs,
54 custom_objects=custom_objects,
---> 55 printable_module_name='layer')

~\Anaconda3\lib\site-packages\keras\utils\generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
143 config['config'],
144 custom_objects=dict(list(_GLOBAL_CUSTOM_OBJECTS.items()) +
--> 145 list(custom_objects.items())))
146 with CustomObjectScope(custom_objects):
147 return cls.from_config(config['config'])

~\Anaconda3\lib\site-packages\keras\engine\sequential.py in from_config(cls, config, custom_objects)
298 for conf in layer_configs:
299 layer = layer_module.deserialize(conf,
--> 300 custom_objects=custom_objects)
301 model.add(layer)
302 if not model.inputs and build_input_shape:

~\Anaconda3\lib\site-packages\keras\layers_init_.py in deserialize(config, custom_objects)
53 module_objects=globs,
54 custom_objects=custom_objects,
---> 55 printable_module_name='layer')

~\Anaconda3\lib\site-packages\keras\utils\generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
143 config['config'],
144 custom_objects=dict(list(_GLOBAL_CUSTOM_OBJECTS.items()) +
--> 145 list(custom_objects.items())))
146 with CustomObjectScope(custom_objects):
147 return cls.from_config(config['config'])

~\Anaconda3\lib\site-packages\keras\engine\sequential.py in from_config(cls, config, custom_objects)
298 for conf in layer_configs:
299 layer = layer_module.deserialize(conf,
--> 300 custom_objects=custom_objects)
301 model.add(layer)
302 if not model.inputs and build_input_shape:

~\Anaconda3\lib\site-packages\keras\layers_init_.py in deserialize(config, custom_objects)
53 module_objects=globs,
54 custom_objects=custom_objects,
---> 55 printable_module_name='layer')

~\Anaconda3\lib\site-packages\keras\utils\generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
143 config['config'],
144 custom_objects=dict(list(_GLOBAL_CUSTOM_OBJECTS.items()) +
--> 145 list(custom_objects.items())))
146 with CustomObjectScope(custom_objects):
147 return cls.from_config(config['config'])

~\Anaconda3\lib\site-packages\keras\engine\network.py in from_config(cls, config, custom_objects)
1020 # First, we create all layers and enqueue nodes to be processed
1021 for layer_data in config['layers']:
-> 1022 process_layer(layer_data)
1023 # Then we process nodes in order of layer depth.
1024 # Nodes that cannot yet be processed (if the inbound node

~\Anaconda3\lib\site-packages\keras\engine\network.py in process_layer(layer_data)
1006
1007 layer = deserialize_layer(layer_data,
-> 1008 custom_objects=custom_objects)
1009 created_layers[layer_name] = layer
1010

~\Anaconda3\lib\site-packages\keras\layers_init_.py in deserialize(config, custom_objects)
53 module_objects=globs,
54 custom_objects=custom_objects,
---> 55 printable_module_name='layer')

~\Anaconda3\lib\site-packages\keras\utils\generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
145 list(custom_objects.items())))
146 with CustomObjectScope(custom_objects):
--> 147 return cls.from_config(config['config'])
148 else:
149 # Then cls may be a function returning a class.

~\Anaconda3\lib\site-packages\keras\engine\base_layer.py in from_config(cls, config)
1107 A layer instance.
1108 """
-> 1109 return cls(**config)
1110
1111 def count_params(self):

~\Anaconda3\lib\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'

@digvijay77
Copy link
Author

how do i solve this?

@irealva irealva added the documentation Improvements or additions to documentation label Nov 14, 2019
@GautamBose
Copy link
Contributor

I found this issue was fixed by importing keras from tensorflow like this:

import tensorflow.keras

checkout #44 for a complete snippet on importing and inferencing with the keras models.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants