Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion _doc/examples/plot_dump_intermediate_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from onnx_diagnostic.helpers.mini_onnx_builder import create_input_tensors_from_onnx_model
from onnx_diagnostic.reference import OnnxruntimeEvaluator, ReportResultComparison


model, inputs, ds = dummy_llm(dynamic_shapes=True)

# %%
Expand Down
1 change: 0 additions & 1 deletion _doc/examples/plot_export_tiny_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
from onnx_diagnostic.torch_models.llms import get_tiny_llm
from onnx_diagnostic.torch_export_patches.patch_inputs import use_dyn_not_str


MODEL_NAME = "arnir0/Tiny-LLM"
tokenizer = transformers.AutoTokenizer.from_pretrained(MODEL_NAME)
model = transformers.AutoModelForCausalLM.from_pretrained(MODEL_NAME)
Expand Down
1 change: 0 additions & 1 deletion _doc/examples/plot_export_tiny_llm_dim01.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
register_additional_serialization_functions,
)


data = get_untrained_model_with_inputs("arnir0/Tiny-LLM", add_second_input=True)
model, dynamic_shapes = data["model"], data["dynamic_shapes"]

Expand Down
1 change: 0 additions & 1 deletion _doc/examples/plot_export_tiny_llm_dim01_onnx.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
register_additional_serialization_functions,
)


data = get_untrained_model_with_inputs("arnir0/Tiny-LLM", add_second_input=True)
model, dynamic_shapes = data["model"], data["dynamic_shapes"]

Expand Down
1 change: 0 additions & 1 deletion _doc/examples/plot_export_tiny_llm_dim01_onnx_custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
)
from experimental_experiment.torch_interpreter import to_onnx, ExportOptions


data = get_untrained_model_with_inputs("arnir0/Tiny-LLM", add_second_input=True)
model, dynamic_shapes = data["model"], data["dynamic_shapes"]

Expand Down
1 change: 0 additions & 1 deletion _doc/examples/plot_export_tiny_llm_method_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from onnx_diagnostic import doc
from onnx_diagnostic.export.api import method_to_onnx


MODEL_NAME = "arnir0/Tiny-LLM"
tokenizer = AutoTokenizer.from_pretrained(MODEL_NAME)
model = AutoModelForCausalLM.from_pretrained(MODEL_NAME)
Expand Down
1 change: 0 additions & 1 deletion _doc/examples/plot_export_tiny_llm_patched.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
from onnx_diagnostic.torch_export_patches.patch_inputs import use_dyn_not_str
from onnx_diagnostic.torch_models.llms import get_tiny_llm


experiment = get_tiny_llm()
untrained_model, inputs, dynamic_shapes = (
experiment["model"],
Expand Down
1 change: 0 additions & 1 deletion _doc/recipes/plot_export_cond.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from onnx_diagnostic import doc
from onnx_diagnostic.torch_export_patches import torch_export_rewrite


# %%
# We define a model with a control flow (-> graph break)

Expand Down
1 change: 0 additions & 1 deletion _doc/technical/plot_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from onnx_diagnostic.tasks import random_input_kwargs
from onnx_diagnostic.export.api import to_onnx


device = "cuda" if torch.cuda.is_available() else "cpu"
data = []

Expand Down
16 changes: 4 additions & 12 deletions _unittests/ut_helpers/test_dot_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ def test_custom_doc_kernels_layer_normalization(self):
opset_imports=[oh.make_opsetid("", 18)],
)
dot = to_dot(model)
expected = textwrap.dedent(
"""
expected = textwrap.dedent("""
digraph {
graph [rankdir=TB, splines=true, overlap=false, nodesep=0.2, ranksep=0.2, fontsize=8];
node [style="rounded,filled", color="#888888", fontcolor="#222222", shape=box];
Expand All @@ -57,8 +56,7 @@ def test_custom_doc_kernels_layer_normalization(self):
O_5 [label="Z\\nFLOAT16(b,c,d)", fillcolor="#aaaaee"];
Add_4 -> O_5;
}
"""
)
""")
self.maxDiff = None
self.assertEqual(expected.strip("\n "), dot.strip("\n "))

Expand Down Expand Up @@ -90,9 +88,7 @@ def test_custom_doc_kernels_layer_normalization_constant(self):
opset_imports=[oh.make_opsetid("", 18)],
)
dot = to_dot(model)
expected = (
textwrap.dedent(
"""
expected = textwrap.dedent("""
digraph {
graph [rankdir=TB, splines=true, overlap=false, nodesep=0.2, ranksep=0.2, fontsize=8];
node [style="rounded,filled", color="#888888", fontcolor="#222222", shape=box];
Expand All @@ -111,11 +107,7 @@ def test_custom_doc_kernels_layer_normalization_constant(self):
O_6 [label="Z\\nFLOAT16(b,c,d)", fillcolor="#aaaaee"];
Add_5 -> O_6;
}
"""
)
.strip("\n")
.replace(" ", "")
)
""").strip("\n").replace(" ", "")
self.maxDiff = None
self.assertEqual(expected, dot.strip("\n").replace(" ", ""))

Expand Down
1 change: 0 additions & 1 deletion _unittests/ut_helpers/test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
)
from onnx_diagnostic.torch_models.hghub.hub_api import get_pretrained_config


TFLOAT = onnx.TensorProto.FLOAT


Expand Down
10 changes: 2 additions & 8 deletions _unittests/ut_helpers/test_log_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,13 @@
class TestLogHelper(ExtTestCase):
@classmethod
def df1(cls):
return pandas.read_csv(
io.StringIO(
textwrap.dedent(
"""
return pandas.read_csv(io.StringIO(textwrap.dedent("""
date,version_python,version_transformers,model_name,model_exporter,time_load,time_latency,time_baseline,disc_ort,disc_ort2
2025/01/01,3.13.3,4.52.4,phi3,export,0.51,0.1,0.1,1e-5,1e-5
2025/01/02,3.13.3,4.52.4,phi3,export,0.62,0.11,0.11,1e-5,1e-5
2025/01/01,3.13.3,4.52.4,phi4,export,0.53,0.1,0.105,1e-5,1e-5
2025/01/01,3.12.3,4.52.4,phi4,onnx-dynamo,0.54,0.14,0.999,1e-5,1e-5
"""
)
)
)
""")))

@classmethod
def cube1(cls, verbose=0):
Expand Down
1 change: 0 additions & 1 deletion _unittests/ut_helpers/test_onnx_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
_enumerate_model_node_outputs,
)


TFLOAT = TensorProto.FLOAT
TINT64 = TensorProto.INT64

Expand Down
1 change: 0 additions & 1 deletion _unittests/ut_reference/test_torch_onnx_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from onnx_diagnostic.reference.torch_ops import OpRunKernel, OpRunTensor
from onnx_diagnostic.reference.torch_evaluator import get_kernels


TFLOAT = onnx.TensorProto.FLOAT
TFLOAT16 = onnx.TensorProto.FLOAT16
TINT64 = onnx.TensorProto.INT64
Expand Down
6 changes: 2 additions & 4 deletions _unittests/ut_torch_export_patches/test_patch_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,12 +508,10 @@ def test_shape_finder(self):
self.assertEqual({"x"}, sh.found_shape)

def test__find_loop_vars(self):
code = textwrap.dedent(
"""
code = textwrap.dedent("""
for i in range(x.shape[0]):
z[i, :] = ((x[i : i + 1, :] - y) ** 2).sum(dim=-1)
"""
)
""")
node = ast.parse(code)
tr = RewriteControlFlow()
vars = tr._find_loop_vars(node.body[0])
Expand Down
1 change: 0 additions & 1 deletion _unittests/ut_xrun_doc/test_documentation_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
ignore_errors,
)


VERBOSE = 0
ROOT = os.path.realpath(os.path.abspath(os.path.join(onnx_diagnostic_file, "..", "..")))

Expand Down
1 change: 0 additions & 1 deletion _unittests/ut_xrun_doc/test_documentation_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
ignore_errors,
)


VERBOSE = 0
ROOT = os.path.realpath(os.path.abspath(os.path.join(onnx_diagnostic_file, "..", "..")))

Expand Down
1 change: 0 additions & 1 deletion _unittests/ut_xrun_doc/test_documentation_technical.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
has_transformers,
)


VERBOSE = 0
ROOT = os.path.realpath(os.path.abspath(os.path.join(onnx_diagnostic_file, "..", "..")))

Expand Down
Loading
Loading