-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
Fix TorchModuleWrapper serialization issue #20869
base: master
Are you sure you want to change the base?
Fix TorchModuleWrapper serialization issue #20869
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #20869 +/- ##
==========================================
- Coverage 82.24% 76.74% -5.50%
==========================================
Files 561 561
Lines 52633 52640 +7
Branches 8137 8139 +2
==========================================
- Hits 43288 40400 -2888
- Misses 7340 10282 +2942
+ Partials 2005 1958 -47
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
It seems like you are trying to replace utf-8 with latin-1. I think that it would not fix the issue as both encodings are meant for text rather than arbitrary data. I wonder, what could have been the reason for using utf-8 to begin with? |
Thanks for the PR. I think this issue calls for a different fix -- what's the best way to serialize bytes (to go in a JSON file) in the general case? Most online solutions seem to recommend utf-8, but clearly this isn't fully general. |
Is it possible that we need to first use something like |
That sounds like something we can try. If we do that, we should introduce a new kind of object (not |
Currently model with
TorchModuleWrapper
fails to save with the following error.UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 64: invalid start byte
I have tried with different encoding as experimental and found '
latin-1
' works fine for saving and reloading along with some code changes toTorchModuleWrapper
class. Atleast this change worked for the minimal code snippet as mentioned in #20860May fixes #20860