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
Save Model: TypeError: ('Not JSON Serializable:', Dimension(2048)) #9342
Comments
Tried with tensorflow_ver = 1.5.0, python_ver = 3.5.0 and it gives the same error.
|
Okay, so the transfer_len variable was a type 'tensorflow.python.framework.tensor_shape.Dimension'. |
Hello! I was able to fix this by changing This is the function that's called from the Looks like the original function essentially if/else's the classes to find a JSON-friendly representation and raises a The following lines makes it happy, but I'm sure there's a much better, more principled fix. Anyone know what the best place to put code like this would be? I am more than happy to take a stab at it, just wondering where it would be at.
|
Since Dimension object can be None like 'Dimension(None)'.A better fix can be:
|
I still need to add the hacks suggested by @Clck @ArchieMeng . Why isn't this issue fixed? |
@Clck @ArchieMeng definitely works. it seems get_json_type() is in The question is how to make |
Possibly related: #12473 |
I am having the same problem. I have added the code lines in Keras as suggested by you. It returns the same error. |
Well. I just went back to keras with Deep learning recently, and I used the model.save method as well. However, it doesn't raise the same error as I got many years ago, and it works pretty well. |
I made a stackoverflow question about this because it seems people had similar problem in the past https://stackoverflow.com/questions/48691449/typeerror-not-json-serializable-dimension2048.
When I try to save this particular model it gives TypeError: ('Not JSON Serializable:', Dimension(2048)).
I can save other models without a problem and I don't understand why this one doesn't work.
I tried to save it on Windows 10 with python_ver = 3.6, tensorflow_ver = 1.6-rc0 and Ubuntu 16.04 with python_ver = 3.6, tensorflow_ver = 1.3.
I created a model and trained it using code below.
When I try to save it it gives following error.
The text was updated successfully, but these errors were encountered: