File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1149,7 +1149,7 @@ def _deserialize_attribute(
1149
1149
# Even though onnx.ai/onnx/repo-docs/IR.html#attributes requires the attribute
1150
1150
# for strings to be utf-8 encoded bytes, custom ops may still store arbitrary data there
1151
1151
logger .warning (
1152
- "Attribute '%s' contains invalid UTF-8 bytes. ONNX spec requires string attributes "
1152
+ "Attribute %r contains invalid UTF-8 bytes. ONNX spec requires string attributes "
1153
1153
"to be UTF-8 encoded so the model is invalid. We will skip decoding the attribute and "
1154
1154
"use the bytes as attribute value" ,
1155
1155
name ,
@@ -1807,6 +1807,12 @@ def _fill_in_value_for_attribute(
1807
1807
if type (value ) is bytes :
1808
1808
# Even though onnx.ai/onnx/repo-docs/IR.html#attributes requires the attribute
1809
1809
# for strings to be utf-8 encoded bytes, custom ops may still store arbitrary data there
1810
+ logger .warning (
1811
+ "Value in attribute %r should be a string but is instead bytes. ONNX "
1812
+ "spec requires string attributes to be UTF-8 encoded so the model is invalid. "
1813
+ "We will skip encoding the attribute and use the bytes as attribute value" ,
1814
+ attribute_proto .name ,
1815
+ )
1810
1816
attribute_proto .s = value
1811
1817
else :
1812
1818
attribute_proto .s = value .encode ("utf-8" )
You can’t perform that action at this time.
0 commit comments