Export with dynamic dimensions in {0,1} into ONNX

This duplicates the example Export with dynamic dimensions in {0,1} but for torch.onnx.export(). It checks what inputs can be used to export and with which inputs it can work.

Available input sets

import itertools
from tqdm import tqdm
import numpy as np
import pandas
import torch
import onnxruntime
from onnx_diagnostic import doc
from onnx_diagnostic.helpers import max_diff, string_type, flatten_object
from onnx_diagnostic.helpers.torch_helper import torch_deepcopy
from onnx_diagnostic.helpers.rt_helper import make_feeds
from onnx_diagnostic.torch_models.hghub.model_inputs import get_untrained_model_with_inputs
from onnx_diagnostic.torch_export_patches.patch_inputs import use_dyn_not_str
from onnx_diagnostic.torch_export_patches import (
    torch_export_patches,
    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"]

The trained model can be obtained with:

MODEL_NAME = "arnir0/Tiny-LLM"
tokenizer = transformers.AutoTokenizer.from_pretrained(MODEL_NAME)
model = transformers.AutoModelForCausalLM.from_pretrained(MODEL_NAME)
input_sets = {k: v for k, v in data.items() if k.startswith("inputs")}

for k, v in input_sets.items():
    print(f"{k:20}: {string_type(v, with_shape=True)}")
inputs              : dict(input_ids:T7s2x3,attention_mask:T7s2x33,position_ids:T7s2x3,past_key_values:DynamicCache(key_cache=#1[T1s2x1x30x96], value_cache=#1[T1s2x1x30x96]))
inputs_prompt       : dict(input_ids:T7s1x11)
inputs2             : dict(input_ids:T7s3x4,attention_mask:T7s3x35,position_ids:T7s3x4,past_key_values:DynamicCache(key_cache=#1[T1s3x1x31x96], value_cache=#1[T1s3x1x31x96]))
inputs_empty_cache  : dict(input_ids:T7s2x3,attention_mask:T7s2x3,position_ids:T7s2x3,past_key_values:DynamicCache(key_cache=#1[T1s2x1x0x96], value_cache=#1[T1s2x1x0x96]))
inputs_batch1       : dict(input_ids:T7s1x3,attention_mask:T7s1x33,position_ids:T7s1x3,past_key_values:DynamicCache(key_cache=#1[T1s1x1x30x96], value_cache=#1[T1s1x1x30x96]))

The dynamic shapes are:

print(f"dynamic_shapes: {string_type(dynamic_shapes)}")
dynamic_shapes: dict(input_ids:{0:DYN(batch),1:DYN(seq_length)},attention_mask:{0:DYN(batch),1:DYN(cache+seq)},position_ids:{0:DYN(batch),1:DYN(seq_length)},past_key_values:#2[{0:DYN(batch),2:DYN(cache_length)},{0:DYN(batch),2:DYN(cache_length)}])

Let’s check they all work and compute the expected values. We use deepcopy because caches are usually modified inplace.

expected = {}
for k, v in input_sets.items():
    expected[k] = model(**torch_deepcopy(v))
    print(f"{k:20}: {string_type(expected[k], with_shape=True)}")
inputs              : CausalLMOutputWithPast(logits:T1s2x3x32000,past_key_values:DynamicCache(key_cache=#1[T1s2x1x33x96], value_cache=#1[T1s2x1x33x96]))
inputs_prompt       : CausalLMOutputWithPast(logits:T1s1x11x32000,past_key_values:DynamicCache(key_cache=#1[T1s1x1x11x96], value_cache=#1[T1s1x1x11x96]))
inputs2             : CausalLMOutputWithPast(logits:T1s3x4x32000,past_key_values:DynamicCache(key_cache=#1[T1s3x1x35x96], value_cache=#1[T1s3x1x35x96]))
inputs_empty_cache  : CausalLMOutputWithPast(logits:T1s2x3x32000,past_key_values:DynamicCache(key_cache=#1[T1s2x1x3x96], value_cache=#1[T1s2x1x3x96]))
inputs_batch1       : CausalLMOutputWithPast(logits:T1s1x3x32000,past_key_values:DynamicCache(key_cache=#1[T1s1x1x33x96], value_cache=#1[T1s1x1x33x96]))

Export with options

We try to export with the following options:

Some function first.

def export_model(
    model, dynamic_shapes, inputs, cache=False, oblivious=False, rt=False, cache_patch=False
):
    if cache and not cache_patch:
        with register_additional_serialization_functions(patch_transformers=True):
            return export_model(model, dynamic_shapes, inputs, oblivious=oblivious, rt=rt)
    if cache_patch:
        with torch_export_patches(
            patch_torch=cache_patch in ("all", "torch", True, 1),
            patch_transformers=cache_patch in ("all", "transformers", True, 1),
        ):
            return export_model(model, dynamic_shapes, inputs, oblivious=oblivious, rt=rt)
    if oblivious:
        with torch.fx.experimental._config.patch(backed_size_oblivious=True):
            return export_model(model, dynamic_shapes, inputs, rt=rt)
    ep = torch.export.export(
        model,
        (),
        inputs,
        dynamic_shapes=use_dyn_not_str(dynamic_shapes),
        prefer_deferred_runtime_asserts_over_guards=rt,
    )
    return torch.onnx.export(ep, args=(), kwargs=inputs, dynamic_shapes=dynamic_shapes)


def try_export_model(
    model, dynamic_shapes, inputs, cache=False, oblivious=False, rt=False, cache_patch=False
):
    try:
        return export_model(
            model,
            dynamic_shapes,
            inputs,
            cache=cache,
            oblivious=oblivious,
            rt=rt,
            cache_patch=cache_patch,
        )
    except Exception as e:
        return e


def validation(ep, input_sets, expected, catch_exception=True):
    sess = onnxruntime.InferenceSession(
        ep.model_proto.SerializeToString(), providers=["CPUExecutionProvider"]
    )
    for k, v in input_sets.items():
        try:
            feeds = make_feeds(sess, torch_deepcopy(v), use_numpy=True)
        except Exception as e:
            if not catch_exception:
                raise
            yield k, e
            continue
        try:
            got = sess.run(None, feeds)
        except Exception as e:
            if not catch_exception:
                raise
            yield k, e
            continue
        yield k, max_diff(flatten_object(expected[k], drop_keys=True), got)

Verification an example known to be working is.

ep = export_model(
    model,
    dynamic_shapes,
    torch_deepcopy(input_sets["inputs"]),
    cache_patch=True,
)
res = list(validation(ep, dict(inputs=input_sets["inputs"]), expected, catch_exception=False))
assert res[0][1]["abs"] < 1e-5, f"Unexpected issue with res={res}"
[torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

The main loop

results = []

possibilities = [*[[0, 1] for _ in range(4)], list(input_sets)]
possibilities[1] = [0, "all", "torch", "transformers"]
with tqdm(list(itertools.product(*possibilities))) as pbar:
    for cache, cache_patch, oblivious, rt, inputs in pbar:
        if cache_patch and not cache:
            # patches include caches.
            continue
        kwargs = dict(cache=cache, cache_patch=cache_patch, oblivious=oblivious, rt=rt)
        legend = "-".join(
            (k if isinstance(v, int) else f"{k}:{v}") for k, v in kwargs.items() if v
        )
        legend = f"{legend}/{inputs}"
        pbar.set_description(f"{legend} EXPORT")

        # export
        ep = try_export_model(
            model, dynamic_shapes, torch_deepcopy(input_sets[inputs]), **kwargs
        )
        if isinstance(ep, Exception):
            obs = {
                **kwargs,
                "export_with": inputs,
                "EXPORT": 0,
                "ERR-EXPORT": str(ep).split("\n")[0],
            }
            results.append(obs)
            continue

        pbar.set_description(f"{legend} VALIDATE")
        common = {**kwargs, "export_with": inputs, "EXPORT": 1}
        for inp, res in validation(ep, input_sets, expected):
            if isinstance(res, Exception):
                obs = {
                    **common,
                    "run_with": inp,
                    "ERR-RUN": str(res).split("\n")[0],
                    "WORKS": 0,
                }
            else:
                obs = {
                    **common,
                    "run_with": inp,
                    "WORKS": int(~np.isnan(res["abs"]) and res["abs"] < 1e-3),
                }
            results.append(obs)
  0%|          | 0/160 [00:00<?, ?it/s]
/inputs EXPORT:   0%|          | 0/160 [00:00<?, ?it/s][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

/inputs EXPORT:   1%|          | 1/160 [00:02<07:29,  2.83s/it]
/inputs_prompt EXPORT:   1%|          | 1/160 [00:02<07:29,  2.83s/it]
/inputs2 EXPORT:   1%|          | 1/160 [00:02<07:29,  2.83s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

/inputs2 EXPORT:   2%|▏         | 3/160 [00:05<04:17,  1.64s/it]
/inputs_empty_cache EXPORT:   2%|▏         | 3/160 [00:05<04:17,  1.64s/it]
/inputs_empty_cache EXPORT:   2%|▎         | 4/160 [00:06<03:26,  1.32s/it]
/inputs_batch1 EXPORT:   2%|▎         | 4/160 [00:06<03:26,  1.32s/it]
/inputs_batch1 EXPORT:   3%|▎         | 5/160 [00:06<02:49,  1.09s/it]
rt/inputs EXPORT:   3%|▎         | 5/160 [00:06<02:49,  1.09s/it]     [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

rt/inputs EXPORT:   4%|▍         | 6/160 [00:09<04:16,  1.66s/it]
rt/inputs_prompt EXPORT:   4%|▍         | 6/160 [00:09<04:16,  1.66s/it]
rt/inputs2 EXPORT:   4%|▍         | 6/160 [00:09<04:16,  1.66s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

rt/inputs2 EXPORT:   5%|▌         | 8/160 [00:12<03:55,  1.55s/it]
rt/inputs_empty_cache EXPORT:   5%|▌         | 8/160 [00:12<03:55,  1.55s/it]
rt/inputs_empty_cache EXPORT:   6%|▌         | 9/160 [00:13<03:27,  1.37s/it]
rt/inputs_batch1 EXPORT:   6%|▌         | 9/160 [00:13<03:27,  1.37s/it]
rt/inputs_batch1 EXPORT:   6%|▋         | 10/160 [00:13<02:55,  1.17s/it]
oblivious/inputs EXPORT:   6%|▋         | 10/160 [00:13<02:55,  1.17s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

oblivious/inputs EXPORT:   7%|▋         | 11/160 [00:16<03:51,  1.55s/it]
oblivious/inputs_prompt EXPORT:   7%|▋         | 11/160 [00:16<03:51,  1.55s/it]
oblivious/inputs2 EXPORT:   7%|▋         | 11/160 [00:16<03:51,  1.55s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

oblivious/inputs2 EXPORT:   8%|▊         | 13/160 [00:19<03:43,  1.52s/it]
oblivious/inputs_empty_cache EXPORT:   8%|▊         | 13/160 [00:19<03:43,  1.52s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

oblivious/inputs_empty_cache EXPORT:   9%|▉         | 14/160 [00:21<04:18,  1.77s/it]
oblivious/inputs_batch1 EXPORT:   9%|▉         | 14/160 [00:21<04:18,  1.77s/it]     [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

oblivious/inputs_batch1 EXPORT:   9%|▉         | 15/160 [00:25<05:22,  2.22s/it]
oblivious-rt/inputs EXPORT:   9%|▉         | 15/160 [00:25<05:22,  2.22s/it]    [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

oblivious-rt/inputs EXPORT:  10%|█         | 16/160 [00:28<05:46,  2.41s/it]
oblivious-rt/inputs_prompt EXPORT:  10%|█         | 16/160 [00:28<05:46,  2.41s/it]
oblivious-rt/inputs2 EXPORT:  10%|█         | 16/160 [00:28<05:46,  2.41s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

oblivious-rt/inputs2 EXPORT:  11%|█▏        | 18/160 [00:31<04:52,  2.06s/it]
oblivious-rt/inputs_empty_cache EXPORT:  11%|█▏        | 18/160 [00:31<04:52,  2.06s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

oblivious-rt/inputs_empty_cache EXPORT:  12%|█▏        | 19/160 [00:34<05:12,  2.21s/it]
oblivious-rt/inputs_batch1 EXPORT:  12%|█▏        | 19/160 [00:34<05:12,  2.21s/it]     [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

oblivious-rt/inputs_batch1 EXPORT:  12%|█▎        | 20/160 [00:37<05:53,  2.53s/it]
cache/inputs EXPORT:  12%|█▎        | 20/160 [00:37<05:53,  2.53s/it]              [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache/inputs EXPORT:  51%|█████     | 81/160 [00:40<00:12,  6.55it/s]
cache/inputs_prompt EXPORT:  51%|█████     | 81/160 [00:40<00:12,  6.55it/s]
cache/inputs2 EXPORT:  51%|█████     | 81/160 [00:40<00:12,  6.55it/s]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache/inputs2 EXPORT:  52%|█████▏    | 83/160 [00:43<00:16,  4.63it/s]
cache/inputs_empty_cache EXPORT:  52%|█████▏    | 83/160 [00:43<00:16,  4.63it/s]
cache/inputs_empty_cache EXPORT:  52%|█████▎    | 84/160 [00:44<00:17,  4.24it/s]
cache/inputs_batch1 EXPORT:  52%|█████▎    | 84/160 [00:44<00:17,  4.24it/s]
cache/inputs_batch1 EXPORT:  53%|█████▎    | 85/160 [00:45<00:18,  3.95it/s]
cache-rt/inputs EXPORT:  53%|█████▎    | 85/160 [00:45<00:18,  3.95it/s]    [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-rt/inputs EXPORT:  54%|█████▍    | 86/160 [00:47<00:28,  2.57it/s]
cache-rt/inputs_prompt EXPORT:  54%|█████▍    | 86/160 [00:47<00:28,  2.57it/s]
cache-rt/inputs2 EXPORT:  54%|█████▍    | 86/160 [00:47<00:28,  2.57it/s]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-rt/inputs2 EXPORT:  55%|█████▌    | 88/160 [00:51<00:40,  1.77it/s]
cache-rt/inputs_empty_cache EXPORT:  55%|█████▌    | 88/160 [00:51<00:40,  1.77it/s]
cache-rt/inputs_empty_cache EXPORT:  56%|█████▌    | 89/160 [00:52<00:41,  1.71it/s]
cache-rt/inputs_batch1 EXPORT:  56%|█████▌    | 89/160 [00:52<00:41,  1.71it/s]
cache-rt/inputs_batch1 EXPORT:  56%|█████▋    | 90/160 [00:52<00:41,  1.70it/s]
cache-oblivious/inputs EXPORT:  56%|█████▋    | 90/160 [00:52<00:41,  1.70it/s][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-oblivious/inputs EXPORT:  57%|█████▋    | 91/160 [00:55<01:00,  1.15it/s]
cache-oblivious/inputs_prompt EXPORT:  57%|█████▋    | 91/160 [00:55<01:00,  1.15it/s]
cache-oblivious/inputs2 EXPORT:  57%|█████▋    | 91/160 [00:55<01:00,  1.15it/s]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-oblivious/inputs2 EXPORT:  58%|█████▊    | 93/160 [00:58<01:14,  1.11s/it]
cache-oblivious/inputs_empty_cache EXPORT:  58%|█████▊    | 93/160 [00:58<01:14,  1.11s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-oblivious/inputs_empty_cache EXPORT:  59%|█████▉    | 94/160 [01:01<01:31,  1.39s/it]
cache-oblivious/inputs_batch1 EXPORT:  59%|█████▉    | 94/160 [01:01<01:31,  1.39s/it]     [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-oblivious/inputs_batch1 EXPORT:  59%|█████▉    | 95/160 [01:04<01:48,  1.67s/it]
cache-oblivious-rt/inputs EXPORT:  59%|█████▉    | 95/160 [01:04<01:48,  1.67s/it]    [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-oblivious-rt/inputs EXPORT:  60%|██████    | 96/160 [01:08<02:14,  2.09s/it]
cache-oblivious-rt/inputs_prompt EXPORT:  60%|██████    | 96/160 [01:08<02:14,  2.09s/it]
cache-oblivious-rt/inputs2 EXPORT:  60%|██████    | 96/160 [01:08<02:14,  2.09s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-oblivious-rt/inputs2 EXPORT:  61%|██████▏   | 98/160 [01:10<01:53,  1.83s/it]
cache-oblivious-rt/inputs_empty_cache EXPORT:  61%|██████▏   | 98/160 [01:10<01:53,  1.83s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-oblivious-rt/inputs_empty_cache EXPORT:  62%|██████▏   | 99/160 [01:13<02:05,  2.06s/it]
cache-oblivious-rt/inputs_batch1 EXPORT:  62%|██████▏   | 99/160 [01:13<02:05,  2.06s/it]     [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-oblivious-rt/inputs_batch1 EXPORT:  62%|██████▎   | 100/160 [01:17<02:20,  2.35s/it]
cache-cache_patch:all/inputs EXPORT:  62%|██████▎   | 100/160 [01:17<02:20,  2.35s/it]    [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:all/inputs VALIDATE:  62%|██████▎   | 100/160 [01:20<02:20,  2.35s/it]
cache-cache_patch:all/inputs VALIDATE:  63%|██████▎   | 101/160 [01:20<02:41,  2.74s/it]
cache-cache_patch:all/inputs_prompt EXPORT:  63%|██████▎   | 101/160 [01:20<02:41,  2.74s/it]
cache-cache_patch:all/inputs2 EXPORT:  63%|██████▎   | 101/160 [01:20<02:41,  2.74s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:all/inputs2 VALIDATE:  63%|██████▎   | 101/160 [01:24<02:41,  2.74s/it]
cache-cache_patch:all/inputs2 VALIDATE:  64%|██████▍   | 103/160 [01:25<02:21,  2.49s/it]
cache-cache_patch:all/inputs_empty_cache EXPORT:  64%|██████▍   | 103/160 [01:25<02:21,  2.49s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 45 of general pattern rewrite rules.

cache-cache_patch:all/inputs_empty_cache VALIDATE:  64%|██████▍   | 103/160 [01:28<02:21,  2.49s/it]
cache-cache_patch:all/inputs_empty_cache VALIDATE:  65%|██████▌   | 104/160 [01:28<02:32,  2.72s/it]
cache-cache_patch:all/inputs_batch1 EXPORT:  65%|██████▌   | 104/160 [01:28<02:32,  2.72s/it]       [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 19 of general pattern rewrite rules.

cache-cache_patch:all/inputs_batch1 VALIDATE:  65%|██████▌   | 104/160 [01:31<02:32,  2.72s/it]
cache-cache_patch:all/inputs_batch1 VALIDATE:  66%|██████▌   | 105/160 [01:31<02:32,  2.77s/it]
cache-cache_patch:all-rt/inputs EXPORT:  66%|██████▌   | 105/160 [01:31<02:32,  2.77s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:all-rt/inputs VALIDATE:  66%|██████▌   | 105/160 [01:35<02:32,  2.77s/it]
cache-cache_patch:all-rt/inputs VALIDATE:  66%|██████▋   | 106/160 [01:36<02:54,  3.23s/it]
cache-cache_patch:all-rt/inputs_prompt EXPORT:  66%|██████▋   | 106/160 [01:36<02:54,  3.23s/it]
cache-cache_patch:all-rt/inputs2 EXPORT:  66%|██████▋   | 106/160 [01:36<02:54,  3.23s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:all-rt/inputs2 VALIDATE:  66%|██████▋   | 106/160 [01:39<02:54,  3.23s/it]
cache-cache_patch:all-rt/inputs2 VALIDATE:  68%|██████▊   | 108/160 [01:39<02:17,  2.64s/it]
cache-cache_patch:all-rt/inputs_empty_cache EXPORT:  68%|██████▊   | 108/160 [01:39<02:17,  2.64s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 45 of general pattern rewrite rules.

cache-cache_patch:all-rt/inputs_empty_cache VALIDATE:  68%|██████▊   | 108/160 [01:43<02:17,  2.64s/it]
cache-cache_patch:all-rt/inputs_empty_cache VALIDATE:  68%|██████▊   | 109/160 [01:44<02:32,  2.99s/it]
cache-cache_patch:all-rt/inputs_batch1 EXPORT:  68%|██████▊   | 109/160 [01:44<02:32,  2.99s/it]       [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 19 of general pattern rewrite rules.

cache-cache_patch:all-rt/inputs_batch1 VALIDATE:  68%|██████▊   | 109/160 [01:46<02:32,  2.99s/it]
cache-cache_patch:all-rt/inputs_batch1 VALIDATE:  69%|██████▉   | 110/160 [01:46<02:26,  2.92s/it]
cache-cache_patch:all-oblivious/inputs EXPORT:  69%|██████▉   | 110/160 [01:46<02:26,  2.92s/it]  [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:all-oblivious/inputs VALIDATE:  69%|██████▉   | 110/160 [01:50<02:26,  2.92s/it]
cache-cache_patch:all-oblivious/inputs VALIDATE:  69%|██████▉   | 111/160 [01:50<02:39,  3.25s/it]
cache-cache_patch:all-oblivious/inputs_prompt EXPORT:  69%|██████▉   | 111/160 [01:50<02:39,  3.25s/it]
cache-cache_patch:all-oblivious/inputs2 EXPORT:  69%|██████▉   | 111/160 [01:50<02:39,  3.25s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:all-oblivious/inputs2 VALIDATE:  69%|██████▉   | 111/160 [01:55<02:39,  3.25s/it]
cache-cache_patch:all-oblivious/inputs2 VALIDATE:  71%|███████   | 113/160 [01:55<02:16,  2.90s/it]
cache-cache_patch:all-oblivious/inputs_empty_cache EXPORT:  71%|███████   | 113/160 [01:55<02:16,  2.90s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:all-oblivious/inputs_empty_cache VALIDATE:  71%|███████   | 113/160 [01:59<02:16,  2.90s/it]
cache-cache_patch:all-oblivious/inputs_empty_cache VALIDATE:  71%|███████▏  | 114/160 [01:59<02:24,  3.14s/it]
cache-cache_patch:all-oblivious/inputs_batch1 EXPORT:  71%|███████▏  | 114/160 [01:59<02:24,  3.14s/it]       [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ❌

cache-cache_patch:all-oblivious/inputs_batch1 EXPORT:  72%|███████▏  | 115/160 [02:03<02:26,  3.25s/it]
cache-cache_patch:all-oblivious-rt/inputs EXPORT:  72%|███████▏  | 115/160 [02:03<02:26,  3.25s/it]    [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 38 of general pattern rewrite rules.

cache-cache_patch:all-oblivious-rt/inputs VALIDATE:  72%|███████▏  | 115/160 [02:07<02:26,  3.25s/it]
cache-cache_patch:all-oblivious-rt/inputs VALIDATE:  72%|███████▎  | 116/160 [02:08<02:43,  3.72s/it]
cache-cache_patch:all-oblivious-rt/inputs_prompt EXPORT:  72%|███████▎  | 116/160 [02:08<02:43,  3.72s/it]
cache-cache_patch:all-oblivious-rt/inputs2 EXPORT:  72%|███████▎  | 116/160 [02:08<02:43,  3.72s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 38 of general pattern rewrite rules.

cache-cache_patch:all-oblivious-rt/inputs2 VALIDATE:  72%|███████▎  | 116/160 [02:11<02:43,  3.72s/it]
cache-cache_patch:all-oblivious-rt/inputs2 VALIDATE:  74%|███████▍  | 118/160 [02:12<02:04,  2.97s/it]
cache-cache_patch:all-oblivious-rt/inputs_empty_cache EXPORT:  74%|███████▍  | 118/160 [02:12<02:04,  2.97s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 38 of general pattern rewrite rules.

cache-cache_patch:all-oblivious-rt/inputs_empty_cache VALIDATE:  74%|███████▍  | 118/160 [02:16<02:04,  2.97s/it]
cache-cache_patch:all-oblivious-rt/inputs_empty_cache VALIDATE:  74%|███████▍  | 119/160 [02:16<02:17,  3.36s/it]
cache-cache_patch:all-oblivious-rt/inputs_batch1 EXPORT:  74%|███████▍  | 119/160 [02:16<02:17,  3.36s/it]       [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ❌

cache-cache_patch:all-oblivious-rt/inputs_batch1 EXPORT:  75%|███████▌  | 120/160 [02:20<02:17,  3.45s/it]
cache-cache_patch:torch/inputs EXPORT:  75%|███████▌  | 120/160 [02:20<02:17,  3.45s/it]                  [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch/inputs EXPORT:  76%|███████▌  | 121/160 [02:23<02:07,  3.27s/it]
cache-cache_patch:torch/inputs_prompt EXPORT:  76%|███████▌  | 121/160 [02:23<02:07,  3.27s/it]
cache-cache_patch:torch/inputs2 EXPORT:  76%|███████▌  | 121/160 [02:23<02:07,  3.27s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch/inputs2 EXPORT:  77%|███████▋  | 123/160 [02:26<01:30,  2.45s/it]
cache-cache_patch:torch/inputs_empty_cache EXPORT:  77%|███████▋  | 123/160 [02:26<01:30,  2.45s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch/inputs_empty_cache EXPORT:  78%|███████▊  | 124/160 [02:29<01:37,  2.71s/it]
cache-cache_patch:torch/inputs_batch1 EXPORT:  78%|███████▊  | 124/160 [02:29<01:37,  2.71s/it]     [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch/inputs_batch1 EXPORT:  78%|███████▊  | 125/160 [02:31<01:31,  2.60s/it]
cache-cache_patch:torch-rt/inputs EXPORT:  78%|███████▊  | 125/160 [02:31<01:31,  2.60s/it]    [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch-rt/inputs EXPORT:  79%|███████▉  | 126/160 [02:34<01:30,  2.66s/it]
cache-cache_patch:torch-rt/inputs_prompt EXPORT:  79%|███████▉  | 126/160 [02:34<01:30,  2.66s/it]
cache-cache_patch:torch-rt/inputs2 EXPORT:  79%|███████▉  | 126/160 [02:34<01:30,  2.66s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch-rt/inputs2 EXPORT:  80%|████████  | 128/160 [02:38<01:17,  2.41s/it]
cache-cache_patch:torch-rt/inputs_empty_cache EXPORT:  80%|████████  | 128/160 [02:38<01:17,  2.41s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch-rt/inputs_empty_cache EXPORT:  81%|████████  | 129/160 [02:41<01:16,  2.48s/it]
cache-cache_patch:torch-rt/inputs_batch1 EXPORT:  81%|████████  | 129/160 [02:41<01:16,  2.48s/it]     [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch-rt/inputs_batch1 EXPORT:  81%|████████▏ | 130/160 [02:43<01:11,  2.37s/it]
cache-cache_patch:torch-oblivious/inputs EXPORT:  81%|████████▏ | 130/160 [02:43<01:11,  2.37s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch-oblivious/inputs EXPORT:  82%|████████▏ | 131/160 [02:46<01:13,  2.54s/it]
cache-cache_patch:torch-oblivious/inputs_prompt EXPORT:  82%|████████▏ | 131/160 [02:46<01:13,  2.54s/it]
cache-cache_patch:torch-oblivious/inputs2 EXPORT:  82%|████████▏ | 131/160 [02:46<01:13,  2.54s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch-oblivious/inputs2 EXPORT:  83%|████████▎ | 133/160 [02:50<01:03,  2.34s/it]
cache-cache_patch:torch-oblivious/inputs_empty_cache EXPORT:  83%|████████▎ | 133/160 [02:50<01:03,  2.34s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch-oblivious/inputs_empty_cache EXPORT:  84%|████████▍ | 134/160 [02:53<01:04,  2.46s/it]
cache-cache_patch:torch-oblivious/inputs_batch1 EXPORT:  84%|████████▍ | 134/160 [02:53<01:04,  2.46s/it]     [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch-oblivious/inputs_batch1 EXPORT:  84%|████████▍ | 135/160 [02:56<01:04,  2.57s/it]
cache-cache_patch:torch-oblivious-rt/inputs EXPORT:  84%|████████▍ | 135/160 [02:56<01:04,  2.57s/it]    [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch-oblivious-rt/inputs EXPORT:  85%|████████▌ | 136/160 [02:59<01:03,  2.65s/it]
cache-cache_patch:torch-oblivious-rt/inputs_prompt EXPORT:  85%|████████▌ | 136/160 [02:59<01:03,  2.65s/it]
cache-cache_patch:torch-oblivious-rt/inputs2 EXPORT:  85%|████████▌ | 136/160 [02:59<01:03,  2.65s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch-oblivious-rt/inputs2 EXPORT:  86%|████████▋ | 138/160 [03:03<00:52,  2.37s/it]
cache-cache_patch:torch-oblivious-rt/inputs_empty_cache EXPORT:  86%|████████▋ | 138/160 [03:03<00:52,  2.37s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch-oblivious-rt/inputs_empty_cache EXPORT:  87%|████████▋ | 139/160 [03:06<00:52,  2.48s/it]
cache-cache_patch:torch-oblivious-rt/inputs_batch1 EXPORT:  87%|████████▋ | 139/160 [03:06<00:52,  2.48s/it]     [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ❌

cache-cache_patch:torch-oblivious-rt/inputs_batch1 EXPORT:  88%|████████▊ | 140/160 [03:09<00:53,  2.66s/it]
cache-cache_patch:transformers/inputs EXPORT:  88%|████████▊ | 140/160 [03:09<00:53,  2.66s/it]             [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:transformers/inputs VALIDATE:  88%|████████▊ | 140/160 [03:13<00:53,  2.66s/it]
cache-cache_patch:transformers/inputs VALIDATE:  88%|████████▊ | 141/160 [03:13<00:56,  2.98s/it]
cache-cache_patch:transformers/inputs_prompt EXPORT:  88%|████████▊ | 141/160 [03:13<00:56,  2.98s/it]
cache-cache_patch:transformers/inputs2 EXPORT:  88%|████████▊ | 141/160 [03:13<00:56,  2.98s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:transformers/inputs2 VALIDATE:  88%|████████▊ | 141/160 [03:17<00:56,  2.98s/it]
cache-cache_patch:transformers/inputs2 VALIDATE:  89%|████████▉ | 143/160 [03:18<00:46,  2.74s/it]
cache-cache_patch:transformers/inputs_empty_cache EXPORT:  89%|████████▉ | 143/160 [03:18<00:46,  2.74s/it]
cache-cache_patch:transformers/inputs_empty_cache EXPORT:  90%|█████████ | 144/160 [03:19<00:36,  2.30s/it]
cache-cache_patch:transformers/inputs_batch1 EXPORT:  90%|█████████ | 144/160 [03:19<00:36,  2.30s/it]
cache-cache_patch:transformers/inputs_batch1 EXPORT:  91%|█████████ | 145/160 [03:19<00:28,  1.89s/it]
cache-cache_patch:transformers-rt/inputs EXPORT:  91%|█████████ | 145/160 [03:19<00:28,  1.89s/it]    [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:transformers-rt/inputs VALIDATE:  91%|█████████ | 145/160 [03:23<00:28,  1.89s/it]
cache-cache_patch:transformers-rt/inputs VALIDATE:  91%|█████████▏| 146/160 [03:23<00:33,  2.40s/it]
cache-cache_patch:transformers-rt/inputs_prompt EXPORT:  91%|█████████▏| 146/160 [03:23<00:33,  2.40s/it]
cache-cache_patch:transformers-rt/inputs2 EXPORT:  91%|█████████▏| 146/160 [03:23<00:33,  2.40s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:transformers-rt/inputs2 VALIDATE:  91%|█████████▏| 146/160 [03:26<00:33,  2.40s/it]
cache-cache_patch:transformers-rt/inputs2 VALIDATE:  92%|█████████▎| 148/160 [03:27<00:25,  2.16s/it]
cache-cache_patch:transformers-rt/inputs_empty_cache EXPORT:  92%|█████████▎| 148/160 [03:27<00:25,  2.16s/it]
cache-cache_patch:transformers-rt/inputs_empty_cache EXPORT:  93%|█████████▎| 149/160 [03:28<00:20,  1.83s/it]
cache-cache_patch:transformers-rt/inputs_batch1 EXPORT:  93%|█████████▎| 149/160 [03:28<00:20,  1.83s/it]
cache-cache_patch:transformers-rt/inputs_batch1 EXPORT:  94%|█████████▍| 150/160 [03:28<00:15,  1.53s/it]
cache-cache_patch:transformers-oblivious/inputs EXPORT:  94%|█████████▍| 150/160 [03:28<00:15,  1.53s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:transformers-oblivious/inputs VALIDATE:  94%|█████████▍| 150/160 [03:33<00:15,  1.53s/it]
cache-cache_patch:transformers-oblivious/inputs VALIDATE:  94%|█████████▍| 151/160 [03:33<00:21,  2.40s/it]
cache-cache_patch:transformers-oblivious/inputs_prompt EXPORT:  94%|█████████▍| 151/160 [03:33<00:21,  2.40s/it]
cache-cache_patch:transformers-oblivious/inputs2 EXPORT:  94%|█████████▍| 151/160 [03:33<00:21,  2.40s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:transformers-oblivious/inputs2 VALIDATE:  94%|█████████▍| 151/160 [03:36<00:21,  2.40s/it]
cache-cache_patch:transformers-oblivious/inputs2 VALIDATE:  96%|█████████▌| 153/160 [03:37<00:15,  2.15s/it]
cache-cache_patch:transformers-oblivious/inputs_empty_cache EXPORT:  96%|█████████▌| 153/160 [03:37<00:15,  2.15s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:transformers-oblivious/inputs_empty_cache VALIDATE:  96%|█████████▌| 153/160 [03:40<00:15,  2.15s/it]
cache-cache_patch:transformers-oblivious/inputs_empty_cache VALIDATE:  96%|█████████▋| 154/160 [03:40<00:15,  2.54s/it]
cache-cache_patch:transformers-oblivious/inputs_batch1 EXPORT:  96%|█████████▋| 154/160 [03:40<00:15,  2.54s/it]       [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ❌

cache-cache_patch:transformers-oblivious/inputs_batch1 EXPORT:  97%|█████████▋| 155/160 [03:44<00:13,  2.71s/it]
cache-cache_patch:transformers-oblivious-rt/inputs EXPORT:  97%|█████████▋| 155/160 [03:44<00:13,  2.71s/it]    [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:transformers-oblivious-rt/inputs VALIDATE:  97%|█████████▋| 155/160 [03:48<00:13,  2.71s/it]
cache-cache_patch:transformers-oblivious-rt/inputs VALIDATE:  98%|█████████▊| 156/160 [03:49<00:13,  3.39s/it]
cache-cache_patch:transformers-oblivious-rt/inputs_prompt EXPORT:  98%|█████████▊| 156/160 [03:49<00:13,  3.39s/it]
cache-cache_patch:transformers-oblivious-rt/inputs2 EXPORT:  98%|█████████▊| 156/160 [03:49<00:13,  3.39s/it]      [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:transformers-oblivious-rt/inputs2 VALIDATE:  98%|█████████▊| 156/160 [03:52<00:13,  3.39s/it]
cache-cache_patch:transformers-oblivious-rt/inputs2 VALIDATE:  99%|█████████▉| 158/160 [03:53<00:05,  2.75s/it]
cache-cache_patch:transformers-oblivious-rt/inputs_empty_cache EXPORT:  99%|█████████▉| 158/160 [03:53<00:05,  2.75s/it][torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ✅
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: batch will not be used, since it shares the same shape constraints with another axis: batch.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
~/vv/this312/lib/python3.12/site-packages/torch/onnx/_internal/exporter/_onnx_program.py:460: UserWarning: # The axis name: seq_length will not be used, since it shares the same shape constraints with another axis: seq_length.
  rename_mapping = _dynamic_shapes.create_rename_mapping(
Applied 39 of general pattern rewrite rules.

cache-cache_patch:transformers-oblivious-rt/inputs_empty_cache VALIDATE:  99%|█████████▉| 158/160 [03:56<00:05,  2.75s/it]
cache-cache_patch:transformers-oblivious-rt/inputs_empty_cache VALIDATE:  99%|█████████▉| 159/160 [03:57<00:03,  3.01s/it]
cache-cache_patch:transformers-oblivious-rt/inputs_batch1 EXPORT:  99%|█████████▉| 159/160 [03:57<00:03,  3.01s/it]       [torch.onnx] Run decomposition...
/usr/lib/python3.12/copyreg.py:99: FutureWarning: `isinstance(treespec, LeafSpec)` is deprecated, use `isinstance(treespec, TreeSpec) and treespec.is_leaf()` instead.
  return cls.__new__(cls, *args)
[torch.onnx] Run decomposition... ✅
[torch.onnx] Translate the graph into ONNX...
[torch.onnx] Translate the graph into ONNX... ❌

cache-cache_patch:transformers-oblivious-rt/inputs_batch1 EXPORT: 100%|██████████| 160/160 [04:01<00:00,  3.41s/it]
cache-cache_patch:transformers-oblivious-rt/inputs_batch1 EXPORT: 100%|██████████| 160/160 [04:01<00:00,  1.51s/it]

Let’s save the results.

df = pandas.DataFrame(results)
df.to_excel("plot_export_tiny_llm_dim01_onnx.xlsx")
df
cache cache_patch oblivious rt export_with EXPORT ERR-EXPORT run_with WORKS ERR-RUN
0 0 0 0 0 inputs 0 Failed to decompose the FX graph for ONNX comp... NaN NaN NaN
1 0 0 0 0 inputs_prompt 0 When `dynamic_shapes` is specified as a dict, ... NaN NaN NaN
2 0 0 0 0 inputs2 0 Failed to decompose the FX graph for ONNX comp... NaN NaN NaN
3 0 0 0 0 inputs_empty_cache 0 Found the following conflicts between user-spe... NaN NaN NaN
4 0 0 0 0 inputs_batch1 0 Found the following conflicts between user-spe... NaN NaN NaN
... ... ... ... ... ... ... ... ... ... ...
191 1 transformers 1 1 inputs_empty_cache 1 NaN inputs_prompt 0.0 Not the same number of given inputs 1 and the ...
192 1 transformers 1 1 inputs_empty_cache 1 NaN inputs2 1.0 NaN
193 1 transformers 1 1 inputs_empty_cache 1 NaN inputs_empty_cache 1.0 NaN
194 1 transformers 1 1 inputs_empty_cache 1 NaN inputs_batch1 1.0 NaN
195 1 transformers 1 1 inputs_batch1 0 Failed to convert the exported program to an O... NaN NaN NaN

196 rows × 10 columns



no_export = df[df.EXPORT == 0]
no_export.to_excel("plot_export_tiny_llm_dim01_onnx.no_export.xlsx")
no_export
cache cache_patch oblivious rt export_with EXPORT ERR-EXPORT run_with WORKS ERR-RUN
0 0 0 0 0 inputs 0 Failed to decompose the FX graph for ONNX comp... NaN NaN NaN
1 0 0 0 0 inputs_prompt 0 When `dynamic_shapes` is specified as a dict, ... NaN NaN NaN
2 0 0 0 0 inputs2 0 Failed to decompose the FX graph for ONNX comp... NaN NaN NaN
3 0 0 0 0 inputs_empty_cache 0 Found the following conflicts between user-spe... NaN NaN NaN
4 0 0 0 0 inputs_batch1 0 Found the following conflicts between user-spe... NaN NaN NaN
... ... ... ... ... ... ... ... ... ... ...
161 1 transformers 0 1 inputs_batch1 0 Found the following conflicts between user-spe... NaN NaN NaN
167 1 transformers 1 0 inputs_prompt 0 When `dynamic_shapes` is specified as a dict, ... NaN NaN NaN
178 1 transformers 1 0 inputs_batch1 0 Failed to convert the exported program to an O... NaN NaN NaN
184 1 transformers 1 1 inputs_prompt 0 When `dynamic_shapes` is specified as a dict, ... NaN NaN NaN
195 1 transformers 1 1 inputs_batch1 0 Failed to convert the exported program to an O... NaN NaN NaN

76 rows × 10 columns



The validation failures.

invalid = df[(df.EXPORT == 1) & (df.WORKS == 0)].pivot(
    index=["cache", "cache_patch", "oblivious", "rt", "export_with"],
    columns=["run_with"],
    values=["WORKS", "ERR-RUN"],
)
invalid.to_excel("plot_export_tiny_llm_dim01_onnx.invalid.xlsx")
invalid
WORKS ERR-RUN
run_with inputs inputs2 inputs_batch1 inputs_empty_cache inputs_prompt inputs inputs2 inputs_batch1 inputs_empty_cache inputs_prompt
cache cache_patch oblivious rt export_with
1 all 0 0 inputs NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs2 NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs_batch1 0.0 0.0 NaN 0.0 0.0 [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Go... [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Go... NaN [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Go... Not the same number of given inputs 1 and the ...
inputs_empty_cache 0.0 0.0 0.0 NaN 0.0 [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Go... [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Go... [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Go... NaN Not the same number of given inputs 1 and the ...
1 inputs NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs2 NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs_batch1 0.0 0.0 NaN 0.0 0.0 [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Go... [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Go... NaN [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Go... Not the same number of given inputs 1 and the ...
inputs_empty_cache 0.0 0.0 0.0 NaN 0.0 [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Go... [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Go... [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Go... NaN Not the same number of given inputs 1 and the ...
1 0 inputs NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs2 NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs_empty_cache NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
1 inputs NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs2 NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs_empty_cache NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
transformers 0 0 inputs NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs2 NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
1 inputs NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs2 NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
1 0 inputs NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs2 NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs_empty_cache NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
1 inputs NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs2 NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...
inputs_empty_cache NaN NaN NaN NaN 0.0 NaN NaN NaN NaN Not the same number of given inputs 1 and the ...


success = df[(df.EXPORT == 1) & (df.WORKS == 1)].pivot(
    index=["cache", "cache_patch", "oblivious", "rt", "export_with"],
    columns=["run_with"],
    values=["WORKS"],
)
success.to_excel("plot_export_tiny_llm_dim01_onnx.success.xlsx")
success
WORKS
run_with inputs inputs2 inputs_batch1 inputs_empty_cache
cache cache_patch oblivious rt export_with
1 all 0 0 inputs 1.0 1.0 1.0 1.0
inputs2 1.0 1.0 1.0 1.0
inputs_batch1 NaN NaN 1.0 NaN
inputs_empty_cache NaN NaN NaN 1.0
1 inputs 1.0 1.0 1.0 1.0
inputs2 1.0 1.0 1.0 1.0
inputs_batch1 NaN NaN 1.0 NaN
inputs_empty_cache NaN NaN NaN 1.0
1 0 inputs 1.0 1.0 1.0 1.0
inputs2 1.0 1.0 1.0 1.0
inputs_empty_cache 1.0 1.0 1.0 1.0
1 inputs 1.0 1.0 1.0 1.0
inputs2 1.0 1.0 1.0 1.0
inputs_empty_cache 1.0 1.0 1.0 1.0
transformers 0 0 inputs 1.0 1.0 1.0 1.0
inputs2 1.0 1.0 1.0 1.0
1 inputs 1.0 1.0 1.0 1.0
inputs2 1.0 1.0 1.0 1.0
1 0 inputs 1.0 1.0 1.0 1.0
inputs2 1.0 1.0 1.0 1.0
inputs_empty_cache 1.0 1.0 1.0 1.0
1 inputs 1.0 1.0 1.0 1.0
inputs2 1.0 1.0 1.0 1.0
inputs_empty_cache 1.0 1.0 1.0 1.0


If you have any error, then look at example Export Tiny-LLM with patches.

doc.plot_legend("Tiny-LLM\nexport with\ndimension in {0,1}", "torch.onnx.export", "tomato")
plot export tiny llm dim01 onnx

Total running time of the script: (4 minutes 13.292 seconds)

Related examples

Export with dynamic dimensions in {0,1} into ONNX (custom)

Export with dynamic dimensions in {0,1} into ONNX (custom)

Export with dynamic dimensions in {0,1}

Export with dynamic dimensions in {0,1}

Export microsoft/phi-2

Export microsoft/phi-2

Gallery generated by Sphinx-Gallery