Skip to content

Commit c310006

Browse files
justinchubypytorchmergebot
authored andcommitted
[ONNX] Update onnx to 1.18 (pytorch#153746)
Update onnx python package to 1.18. Pull Request resolved: pytorch#153746 Approved by: https://github.com/titaiwangms, https://github.com/cyyever, https://github.com/malfet
1 parent 43b2716 commit c310006

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

.ci/docker/common/install_onnx.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ pip_install \
3131
pip_install coloredlogs packaging
3232

3333
pip_install onnxruntime==1.18.1
34-
pip_install onnx==1.17.0
35-
pip_install onnxscript==0.2.2 --no-deps
34+
pip_install onnxscript==0.2.6 --no-deps
3635
# required by onnxscript
3736
pip_install ml_dtypes
3837

.ci/docker/requirements-ci.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ pillow==11.0.0
169169
protobuf==5.29.4
170170
#Description: Google's data interchange format
171171
#Pinned versions: 5.29.4
172-
#test that import: test_tensorboard.py
172+
#test that import: test_tensorboard.py, test/onnx/*
173173

174174
psutil
175175
#Description: information on running processes and system utilization
@@ -337,12 +337,12 @@ sympy==1.13.3
337337
#Pinned versions:
338338
#test that import:
339339

340-
onnx==1.17.0
341-
#Description: Required by mypy and test_public_bindings.py when checking torch.onnx._internal
340+
onnx==1.18.0
341+
#Description: Required by onnx tests, and mypy and test_public_bindings.py when checking torch.onnx._internal
342342
#Pinned versions:
343343
#test that import:
344344

345-
onnxscript==0.2.2
345+
onnxscript==0.2.6
346346
#Description: Required by mypy and test_public_bindings.py when checking torch.onnx._internal
347347
#Pinned versions:
348348
#test that import:

test/onnx/exporter/test_small_models_e2e.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ class Float4Module(torch.nn.Module):
224224
def forward(self):
225225
return torch.empty([1], dtype=torch.float4_e2m1fn_x2)
226226

227-
onnx_program = self.export(Float4Module())
227+
onnx_program = self.export(Float4Module(), optimize=False)
228228
output = onnx_program.model.graph.outputs[0]
229229
self.assertEqual(output.dtype, ir.DataType.FLOAT4E2M1)
230230
# The shape is [*shape, 2] because ONNX stores the shape of the unpacked tensor

torch/onnx/_internal/exporter/_onnx_program.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def _set_graph_outputs(
8181
graph: The graph to set the outputs for.
8282
outputs: The outputs to set.
8383
"""
84-
original_outputs = graph.outputs.copy()
84+
original_outputs = list(graph.outputs)
8585
graph.outputs.clear()
8686
graph.outputs.extend(outputs)
8787
try:
@@ -102,7 +102,7 @@ def _create_value_mapping(graph: ir.Graph) -> dict[str, ir.Value]:
102102
Returns:
103103
A dictionary mapping names to values.
104104
"""
105-
values = {}
105+
values: dict[str, ir.Value] = {}
106106
values.update(graph.initializers)
107107
# The names of the values can be None or "", which we need to exclude
108108
for input in graph.inputs:

torch/onnx/_internal/exporter/_verification.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def _create_value_mapping(graph: ir.Graph) -> dict[str, ir.Value]:
224224
Returns:
225225
A dictionary mapping names to values.
226226
"""
227-
values = {}
227+
values: dict[str, ir.Value] = {}
228228
values.update(graph.initializers)
229229
# The names of the values can be None or "", which we need to exclude
230230
for input in graph.inputs:
@@ -322,6 +322,7 @@ def run_node(self, n: torch.fx.Node) -> Any:
322322
"Failed to compute value for node %s: %s",
323323
node_name,
324324
e,
325+
exc_info=True,
325326
)
326327
return result
327328
info = VerificationInfo.from_tensors(

0 commit comments

Comments
 (0)