error when running test example(test.py)
See original GitHub issueHi asmith26, I’m trying run your pretrained model, but encountered the following error:
python test.py
Using TensorFlow backend.
DEBUG:root:Loading data...
DEBUG:root:Loading pre-trained model...
/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py:1242: UserWarning: Update your `InputLayer` call to the Keras 2 API: `InputLayer(dtype="float32", batch_input_shape=[None, 3, ..., name="input_1")`
return cls(**config)
/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py:1242: UserWarning: Update your `Conv2D` call to the Keras 2 API: `Conv2D(kernel_initializer="he_normal", kernel_constraint=None, activity_regularizer=None, trainable=True, padding="same", strides=[1, 1], filters=16, use_bias=False, name="convolution2d_1", bias_regularizer=None, bias_constraint=None, data_format="channels_first", kernel_regularizer={u'l2': 0...., activation="linear", kernel_size=(3, 3))`
return cls(**config)
Traceback (most recent call last):
File "test.py", line 52, in <module>
model = model_from_json( open( 'WRN-{0}-{1}.json'.format(depth, k) ).read() )
File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 339, in model_from_json
return layer_module.deserialize(config, custom_objects=custom_objects)
File "/usr/local/lib/python2.7/dist-packages/keras/layers/__init__.py", line 54, in deserialize
printable_module_name='layer')
File "/usr/local/lib/python2.7/dist-packages/keras/utils/generic_utils.py", line 139, in deserialize_keras_object
list(custom_objects.items())))
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 2450, in from_config
process_layer(layer_data)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 2419, in process_layer
custom_objects=custom_objects)
File "/usr/local/lib/python2.7/dist-packages/keras/layers/__init__.py", line 54, in deserialize
printable_module_name='layer')
File "/usr/local/lib/python2.7/dist-packages/keras/utils/generic_utils.py", line 141, in deserialize_keras_object
return cls.from_config(config['config'])
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 1242, in from_config
return cls(**config)
File "/usr/local/lib/python2.7/dist-packages/keras/legacy/interfaces.py", line 87, in wrapper
return func(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/keras/layers/convolutional.py", line 458, in __init__
**kwargs)
File "/usr/local/lib/python2.7/dist-packages/keras/layers/convolutional.py", line 112, in __init__
self.kernel_regularizer = regularizers.get(kernel_regularizer)
File "/usr/local/lib/python2.7/dist-packages/keras/regularizers.py", line 75, in get
return deserialize(identifier)
File "/usr/local/lib/python2.7/dist-packages/keras/regularizers.py", line 68, in deserialize
printable_module_name='regularizer')
File "/usr/local/lib/python2.7/dist-packages/keras/utils/generic_utils.py", line 122, in deserialize_keras_object
raise ValueError('Improper config format: ' + str(config))
ValueError: Improper config format: {u'l2': 0.0005000000237487257, u'name': u'WeightRegularizer', u'l1': 0.0}
the errors occur at:
model = model_from_json( open( 'WRN-{0}-{1}.json'.format(depth, k) ).read() )
is this pretrained model just for theano? can i use it on tensorflow? (I failed to train my own model [run out of gpu memory])
Thanks
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Error running test with pytest #4334 - microsoft/vscode-python
I have a simple test scenario which yields some errors in vs code. I'm trying to run the following little program with the...
Read more >Unable to run the test in python due to module not found error
But, when running the test, python tests/test_something.py I get following error. Traceback (most recent call last): File "/home/s1n7ax/ ...
Read more >unittest — Unit testing framework — Python 3.11.1 ...
The above examples show the most commonly used unittest features which are sufficient to meet many ... Stop the test run on the...
Read more >Testing Python in Visual Studio Code
If discovery fails (for example, the test framework isn't installed or you have a syntax error in your test file), you'll see an...
Read more >Getting Started With Testing in Python
On the context menu, choose the run command for unittest . For example, choose Run 'Unittests in my Tests…'. This will execute unittest...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For me the error was fixed with:
It seems that
from_config
expects a class name and config also for the toplevel object, just like the objects contained in the config. Could very well be related to a version difference.Following some fantastic updates by @imdeep2905 in https://github.com/asmith26/wide_resnets_keras/pull/13, I have found the code to be working and learning successfully again. Hence closing (please feel free to reopen if any more problems persist).