diff --git a/onnxscript/backend/onnx_export.py b/onnxscript/backend/onnx_export.py index 94e673be6..87e2c01ab 100644 --- a/onnxscript/backend/onnx_export.py +++ b/onnxscript/backend/onnx_export.py @@ -152,7 +152,10 @@ def _translate_value_info(value_info: ValueInfoProto) -> str: def _to_str(s): if isinstance(s, bytes): - return s.decode("utf-8") + try: + return s.decode("utf-8") + except UnicodeDecodeError: + return s.decode("latin1") # or "cp1252" or other fallback return s