onnx-diagnostic 0.8.1__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.
@@ -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
- mkwargs = reduce_model_config(config, task) if not same_as_pretrained else {}
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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: onnx-diagnostic
3
- Version: 0.8.1
3
+ Version: 0.8.2
4
4
  Summary: Tools to help converting pytorch models into ONNX.
5
5
  Home-page: https://github.com/sdpython/onnx-diagnostic
6
6
  Author: Xavier Dupré
@@ -1,11 +1,13 @@
1
- onnx_diagnostic/__init__.py,sha256=ZsPqstKLK63l9L8paT5pSopf6AlqtG5A_OLfTTZsdks,173
1
+ onnx_diagnostic/__init__.py,sha256=V-Rg-8wiAAhPPRxZNTkkCAlGh_v3sDrFDlTo1Ptqi00,173
2
2
  onnx_diagnostic/__main__.py,sha256=YmyV_Aq_ianDlHyKLHMa6h8YK3ZmFPpLVHLKjM91aCk,79
3
3
  onnx_diagnostic/_command_lines_parser.py,sha256=uDn91eWmiz9i7KEaB2vTsR06kkrM0VCkUq9kaBDiPA0,39384
4
4
  onnx_diagnostic/api.py,sha256=BhCl_yCd78N7TlVtPOHjeYv1QBEy39TjZ647rcHqLh0,345
5
5
  onnx_diagnostic/doc.py,sha256=t3RELgfooYnVMAi0JSpggWkQEgUsREz8NmRvn0TnLI8,2829
6
- onnx_diagnostic/ext_test_case.py,sha256=tNFXtf1iaa6wweDaIJyKCDjW0LlT6n_its9JBS2pIX8,43859
6
+ onnx_diagnostic/ext_test_case.py,sha256=RU1WQi2UJNla9vcgz2XrL3q1_YN4v7rB9WnF4_58kko,44867
7
7
  onnx_diagnostic/export/__init__.py,sha256=yEIoWiOeTwBsDhyYt2fTKuhtA0Ya1J9u9ZzMTOTWaWs,101
8
- onnx_diagnostic/export/api.py,sha256=zd_uTe1Ji41t6pcPbVQFcHX2Sl8Dfe7U6sMcMHXoVhk,4864
8
+ onnx_diagnostic/export/api.py,sha256=gj0rhXjJRchrQhuBdyljA8DlxSNjO7S0dGV4qfoa040,6058
9
+ onnx_diagnostic/export/control_flow.py,sha256=mJQHqnvf8RQ9hI69Ghnl-tJrSrWz2fK_STcbpSUZ02M,17351
10
+ onnx_diagnostic/export/control_flow_research.py,sha256=qO4X52Lp_grMx0wXOEfwOpXMiRd-VFeMibfJ4VigBcU,5200
9
11
  onnx_diagnostic/export/dynamic_shapes.py,sha256=M2hlpHSTbkzZwGKAbrpQXng5HQrwjF5Z6wGGxEgnp74,42061
10
12
  onnx_diagnostic/export/shape_helper.py,sha256=m628y0oRCQbeZkeh8JDHIfWMsSjoJoeX-IPiPGDHT-w,11273
11
13
  onnx_diagnostic/export/validate.py,sha256=_PGUql2DJhIgGKo0WjTGUc5AgsZUx8fEs00MePy-w98,6043
@@ -13,20 +15,20 @@ onnx_diagnostic/helpers/__init__.py,sha256=GJ2GT7cgnlIveVUwMZhuvUwidbTJaKv8CsSIO
13
15
  onnx_diagnostic/helpers/_log_helper.py,sha256=OTwQH0OIxs9B6nrSvR7MoxMimSw_8mU0mj133NvLk5o,16832
14
16
  onnx_diagnostic/helpers/args_helper.py,sha256=SRWnqC7EENg09RZlA50B_PcdiIhdbgA4C3ACfzl5nMs,4419
15
17
  onnx_diagnostic/helpers/bench_run.py,sha256=CGA6VMJZMH2gDhVueT9ypNm4PMcjGrrGFYp08nhWj9k,16539
16
- onnx_diagnostic/helpers/cache_helper.py,sha256=MXNJH-HIqHR3EkVs576Ie_3kgFRU1zs4RXuNaIgwdvQ,27257
18
+ onnx_diagnostic/helpers/cache_helper.py,sha256=JcpRNvwNY6CRjjaZApShhdw8hCZNHS2xUhce5ZaWVtU,28446
17
19
  onnx_diagnostic/helpers/config_helper.py,sha256=cWRETgFhZ7tayIZPnMqF8BF5AvTU64G2BMqyzgO7lzs,5670
18
20
  onnx_diagnostic/helpers/doc_helper.py,sha256=pl5MZd3_FaE8BqQnqoBuSBxoNCFcd2OJd3eITUSku5c,5897
19
21
  onnx_diagnostic/helpers/fake_tensor_helper.py,sha256=J7wnK3WTuVKnYiMzLVTAPkdJr3hQfIfMC9ZlOu7oGmI,11024
20
22
  onnx_diagnostic/helpers/graph_helper.py,sha256=hevQT5a7_QuriVPQcbT5qe18n99Doyl5h3-qshx1-uk,14093
21
- onnx_diagnostic/helpers/helper.py,sha256=7kNNsXRERffNSVo-NF5o585zAHzwMSOGuSl_g2uKGWs,62933
22
- onnx_diagnostic/helpers/log_helper.py,sha256=ujVwDkXoG4gKCIGMy-qxxBTHjkgfgPq9K-hEEcB_YWI,92199
23
+ onnx_diagnostic/helpers/helper.py,sha256=xzq3iBiasWy6qH1_-ydn8QzRKaBgOy4Cs3f9O5PU-3M,63027
24
+ onnx_diagnostic/helpers/log_helper.py,sha256=0lJiTF87lliI-LmgpUH_V2N8NuzJ0LryH0mSYpkRaL8,93272
23
25
  onnx_diagnostic/helpers/memory_peak.py,sha256=M3m4_thWFIwP5HytbJYEqaijXIv5v5BW_vlcJowIYI4,6434
24
- onnx_diagnostic/helpers/mini_onnx_builder.py,sha256=bJNHS9nQcm_0FVFgx09-EVEKirosiLMvbRAyImfrPbY,22057
26
+ onnx_diagnostic/helpers/mini_onnx_builder.py,sha256=hGAh5pLmXMwx8vx8MUjPmvWak86nCc3pJOvdfX-mqcE,23828
25
27
  onnx_diagnostic/helpers/model_builder_helper.py,sha256=5V-SlOVQaGPZov6aSJ0IvYcwpDo2hsCBJpqadRUdnrk,17875
26
- onnx_diagnostic/helpers/onnx_helper.py,sha256=mgZv9DaT6xDJPgiysvFzRnfP9LpmmFyYmuhwTlfyAdY,39804
28
+ onnx_diagnostic/helpers/onnx_helper.py,sha256=NC3dD1mKCjzkj5YS6rrBwo5zgfot2Lz71c2ARq-lLpI,39641
27
29
  onnx_diagnostic/helpers/ort_session.py,sha256=wjQ1pwzUHuOFxK8Q8Ve3Ph6CUBBC_udK7FcwuDyDMzA,29541
28
- onnx_diagnostic/helpers/rt_helper.py,sha256=WmIgK2lfZiiaZIYCq5rkzlT5rhe45MGJad9dVizKwU0,18833
29
- onnx_diagnostic/helpers/torch_helper.py,sha256=6OKQFcu9E5ub8E1L_9nedUqAH3ixQZivG2YY5jc7pqE,34938
30
+ onnx_diagnostic/helpers/rt_helper.py,sha256=OOxHSCKZup2u7zTvVJxPkRHb4jQZ03KpkiDGrfwibMM,38135
31
+ onnx_diagnostic/helpers/torch_helper.py,sha256=_-5ecz0D8CAEzkH0uW9MTRywH-NDPNCx0qVmWzTa6do,35180
30
32
  onnx_diagnostic/reference/__init__.py,sha256=rLZsxOlnb7-81F2CzepGnZLejaROg4JvgFaGR9FwVQA,208
31
33
  onnx_diagnostic/reference/evaluator.py,sha256=RzNzjFDeMe-4X51Tb22N6aagazY5ktNq-mRmPcfY5EU,8848
32
34
  onnx_diagnostic/reference/ort_evaluator.py,sha256=nituItsP3IKDDWF9z-iGX_iAubrTcdk8pb1GVBp9sCU,26161
@@ -79,7 +81,7 @@ onnx_diagnostic/tasks/automatic_speech_recognition.py,sha256=aMufLDGW005f7aLMZ9a
79
81
  onnx_diagnostic/tasks/feature_extraction.py,sha256=Bt5meYvVqOFd_v8NgLKAfyqtjoEsEi6oQcQLn1vcwG4,5316
80
82
  onnx_diagnostic/tasks/fill_mask.py,sha256=5Gt6zlj0p6vuifox7Wmj-TpHXJvPS0CEH8evgdBHDNA,2640
81
83
  onnx_diagnostic/tasks/image_classification.py,sha256=nLpBBB1Gkog3Fk6pu2waiHcuQr4ILPptc9FhQ-pn460,4682
82
- onnx_diagnostic/tasks/image_text_to_text.py,sha256=TmBmjsr42R928ZvejUsk-ckFkl-2PoAZKDYJTRdQyIY,21628
84
+ onnx_diagnostic/tasks/image_text_to_text.py,sha256=g-xRRTVUiT6mBvYYbOxgzlHNfu9SnEgUcvTeSoqf7gE,21765
83
85
  onnx_diagnostic/tasks/image_to_video.py,sha256=SoF2cVIJr6P30Abp-FCuixFDh5RvTuNEOL36QthGY6U,3860
84
86
  onnx_diagnostic/tasks/mask_generation.py,sha256=fjdD3rd-O-mFL0hQy3la3JXKth_0bH2HL7Eelq-3Dbs,5057
85
87
  onnx_diagnostic/tasks/mixture_of_expert.py,sha256=al4tk1BrHidtRiHlAaiflWiJaAte0d5M8WcBioANG9k,2808
@@ -94,18 +96,18 @@ onnx_diagnostic/tasks/zero_shot_image_classification.py,sha256=jJCMWuOqGv5ahCfjr
94
96
  onnx_diagnostic/tasks/data/__init__.py,sha256=uJoemrWgEjI6oA-tMX7r3__x-b3siPmkgqaY7bgIles,401
95
97
  onnx_diagnostic/tasks/data/dummies_imagetext2text_generation_gemma3.onnx,sha256=UbtvmWMqcZOKJ-I-HXWI1A6YR6QDaFS5u_yXm5C3ZBw,10299
96
98
  onnx_diagnostic/torch_export_patches/__init__.py,sha256=0SaZedwznm1hQUCvXZsGZORV5vby954wEExr5faepGg,720
97
- onnx_diagnostic/torch_export_patches/onnx_export_errors.py,sha256=6Few2OhZsjshKXR-g_yHUfXg10Whru69S54t3AxemuU,41853
98
- onnx_diagnostic/torch_export_patches/onnx_export_serialization.py,sha256=K78uX5EHTuu0ah3mkZWNcGow4775GKH-EnDs3ZlIEhE,11778
99
+ onnx_diagnostic/torch_export_patches/onnx_export_errors.py,sha256=WPb8Ku643UIV8kDyt9JUpaJBIVXth9UbteCNctd_yis,41863
100
+ onnx_diagnostic/torch_export_patches/onnx_export_serialization.py,sha256=0HdubI06EGpxOICqDWZoVmZkVO9gAaFADEmby197EyM,11935
99
101
  onnx_diagnostic/torch_export_patches/patch_details.py,sha256=MSraVo5ngBhihi8ssPMXSY9B4fJ17J-GAADaw3dT-rc,11794
100
102
  onnx_diagnostic/torch_export_patches/patch_expressions.py,sha256=vr4tt61cbDnaaaduzMj4UBZ8OUtr6GfDpIWwOYqjWzs,3213
101
103
  onnx_diagnostic/torch_export_patches/patch_inputs.py,sha256=-TgcyjVzxTb5Y-_ibssTeaA5PFz6FJrV6q84HMUAsJw,8075
102
104
  onnx_diagnostic/torch_export_patches/patch_module.py,sha256=9DYgTiFwbFMipFQP-IgjyIkXyVrDsRgwmUQXE2qKFsw,39454
103
105
  onnx_diagnostic/torch_export_patches/patch_module_helper.py,sha256=2U0AdyZuU0W54QTdE7tY7imVzMnpQ5091ADNtTCkT8Y,6967
104
106
  onnx_diagnostic/torch_export_patches/eval/__init__.py,sha256=YQoOGt9XQLWqnJ15NnT7ri_jDevfvpuQwEJo38E-VRU,25056
105
- onnx_diagnostic/torch_export_patches/eval/model_cases.py,sha256=joDJV1YfrhYBR_6eXYvNO1jbiJM8Whb47NWZxo8SBwg,27172
107
+ onnx_diagnostic/torch_export_patches/eval/model_cases.py,sha256=9h4yo9vKiK-E6zaXyAsxXGM-lCjd88ONybA1F3YcTI4,27988
106
108
  onnx_diagnostic/torch_export_patches/patches/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
107
109
  onnx_diagnostic/torch_export_patches/patches/patch_torch.py,sha256=FfES0WWiWxmuQbGTlQ7IJS0YBG7km3IQbnMYwk_lPPU,44667
108
- onnx_diagnostic/torch_export_patches/patches/patch_transformers.py,sha256=y2jV_zRj58vDFc3vTvudB3-EnjOW8ISeNngLNryyilE,87925
110
+ onnx_diagnostic/torch_export_patches/patches/patch_transformers.py,sha256=8r5NQxVfwPi9YVHmeGS5xN52wsa5IgUKzFxls3xuX4Y,109850
109
111
  onnx_diagnostic/torch_export_patches/serialization/__init__.py,sha256=BHLdRPtNAtNPAS-bPKEj3-foGSPvwAbZXrHzGGPDLEw,1876
110
112
  onnx_diagnostic/torch_export_patches/serialization/diffusers_impl.py,sha256=drq3EH_yjcSuIWYsVeUWm8Cx6YCZFU6bP_1PLtPfY5I,945
111
113
  onnx_diagnostic/torch_export_patches/serialization/transformers_impl.py,sha256=sIHFvUQoMK8ytXQYB-k7OL62z8A3f5uDaq-S5R5uN-M,10034
@@ -116,8 +118,8 @@ onnx_diagnostic/torch_models/validate.py,sha256=jzBgZRKCzpWH25rCoc6b0QsLQlmQXSzL
116
118
  onnx_diagnostic/torch_models/hghub/__init__.py,sha256=vi1Q7YHdddj1soiBN42MSvJdFqe2_KUoWafHISjwOu8,58
117
119
  onnx_diagnostic/torch_models/hghub/hub_api.py,sha256=rFbiPNLET-KdBpnv-p0nKgwHX6d7C_Z0s9zZ86_92kQ,14307
118
120
  onnx_diagnostic/torch_models/hghub/hub_data.py,sha256=8V_pAgACPLPsLRYUododg7MSL6str-T3tBEGY4OaeYQ,8724
119
- onnx_diagnostic/torch_models/hghub/hub_data_cached_configs.py,sha256=VdLMPQ_ZpPg6cGMy00R2bGjSLWhvjkx8awY7kFD03I8,290141
120
- onnx_diagnostic/torch_models/hghub/model_inputs.py,sha256=xIY_CWOp3m5-cJUvDLTZiH9GwiXi6xTYwONgFY4o45g,15593
121
+ onnx_diagnostic/torch_models/hghub/hub_data_cached_configs.py,sha256=GimzkI8W3guATkDx7RQ-w2xNGVaFDVegfTnnmNxf4iE,292068
122
+ onnx_diagnostic/torch_models/hghub/model_inputs.py,sha256=bVjf7Tm8tTi0dbqQZbcbNXDWuS5g6YBfR3xyeQ-NAWM,16285
121
123
  onnx_diagnostic/torch_models/hghub/model_specific.py,sha256=j50Nu7wddJMoqmD4QzMbNdFDUUgUmSBKRzPDH55TlUQ,2498
122
124
  onnx_diagnostic/torch_models/untrained/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
123
125
  onnx_diagnostic/torch_models/untrained/llm_phi2.py,sha256=y_akbdApi136qHcEQgykwIAYVw0Yfi0lbjb3DNuafaU,3948
@@ -125,8 +127,8 @@ onnx_diagnostic/torch_models/untrained/llm_tiny_llm.py,sha256=QXw_Bs2SzfeiQMf-tm
125
127
  onnx_diagnostic/torch_onnx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
126
128
  onnx_diagnostic/torch_onnx/runtime_info.py,sha256=1g9F_Jf9AAgYQU4stbsrFXwQl-30mWlQrFbQ7val8Ps,9268
127
129
  onnx_diagnostic/torch_onnx/sbs.py,sha256=IoKLA5UwS6kY8g4OOf_bdQwCziIsQfBczZ3w8wo4wZM,16905
128
- onnx_diagnostic-0.8.1.dist-info/licenses/LICENSE.txt,sha256=Vv6TXglX6Rc0d-f8aREhayhT-6PMQXEyOmI2NKlUCMc,1045
129
- onnx_diagnostic-0.8.1.dist-info/METADATA,sha256=tRTy3IKEDtdBM_VGHe0hUNu5WZ0xGKV_gGMVaUussjY,6734
130
- onnx_diagnostic-0.8.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
131
- onnx_diagnostic-0.8.1.dist-info/top_level.txt,sha256=KwNkXewmcobM3ZT1DJLVWH6ebJzA5qKg7cWqKfpGNT4,16
132
- onnx_diagnostic-0.8.1.dist-info/RECORD,,
130
+ onnx_diagnostic-0.8.2.dist-info/licenses/LICENSE.txt,sha256=Vv6TXglX6Rc0d-f8aREhayhT-6PMQXEyOmI2NKlUCMc,1045
131
+ onnx_diagnostic-0.8.2.dist-info/METADATA,sha256=JbEdP7KIm9D1xwdr9Hot2BNxC2ZX9_YeBkdo6oy6UvQ,6734
132
+ onnx_diagnostic-0.8.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
133
+ onnx_diagnostic-0.8.2.dist-info/top_level.txt,sha256=KwNkXewmcobM3ZT1DJLVWH6ebJzA5qKg7cWqKfpGNT4,16
134
+ onnx_diagnostic-0.8.2.dist-info/RECORD,,