-
Notifications
You must be signed in to change notification settings - Fork 97
Fix unicode issue #2747
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
base: main
Are you sure you want to change the base?
Fix unicode issue #2747
Conversation
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2747 +/- ##
==========================================
- Coverage 70.10% 70.09% -0.01%
==========================================
Files 228 228
Lines 27394 27385 -9
Branches 2781 2783 +2
==========================================
- Hits 19204 19195 -9
+ Misses 7234 7231 -3
- Partials 956 959 +3 ☔ View full report in Codecov by Sentry. |
onnxscript/backend/onnx_export.py
Outdated
| try: | ||
| return s.decode("utf-8") | ||
| except UnicodeDecodeError: | ||
| return s.decode("latin1") # or "cp1252" or other fallback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have seen cases where the string attributes iare used to store binary data (e.g. in the custom Tokenizer op, even though this is invalid onnx). Is this trying to address those cases? If so, I would simply preserve the b-string to avoid accidental modifications.
Related: onnx/ir-py#184
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know. All I know is that this enabled me to convert a recent model (Word Fluency) into onnxscript so that I could see the control-flow structure of the model in a compact readable format. I don't mind alternatives if they allow me to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right - that's the same model I looked at. Making a suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you try the current change?
Updated string decoding logic and attribute value check.
This copilot-suggested fix enabled converting a recent onnx model to onnxscript.