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

ValueError: bad marshal data (unknown type code) #4

Open
muthiyanbhushan opened this issue Feb 6, 2020 · 2 comments
Open

ValueError: bad marshal data (unknown type code) #4

muthiyanbhushan opened this issue Feb 6, 2020 · 2 comments

Comments

@muthiyanbhushan
Copy link

muthiyanbhushan commented Feb 6, 2020

I converted the jupyter notebook "Embedding_Space_Visualisation.ipynb" to the python script and I was running using the Python3 environment with Cuda-10.1 installed on my laptop.

I am getting a ValueError: bad marshal data (unknown type code)

Traceback (most recent call last):
File "Embedding_Space_Visualisation.py", line 38, in
siamese = load_model(model_path)
File "/home/user/.local/lib/python3.6/site-packages/keras/engine/saving.py", line 492, in load_wrapper
return load_function(*args, **kwargs)
File "/home/user/.local/lib/python3.6/site-packages/keras/engine/saving.py", line 584, in load_model
model = _deserialize_model(h5dict, custom_objects, compile)
File "/home/user/.local/lib/python3.6/site-packages/keras/engine/saving.py", line 274, in _deserialize_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "/home/user/.local/lib/python3.6/site-packages/keras/engine/saving.py", line 627, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "/home/user/.local/lib/python3.6/site-packages/keras/layers/init.py", line 168, in deserialize
printable_module_name='layer')
File "/home/user/.local/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 147, in deserialize_keras_object
list(custom_objects.items())))
File "/home/user/.local/lib/python3.6/site-packages/keras/engine/network.py", line 1056, in from_config
process_layer(layer_data)
File "/home/user/.local/lib/python3.6/site-packages/keras/engine/network.py", line 1042, in process_layer
custom_objects=custom_objects)
File "/home/user/.local/lib/python3.6/site-packages/keras/layers/init.py", line 168, in deserialize
printable_module_name='layer')
File "/home/user/.local/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 147, in deserialize_keras_object
list(custom_objects.items())))
File "/home/user/.local/lib/python3.6/site-packages/keras/layers/core.py", line 764, in from_config
function = func_load(config['function'], globs=globs)
File "/home/user/.local/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 237, in func_load
code = marshal.loads(raw_code)
ValueError: bad marshal data (unknown type code)

Can you please help me with the error?
Every help will be appreciated.
Thank you.

@andrewMpapalika
Copy link

andrewMpapalika commented Feb 26, 2020

Hi @muthiyanbhushan and @oscarknagg ,

I am also trying to use this code for my research as part of a model I am trying to implement.

The error above started from;
File "Embedding_Space_Visualisation.py", line 38, in
siamese = load_model(model_path)

In my case I changed the cell above the load_model cell to

model_path = '../models/n_seconds/siamese__nseconds_3.0__filters_32__embed_64__drop_0.05__r_0.hdf5'

and downloaded the model file from
https://github.com/oscarknagg/voicemap/tree/master/models/n_seconds

I save the downloaded file to "../models/n_seconds/" and I was able to run that line 38 without a problem. If you haven't tried the above, please try it to see if it works for you.

Further cells down, I am getting an error on the cell with:

Z = [train[i] for i in np.random.randint(0,len(train),size=n_samples)],

train is a class object, so I am still trying to figure out the indexing part.

Thanks,
Andrew

@muthiyanbhushan
Copy link
Author

Hi Andrew,

Thank you for your help.
But, I am still not able to solve the error?


ValueError Traceback (most recent call last)
~/.local/lib/python3.6/site-packages/keras/utils/generic_utils.py in func_load(code, defaults, closure, globs)
232 raw_code = codecs.decode(code.encode('ascii'), 'base64')
--> 233 code = marshal.loads(raw_code)
234 except (UnicodeEncodeError, binascii.Error, ValueError):

ValueError: bad marshal data (unknown type code)

Is it because of my python version?
Thank you.

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

No branches or pull requests

2 participants