File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
modelopt/torch/_deploy/utils Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 2121import os
2222import shutil
2323import tempfile
24- from contextlib import nullcontext
24+ from contextlib import nullcontext , suppress
2525from typing import Any
2626
2727import onnx
28+ import onnxconverter_common .float16 as _f16_module
2829import torch
2930import torch .nn as nn
3031from onnx import ModelProto
5859
5960from ..utils .onnx_optimizer import Optimizer
6061
62+ # Monkey-patch to fix onnxconverter_common bug where downstream_node is a list
63+ _original_remove_unnecessary_cast_node = _f16_module .remove_unnecessary_cast_node
64+
65+
66+ def _patched_remove_unnecessary_cast_node (graph ):
67+ with suppress (AttributeError ):
68+ _original_remove_unnecessary_cast_node (graph )
69+
70+
71+ _f16_module .remove_unnecessary_cast_node = _patched_remove_unnecessary_cast_node
72+
6173ModelMetadata = dict [str , Any ]
6274ModelType = Any
6375ValueInfoType = Any
You can’t perform that action at this time.
0 commit comments