Skip to content

Conversation

@justinchuby
Copy link
Collaborator

@justinchuby justinchuby commented Oct 14, 2024

Remove rsub since it is handled by decomp, and torch doesn't have a type promotion rule for rsub so we use sub instead.

Tested with

import torch


class Model(torch.nn.Module):
    def forward(self, x):
        return 1 - x


ep = torch.export.export(Model(), (torch.tensor(1),))
print(ep)

program = torch.onnx.export(Model(), (torch.tensor(1),), dynamo=True)
print(program)

@codecov
Copy link

codecov bot commented Oct 14, 2024

❌ 38 Tests Failed:

Tests completed Failed Passed Skipped
12379 38 12341 1195
View the top 3 failed tests by shortest run time
tests.ir.serde_roundtrip_test.SerdeTest test_serialization_deserialization_produces_same_model_0141_test_cast_FLOAT4E2M1_to_FLOAT16_model_onnx
Stack Traces | 0.001s run time
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:711: in deserialize_type_proto_for_type
    return _core.TensorType(_enums.DataType(elem_type), denotation=denotation)
.../hostedtoolcache/Python/3.11.10....../x64/lib/python3.11/enum.py:714: in __call__
    return cls.__new__(cls, value)
.../hostedtoolcache/Python/3.11.10....../x64/lib/python3.11/enum.py:1137: in __new__
    raise ve_exc
E   ValueError: 23 is not a valid DataType

The above exception was the direct cause of the following exception:
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:657: in deserialize_value_info_proto
    value.type = deserialize_type_proto_for_type(proto.type)
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling deserialize_type_proto_for_type with: tensor_type {
E     elem_type: 23
E     shape {
E       dim {
E         dim_value: 3
E       }
E       dim {
E         dim_value: 5
E       }
E     }
E   }

The above exception was the direct cause of the following exception:
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:568: in _deserialize_graph
    deserialize_value_info_proto(info, value)
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling deserialize_value_info_proto with: name: "input"
E   type {
E     tensor_type {
E       elem_type: 23
E       shape {
E         dim {
E           dim_value: 3
E         }
E         dim {
E           dim_value: 5
E         }
E       }
E     }
E   }

The above exception was the direct cause of the following exception:
..../test_torch_nightly/lib/python3.11.../site-packages/parameterized/parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
tests/ir/serde_roundtrip_test.py:38: in test_serialization_deserialization_produces_same_model
    ir_model = ir.serde.deserialize_model(model)
onnxscript/ir/serde.py:459: in deserialize_model
    graph = _deserialize_graph(proto.graph, [])
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling _deserialize_graph with: main_graph
tests.ir.serde_roundtrip_test.SerdeTest test_serialization_deserialization_produces_same_model_0571_test_cast_FLOAT4E2M1_to_FLOAT_model_onnx
Stack Traces | 0.001s run time
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:711: in deserialize_type_proto_for_type
    return _core.TensorType(_enums.DataType(elem_type), denotation=denotation)
.../hostedtoolcache/Python/3.11.10....../x64/lib/python3.11/enum.py:714: in __call__
    return cls.__new__(cls, value)
.../hostedtoolcache/Python/3.11.10....../x64/lib/python3.11/enum.py:1137: in __new__
    raise ve_exc
E   ValueError: 23 is not a valid DataType

The above exception was the direct cause of the following exception:
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:657: in deserialize_value_info_proto
    value.type = deserialize_type_proto_for_type(proto.type)
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling deserialize_type_proto_for_type with: tensor_type {
E     elem_type: 23
E     shape {
E       dim {
E         dim_value: 3
E       }
E       dim {
E         dim_value: 5
E       }
E     }
E   }

The above exception was the direct cause of the following exception:
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:568: in _deserialize_graph
    deserialize_value_info_proto(info, value)
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling deserialize_value_info_proto with: name: "input"
E   type {
E     tensor_type {
E       elem_type: 23
E       shape {
E         dim {
E           dim_value: 3
E         }
E         dim {
E           dim_value: 5
E         }
E       }
E     }
E   }

The above exception was the direct cause of the following exception:
..../test_torch_nightly/lib/python3.11.../site-packages/parameterized/parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
tests/ir/serde_roundtrip_test.py:38: in test_serialization_deserialization_produces_same_model
    ir_model = ir.serde.deserialize_model(model)
onnxscript/ir/serde.py:459: in deserialize_model
    graph = _deserialize_graph(proto.graph, [])
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling _deserialize_graph with: main_graph
tests.ir.serde_roundtrip_test.SerdeTest test_serialization_deserialization_produces_same_model_1102_test_dequantizelinear_float4e2m1_model_onnx
Stack Traces | 0.002s run time
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:711: in deserialize_type_proto_for_type
    return _core.TensorType(_enums.DataType(elem_type), denotation=denotation)
.../hostedtoolcache/Python/3.12.7....../x64/lib/python3.12/enum.py:757: in __call__
    return cls.__new__(cls, value)
.../hostedtoolcache/Python/3.12.7....../x64/lib/python3.12/enum.py:1171: in __new__
    raise ve_exc
E   ValueError: 23 is not a valid DataType

The above exception was the direct cause of the following exception:
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:657: in deserialize_value_info_proto
    value.type = deserialize_type_proto_for_type(proto.type)
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling deserialize_type_proto_for_type with: tensor_type {
E     elem_type: 23
E     shape {
E       dim {
E         dim_value: 5
E       }
E     }
E   }

The above exception was the direct cause of the following exception:
onnxscript/ir/serde.py:97: in wrapper
    return func(*args, **kwargs)
onnxscript/ir/serde.py:568: in _deserialize_graph
    deserialize_value_info_proto(info, value)
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling deserialize_value_info_proto with: name: "x"
E   type {
E     tensor_type {
E       elem_type: 23
E       shape {
E         dim {
E           dim_value: 5
E         }
E       }
E     }
E   }

The above exception was the direct cause of the following exception:
..../test_torch_nightly/lib/python3.12.../site-packages/parameterized/parameterized.py:620: in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
tests/ir/serde_roundtrip_test.py:38: in test_serialization_deserialization_produces_same_model
    ir_model = ir.serde.deserialize_model(model)
onnxscript/ir/serde.py:459: in deserialize_model
    graph = _deserialize_graph(proto.graph, [])
onnxscript/ir/serde.py:99: in wrapper
    raise SerdeError(
E   onnxscript.ir.serde.SerdeError: Error calling _deserialize_graph with: main_graph

To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard

@justinchuby justinchuby added the module: torchlib Related to the torch/aten function lib in development label Oct 14, 2024
@justinchuby justinchuby enabled auto-merge (squash) October 15, 2024 00:04
@justinchuby justinchuby merged commit 1544ee1 into main Oct 15, 2024
26 of 41 checks passed
@justinchuby justinchuby deleted the justinchu/rsub branch October 15, 2024 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: torchlib Related to the torch/aten function lib in development

Projects

Development

Successfully merging this pull request may close these issues.

3 participants