-
Notifications
You must be signed in to change notification settings - Fork 40
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
UnicodeDecodeError: 'rawunicodeescape' codec can't decode bytes #17
Comments
This is a Keras issue, see keras-team/keras#2582. Unfortunately, it seems like the only real solution is to fix this in Keras and make a pull request to the Keras repository (see: keras-team/keras#6628). Another possibility would be to use Python 2. |
Are there other alternatives to save the weights? for example, using model.save_weights? pickle? |
By making one change to generic_utils.py as suggested in one of your articles links, I managed to save the model, thanks a lot. |
Will the issue be fixed in the repository? I still get it! |
The following pull request fixes the issue: keras-team/keras#6628 (review) |
It is RESOLVED for me by replacing this line In this file: keras\utils\generic_utils.py" ; |
I encountered the above error. I have done some research and found the following:
"Typical error on Windows because the default user directory is C:\user<your_user>, so when you want to use this path as an string parameter into a Python function, you get a Unicode error, just because the \u is a Unicode escape. Any character not numeric after this produces an error.To solve it, just double the backslashes: C:\\user\<\your_user>..."
I checked the codes it is because of the lambda function in the generated model and the system tries to do a func_dump of modelgen.py in my c:\users\anaconda3\lib\site-packages\mcfly directory.
Any suggestion how to get around it?
Here is the detail trace:
File "C:\Users\pactera\Anaconda3\lib\site-packages\mcfly\storage.py", line 33, in savemodel
json_string = model.to_json() # save architecture to json string
File "C:\Users\pactera\Anaconda3\lib\site-packages\keras\engine\topology.py", line 2541, in to_json
model_config = self._updated_config()
File "C:\Users\pactera\Anaconda3\lib\site-packages\keras\engine\topology.py", line 2508, in _updated_config
config = self.get_config()
File "C:\Users\pactera\Anaconda3\lib\site-packages\keras\models.py", line 1179, in get_config
'config': layer.get_config()})
File "C:\Users\pactera\Anaconda3\lib\site-packages\keras\layers\core.py", line 668, in get_config
function = func_dump(self.function)
File "C:\Users\pactera\Anaconda3\lib\site-packages\keras\utils\generic_utils.py", line 177, in func_dump
code = marshal.dumps(func.code).decode('raw_unicode_escape')
UnicodeDecodeError: 'rawunicodeescape' codec can't decode bytes in position 82-83: truncated \UXXXXXXXX escape
The text was updated successfully, but these errors were encountered: