Skip to content

Commit

Permalink
make flag dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
shubhambhokare1 committed Nov 21, 2024
1 parent 2b1979e commit c38c2cb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions onnxscript/_framework_apis/torch_2_5.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
from onnxscript.function_libs.torch_lib import registration
from onnxscript.ir import _external_data

ENABLE_VERSION_CONVERTER = 0


@dataclasses.dataclass(frozen=True)
class _OnnxFunctionMeta:
Expand Down Expand Up @@ -53,7 +51,9 @@ def optimize(model: ir.Model) -> ir.Model:

def convert_version(model: ir.Model, target_version: int) -> ir.Model:
"""Convert the model to the specified ONNX opset version."""
if ENABLE_VERSION_CONVERTER == 1:
# Internal flag. Will go away.
enabled = os.getenv("TORCH_ONNX_ENABLE_VERSION_CONVERSION") == "1"
if enabled:
version_converter.convert_version(model, target_version)

Check warning on line 57 in onnxscript/_framework_apis/torch_2_5.py

View check run for this annotation

Codecov / codecov/patch

onnxscript/_framework_apis/torch_2_5.py#L57

Added line #L57 was not covered by tests
return model

Expand Down

0 comments on commit c38c2cb

Please sign in to comment.