onnx-diagnostic 0.8.0__py3-none-any.whl → 0.8.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- onnx_diagnostic/__init__.py +1 -1
- onnx_diagnostic/_command_lines_parser.py +78 -22
- onnx_diagnostic/export/api.py +35 -5
- onnx_diagnostic/export/control_flow.py +511 -0
- onnx_diagnostic/export/control_flow_research.py +135 -0
- onnx_diagnostic/ext_test_case.py +33 -9
- onnx_diagnostic/helpers/cache_helper.py +217 -203
- onnx_diagnostic/helpers/helper.py +6 -2
- onnx_diagnostic/helpers/log_helper.py +39 -5
- onnx_diagnostic/helpers/memory_peak.py +2 -0
- onnx_diagnostic/helpers/mini_onnx_builder.py +55 -3
- onnx_diagnostic/helpers/onnx_helper.py +13 -16
- onnx_diagnostic/helpers/rt_helper.py +579 -15
- onnx_diagnostic/helpers/torch_helper.py +5 -0
- onnx_diagnostic/tasks/image_text_to_text.py +5 -1
- onnx_diagnostic/tasks/text2text_generation.py +1 -0
- onnx_diagnostic/tasks/text_generation.py +84 -54
- onnx_diagnostic/torch_export_patches/eval/model_cases.py +28 -0
- onnx_diagnostic/torch_export_patches/onnx_export_errors.py +1 -1
- onnx_diagnostic/torch_export_patches/onnx_export_serialization.py +11 -7
- onnx_diagnostic/torch_export_patches/patches/patch_torch.py +4 -1
- onnx_diagnostic/torch_export_patches/patches/patch_transformers.py +563 -61
- onnx_diagnostic/torch_models/hghub/hub_data_cached_configs.py +53 -0
- onnx_diagnostic/torch_models/hghub/model_inputs.py +15 -2
- onnx_diagnostic/torch_models/validate.py +620 -213
- {onnx_diagnostic-0.8.0.dist-info → onnx_diagnostic-0.8.2.dist-info}/METADATA +1 -1
- {onnx_diagnostic-0.8.0.dist-info → onnx_diagnostic-0.8.2.dist-info}/RECORD +30 -28
- {onnx_diagnostic-0.8.0.dist-info → onnx_diagnostic-0.8.2.dist-info}/WHEEL +0 -0
- {onnx_diagnostic-0.8.0.dist-info → onnx_diagnostic-0.8.2.dist-info}/licenses/LICENSE.txt +0 -0
- {onnx_diagnostic-0.8.0.dist-info → onnx_diagnostic-0.8.2.dist-info}/top_level.txt +0 -0
|
@@ -4903,3 +4903,56 @@ def _ccached_hf_internal_testing_tiny_random_gemma3_for_causal_lm():
|
|
|
4903
4903
|
"vocab_size": 262144,
|
|
4904
4904
|
}
|
|
4905
4905
|
)
|
|
4906
|
+
|
|
4907
|
+
|
|
4908
|
+
def _ccached_qwen_qwen2_5_vl_7b_instruct():
|
|
4909
|
+
"Qwen/Qwen2.5-VL-7B-Instruct"
|
|
4910
|
+
return transformers.Qwen2_5_VLConfig(
|
|
4911
|
+
**{
|
|
4912
|
+
"architectures": ["Qwen2_5_VLForConditionalGeneration"],
|
|
4913
|
+
"attention_dropout": 0.0,
|
|
4914
|
+
"bos_token_id": 151643,
|
|
4915
|
+
"eos_token_id": 151645,
|
|
4916
|
+
"vision_start_token_id": 151652,
|
|
4917
|
+
"vision_end_token_id": 151653,
|
|
4918
|
+
"vision_token_id": 151654,
|
|
4919
|
+
"image_token_id": 151655,
|
|
4920
|
+
"video_token_id": 151656,
|
|
4921
|
+
"hidden_act": "silu",
|
|
4922
|
+
"hidden_size": 3584,
|
|
4923
|
+
"initializer_range": 0.02,
|
|
4924
|
+
"intermediate_size": 18944,
|
|
4925
|
+
"max_position_embeddings": 128000,
|
|
4926
|
+
"max_window_layers": 28,
|
|
4927
|
+
"model_type": "qwen2_5_vl",
|
|
4928
|
+
"num_attention_heads": 28,
|
|
4929
|
+
"num_hidden_layers": 28,
|
|
4930
|
+
"num_key_value_heads": 4,
|
|
4931
|
+
"rms_norm_eps": 1e-06,
|
|
4932
|
+
"rope_theta": 1000000.0,
|
|
4933
|
+
"sliding_window": 32768,
|
|
4934
|
+
"tie_word_embeddings": false,
|
|
4935
|
+
"torch_dtype": "bfloat16",
|
|
4936
|
+
"transformers_version": "4.41.2",
|
|
4937
|
+
"use_cache": true,
|
|
4938
|
+
"use_sliding_window": false,
|
|
4939
|
+
"vision_config": {
|
|
4940
|
+
"depth": 32,
|
|
4941
|
+
"hidden_act": "silu",
|
|
4942
|
+
"hidden_size": 1280,
|
|
4943
|
+
"intermediate_size": 3420,
|
|
4944
|
+
"num_heads": 16,
|
|
4945
|
+
"in_chans": 3,
|
|
4946
|
+
"out_hidden_size": 3584,
|
|
4947
|
+
"patch_size": 14,
|
|
4948
|
+
"spatial_merge_size": 2,
|
|
4949
|
+
"spatial_patch_size": 14,
|
|
4950
|
+
"window_size": 112,
|
|
4951
|
+
"fullatt_block_indexes": [7, 15, 23, 31],
|
|
4952
|
+
"tokens_per_second": 2,
|
|
4953
|
+
"temporal_patch_size": 2,
|
|
4954
|
+
},
|
|
4955
|
+
"rope_scaling": {"type": "mrope", "mrope_section": [16, 24, 24]},
|
|
4956
|
+
"vocab_size": 152064,
|
|
4957
|
+
}
|
|
4958
|
+
)
|
|
@@ -3,7 +3,7 @@ import inspect
|
|
|
3
3
|
import os
|
|
4
4
|
import pprint
|
|
5
5
|
import time
|
|
6
|
-
from typing import Any, Dict, Optional, Tuple
|
|
6
|
+
from typing import Any, Callable, Dict, Optional, Tuple
|
|
7
7
|
import torch
|
|
8
8
|
import transformers
|
|
9
9
|
from ...helpers.config_helper import update_config, build_diff_config
|
|
@@ -53,6 +53,7 @@ def get_untrained_model_with_inputs(
|
|
|
53
53
|
add_second_input: int = 1,
|
|
54
54
|
subfolder: Optional[str] = None,
|
|
55
55
|
use_only_preinstalled: bool = False,
|
|
56
|
+
config_reduction: Optional[Callable[[Any, str], Dict]] = None,
|
|
56
57
|
) -> Dict[str, Any]:
|
|
57
58
|
"""
|
|
58
59
|
Gets a non initialized model similar to the original model
|
|
@@ -75,6 +76,12 @@ def get_untrained_model_with_inputs(
|
|
|
75
76
|
supports different shapes
|
|
76
77
|
:param subfolder: subfolder to use for this model id
|
|
77
78
|
:param use_only_preinstalled: use only preinstalled version
|
|
79
|
+
:param config_reduction: if specified, this function is used to reduce the
|
|
80
|
+
model size by tweaking the configuration, it returns a dictionary with values
|
|
81
|
+
to update, if empty, function:`reduce_model_config
|
|
82
|
+
<onnx_diagnostic.torch_models.hghub.reduce_model_config>`,
|
|
83
|
+
this function takes a configuration and a task (string)
|
|
84
|
+
as arguments
|
|
78
85
|
:return: dictionary with a model, inputs, dynamic shapes, and the configuration,
|
|
79
86
|
some necessary rewriting as well
|
|
80
87
|
|
|
@@ -157,7 +164,13 @@ def get_untrained_model_with_inputs(
|
|
|
157
164
|
|
|
158
165
|
# updating the configuration
|
|
159
166
|
config0 = copy.deepcopy(config)
|
|
160
|
-
|
|
167
|
+
if config_reduction:
|
|
168
|
+
assert (
|
|
169
|
+
not same_as_pretrained
|
|
170
|
+
), "config_reduction should be None if same_as_pretrained is True"
|
|
171
|
+
mkwargs = config_reduction(config, task)
|
|
172
|
+
else:
|
|
173
|
+
mkwargs = reduce_model_config(config, task) if not same_as_pretrained else {}
|
|
161
174
|
if model_kwargs:
|
|
162
175
|
for k, v in model_kwargs.items():
|
|
163
176
|
if isinstance(v, dict):
|