onnx-diagnostic 0.7.9__py3-none-any.whl → 0.7.10__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.
@@ -3,5 +3,5 @@ Patches, Investigates onnx models.
3
3
  Functions, classes to dig into a model when this one is right, slow, wrong...
4
4
  """
5
5
 
6
- __version__ = "0.7.9"
6
+ __version__ = "0.7.10"
7
7
  __author__ = "Xavier Dupré"
@@ -270,7 +270,7 @@ def make_static_cache(
270
270
  self.num_attention_heads = key_value_pairs[0][0].shape[1]
271
271
  self.num_hidden_layers = len(key_value_pairs)
272
272
 
273
- def get_text_config(self):
273
+ def get_text_config(self, *args, **kwargs):
274
274
  return self
275
275
 
276
276
  assert max_cache_len is not None, (
@@ -366,7 +366,7 @@ def make_mamba_cache(key_value_pairs: List[Tuple[torch.Tensor, torch.Tensor]]) -
366
366
  self.num_hidden_layers = len(key_value_pairs)
367
367
  self.dtype = dtype
368
368
 
369
- def get_text_config(self):
369
+ def get_text_config(self, *args, **kwargs):
370
370
  return self
371
371
 
372
372
  cache = MambaCache(
@@ -409,7 +409,7 @@ def make_sliding_window_cache(
409
409
  self.num_hidden_layers = len(key_value_pairs)
410
410
  self.sliding_window = key_value_pairs[0][0].shape[2]
411
411
 
412
- def get_text_config(self):
412
+ def get_text_config(self, *args, **kwargs):
413
413
  return self
414
414
 
415
415
  cache = transformers.cache_utils.SlidingWindowCache(
@@ -577,7 +577,7 @@ def make_hybrid_cache(
577
577
  sliding_window = _sliding_window
578
578
  num_key_value_heads = key_value_pairs[0][1].shape[1] # transformers 4.48.3
579
579
 
580
- def get_text_config(self):
580
+ def get_text_config(self, *args, **kwargs):
581
581
  return self
582
582
 
583
583
  if layer_types:
@@ -774,6 +774,14 @@ def string_type(
774
774
  return f"{obj.__class__.__name__}(**{s})"
775
775
  if obj.__class__.__name__ in {"TorchModelContainer", "InferenceSession"}:
776
776
  return f"{obj.__class__.__name__}(...)"
777
+ if obj.__class__.__name__ == "Results":
778
+ import ultralytics
779
+
780
+ assert isinstance(
781
+ obj, ultralytics.engine.results.Results
782
+ ), f"Unexpected type={type(obj)}"
783
+ return f"ultralytics.{obj.__class__.__name__}(...)"
784
+
777
785
  if verbose:
778
786
  print(f"[string_type] END:{type(obj)}")
779
787
  raise AssertionError(f"Unsupported type {type(obj).__name__!r} - {type(obj)}")
@@ -1186,7 +1186,7 @@ def shadowing_names(
1186
1186
  shadow |= set(i.name for i in g.input) & shadow_context
1187
1187
  shadow |= set(i.name for i in g.initializer) & shadow_context
1188
1188
  shadow |= set(i.name for i in g.sparse_initializer) & shadow_context
1189
- s, ps, c = shadowing_names(
1189
+ s, _ps, c = shadowing_names(
1190
1190
  g.node, verbose=verbose, existing=existing, shadow_context=existing
1191
1191
  )
1192
1192
  shadow |= s
@@ -543,7 +543,7 @@ def dummy_llm(
543
543
  )
544
544
 
545
545
  def forward(self, x):
546
- B, T, C = x.shape
546
+ _B, T, C = x.shape
547
547
 
548
548
  query = self.query(x)
549
549
  key = self.key(x)
@@ -721,9 +721,10 @@ def to_any(value: Any, to_value: Union[torch.dtype, torch.device, str]) -> Any:
721
721
  return {to_any(t, to_value) for t in value}
722
722
  if type(value) is dict:
723
723
  return {k: to_any(t, to_value) for k, t in value.items()}
724
- if value.__class__.__name__ == "DynamicCache":
724
+ if value.__class__.__name__ in {"DynamicCache", "HybridCache"}:
725
+ make = dict(DynamicCache=make_dynamic_cache, HybridCache=make_hybrid_cache)
725
726
  cc = CacheKeyValue(value)
726
- return make_dynamic_cache(
727
+ return make[value.__class__.__name__]( # type: ignore[operator]
727
728
  list(
728
729
  zip(
729
730
  [t.to(to_value) if t is not None else t for t in cc.key_cache],
@@ -822,6 +823,15 @@ def torch_deepcopy(value: Any) -> Any:
822
823
  new_args = torch_deepcopy(args)
823
824
  return torch.utils._pytree.tree_unflatten(new_args, spec)
824
825
 
826
+ if value.__class__.__name__ == "Results":
827
+ import copy
828
+ import ultralytics
829
+
830
+ assert isinstance(
831
+ value, ultralytics.engine.results.Results
832
+ ), f"Unexpected type={type(value)}"
833
+ return copy.deepcopy(value)
834
+
825
835
  # We should have a code using serialization, deserialization assuming a model
826
836
  # cannot be exported without them.
827
837
  raise NotImplementedError(f"torch_deepcopy not implemented for type {type(value)}")
@@ -856,7 +866,7 @@ def torch_tensor_size(value: Any) -> Any:
856
866
  if value.__class__.__name__ == "MambaCache":
857
867
  return torch_tensor_size(value.conv_states) + torch_tensor_size(value.ssm_states)
858
868
  if value.__class__ in torch.utils._pytree.SUPPORTED_NODES:
859
- args, spec = torch.utils._pytree.tree_flatten(value)
869
+ args, _spec = torch.utils._pytree.tree_flatten(value)
860
870
  return sum(torch_tensor_size(a) for a in args)
861
871
 
862
872
  # We should have a code using serialization, deserialization assuming a model
@@ -26,11 +26,11 @@ class Scan(_Scan):
26
26
  ):
27
27
  (
28
28
  num_loop_state_vars,
29
- num_scan_outputs,
30
- output_directions,
31
- max_dir_out,
32
- output_axes,
33
- max_axe_out,
29
+ _num_scan_outputs,
30
+ _output_directions,
31
+ _max_dir_out,
32
+ _output_axes,
33
+ _max_axe_out,
34
34
  state_names_in,
35
35
  state_names_out,
36
36
  scan_names_in,
@@ -562,7 +562,7 @@ class OnnxruntimeEvaluator:
562
562
  if key in self._cache:
563
563
  sess = self._cache[key][1]
564
564
  else:
565
- self._cache[key] = onx, sess = self._get_sess_if(node, name, inputs, results)
565
+ self._cache[key] = _onx, sess = self._get_sess_if(node, name, inputs, results)
566
566
 
567
567
  assert hasattr(sess, "run"), f"Missing method run for type {type(sess)}"
568
568
  feeds = {name: results[name] for name in sess.input_names}
@@ -616,7 +616,7 @@ class OnnxruntimeEvaluator:
616
616
  if key in self._cache:
617
617
  sess = self._cache[key][1]
618
618
  else:
619
- self._cache[key] = onx, sess = self._get_sess_scan(node, name, inputs, results)
619
+ self._cache[key] = _onx, sess = self._get_sess_scan(node, name, inputs, results)
620
620
 
621
621
  assert hasattr(sess, "run"), f"Missing method run for type {type(sess)}"
622
622
  feeds = {name: results[name] for name in sess.input_names}
@@ -384,7 +384,7 @@ class ControlFlowScan(torch.nn.Module):
384
384
 
385
385
  def forward(self, x):
386
386
  init = torch.zeros_like(x[0])
387
- carry, out = torch.ops.higher_order.scan(
387
+ carry, _out = torch.ops.higher_order.scan(
388
388
  ControlFlowScan.add, [init], [x], additional_inputs=[]
389
389
  )
390
390
  return carry
@@ -429,7 +429,7 @@ class ControlFlowScanCDist(torch.nn.Module):
429
429
  return [carry.clone(), rd]
430
430
 
431
431
  def forward(self, x):
432
- carry, out = torch.ops.higher_order.scan(
432
+ _carry, out = torch.ops.higher_order.scan(
433
433
  ControlFlowScanCDist.dist,
434
434
  [x],
435
435
  [x],
@@ -483,7 +483,7 @@ class ControlFlowScanCDistXY(torch.nn.Module):
483
483
  return [y.clone(), rd]
484
484
 
485
485
  def forward(self, x, y):
486
- carry, out = torch.ops.higher_order.scan(
486
+ _carry, out = torch.ops.higher_order.scan(
487
487
  ControlFlowScanCDistXY.dist,
488
488
  [y],
489
489
  [x],
@@ -439,6 +439,28 @@ def torch_export_patches(
439
439
  f_transformers__vmap_for_bhqkv = masking_utils._vmap_for_bhqkv
440
440
  masking_utils._vmap_for_bhqkv = patch_transformers_list.patched__vmap_for_bhqkv
441
441
 
442
+ if verbose:
443
+ print(
444
+ "[torch_export_patches] patches "
445
+ "transformers.masking_utils.sdpa_mask_recent_torch"
446
+ )
447
+ f_transformers_sdpa_mask_recent_torch = masking_utils.sdpa_mask_recent_torch
448
+ masking_utils.sdpa_mask_recent_torch = (
449
+ patch_transformers_list.patched_sdpa_mask_recent_torch
450
+ )
451
+ if masking_utils.sdpa_mask == f_transformers_sdpa_mask_recent_torch:
452
+ if verbose:
453
+ print(
454
+ "[torch_export_patches] patches "
455
+ "transformers.masking_utils.sdpa_mask"
456
+ )
457
+ f_transformers_sdpa_mask = masking_utils.sdpa_mask
458
+ masking_utils.sdpa_mask = (
459
+ patch_transformers_list.patched_sdpa_mask_recent_torch
460
+ )
461
+ else:
462
+ f_transformers_sdpa_mask = None
463
+
442
464
  if (
443
465
  masking_utils
444
466
  and patch_transformers_list.patch_masking_utils
@@ -456,10 +478,37 @@ def torch_export_patches(
456
478
  and masking_utils.ALL_MASK_ATTENTION_FUNCTIONS["eager"]
457
479
  == f_transformers_eager_mask
458
480
  ):
481
+ if verbose:
482
+ print(
483
+ "[torch_export_patches] patches "
484
+ "transformers.masking_utils.eager_mask "
485
+ "in ALL_MASK_ATTENTION_FUNCTIONS"
486
+ )
459
487
  masking_utils.ALL_MASK_ATTENTION_FUNCTIONS["eager"] = (
460
488
  patch_transformers_list.patched_eager_mask
461
489
  )
462
490
 
491
+ if (
492
+ masking_utils
493
+ and patch_transformers_list.patch_masking_utils
494
+ and hasattr(masking_utils, "sdpa_mask")
495
+ and f_transformers_sdpa_mask is not None
496
+ ):
497
+ if verbose:
498
+ print(
499
+ "[torch_export_patches] patches "
500
+ "transformers.masking_utils.sdpa_mask "
501
+ "in ALL_MASK_ATTENTION_FUNCTIONS"
502
+ )
503
+ if (
504
+ "sdpa" in masking_utils.ALL_MASK_ATTENTION_FUNCTIONS
505
+ and masking_utils.ALL_MASK_ATTENTION_FUNCTIONS["sdpa"]
506
+ == f_transformers_sdpa_mask
507
+ ):
508
+ masking_utils.ALL_MASK_ATTENTION_FUNCTIONS["sdpa"] = (
509
+ patch_transformers_list.patched_sdpa_mask_recent_torch
510
+ )
511
+
463
512
  if custom_patches:
464
513
  if verbose:
465
514
  print("[torch_export_patches] applies custom patches")
@@ -568,12 +617,31 @@ def torch_export_patches(
568
617
  and hasattr(masking_utils, "_vmap_for_bhqkv")
569
618
  ):
570
619
  masking_utils._vmap_for_bhqkv = f_transformers__vmap_for_bhqkv
620
+
571
621
  if verbose:
572
622
  print(
573
623
  "[torch_export_patches] restored "
574
624
  "transformers.masking_utils._vmap_for_bhqkv"
575
625
  )
576
626
 
627
+ masking_utils.sdpa_mask_recent_torch = (
628
+ f_transformers_sdpa_mask_recent_torch
629
+ )
630
+
631
+ if verbose:
632
+ print(
633
+ "[torch_export_patches] restored "
634
+ "transformers.masking_utils.sdpa_mask_recent_torch"
635
+ )
636
+
637
+ if f_transformers_sdpa_mask is not None:
638
+ masking_utils.sdpa_mask = f_transformers_sdpa_mask
639
+ if verbose:
640
+ print(
641
+ "[torch_export_patches] restored "
642
+ "transformers.masking_utils.sdpa_mask"
643
+ )
644
+
577
645
  if (
578
646
  masking_utils
579
647
  and patch_transformers_list.patch_masking_utils
@@ -581,6 +649,11 @@ def torch_export_patches(
581
649
  ):
582
650
  f_transformers_eager_mask = masking_utils.eager_mask
583
651
  masking_utils.eager_mask = f_transformers_eager_mask
652
+ if verbose:
653
+ print(
654
+ "[torch_export_patches] restored "
655
+ "transformers.masking_utils.eager_mask"
656
+ )
584
657
  if (
585
658
  "eager" in masking_utils.ALL_MASK_ATTENTION_FUNCTIONS
586
659
  and masking_utils.ALL_MASK_ATTENTION_FUNCTIONS["eager"]
@@ -589,11 +662,32 @@ def torch_export_patches(
589
662
  masking_utils.ALL_MASK_ATTENTION_FUNCTIONS["eager"] = (
590
663
  f_transformers_eager_mask
591
664
  )
592
- if verbose:
593
- print(
594
- "[torch_export_patches] restored "
595
- "transformers.masking_utils.eager_mask"
665
+ if verbose:
666
+ print(
667
+ "[torch_export_patches] restored "
668
+ "transformers.masking_utils.eager_mask "
669
+ "in ALL_MASK_ATTENTION_FUNCTIONS"
670
+ )
671
+
672
+ if (
673
+ masking_utils
674
+ and patch_transformers_list.patch_masking_utils
675
+ and hasattr(masking_utils, "sdpa_mask")
676
+ ):
677
+ if (
678
+ "sdpa" in masking_utils.ALL_MASK_ATTENTION_FUNCTIONS
679
+ and masking_utils.ALL_MASK_ATTENTION_FUNCTIONS["sdpa"]
680
+ == patch_transformers_list.patched_sdpa_mask_recent_torch
681
+ ):
682
+ masking_utils.ALL_MASK_ATTENTION_FUNCTIONS["sdpa"] = (
683
+ f_transformers_sdpa_mask
596
684
  )
685
+ if verbose:
686
+ print(
687
+ "[torch_export_patches] restored "
688
+ "transformers.masking_utils.sdpa_mask "
689
+ "in ALL_MASK_ATTENTION_FUNCTIONS"
690
+ )
597
691
 
598
692
  ########
599
693
  # caches
@@ -37,7 +37,13 @@ from ...helpers.torch_helper import is_torchdynamo_exporting
37
37
 
38
38
  if patch_masking_utils:
39
39
  # Introduced in 4.52
40
- from transformers.masking_utils import causal_mask_function, sdpa_mask
40
+ from transformers.masking_utils import (
41
+ causal_mask_function,
42
+ padding_mask_function,
43
+ and_masks,
44
+ _ignore_causal_mask_sdpa,
45
+ prepare_padding_mask,
46
+ )
41
47
 
42
48
  def patched__vmap_for_bhqkv(mask_function: Callable, bh_indices: bool = True) -> Callable:
43
49
  """manual patch for function ``transformers.masking_utils._vmap_for_bhqkv``."""
@@ -105,7 +111,7 @@ if patch_masking_utils:
105
111
  """manual patch for function ``transformers.masking_utils.eager_mask``."""
106
112
  # The masks for eager attention are simply boolean mask from sdpa, casted to 0 and -inf
107
113
  _ = kwargs.pop("allow_is_causal_skip", None)
108
- mask = sdpa_mask(
114
+ mask = patched_sdpa_mask_recent_torch(
109
115
  batch_size=batch_size,
110
116
  cache_position=cache_position,
111
117
  kv_length=kv_length,
@@ -125,6 +131,35 @@ if patch_masking_utils:
125
131
  mask = (~mask).to(dtype) * min_dtype
126
132
  return mask
127
133
 
134
+ def patched_sdpa_mask_recent_torch(
135
+ batch_size: int,
136
+ cache_position: torch.Tensor,
137
+ kv_length: int,
138
+ kv_offset: int = 0,
139
+ mask_function: Callable = causal_mask_function,
140
+ attention_mask: Optional[torch.Tensor] = None,
141
+ local_size: Optional[int] = None,
142
+ allow_is_causal_skip: bool = True,
143
+ **kwargs,
144
+ ) -> Optional[torch.Tensor]:
145
+ """manual patch for function ``transformers.masking_utils.sdpa_mask_recent_torch``."""
146
+ q_length = cache_position.shape[0]
147
+ padding_mask = prepare_padding_mask(attention_mask, kv_length, kv_offset, _slice=False)
148
+ if allow_is_causal_skip and _ignore_causal_mask_sdpa(
149
+ padding_mask, q_length, kv_length, kv_offset, local_size
150
+ ):
151
+ return None
152
+ kv_arange = torch.arange(kv_length, device=cache_position.device)
153
+ kv_arange += kv_offset
154
+ if padding_mask is not None:
155
+ mask_function = and_masks(mask_function, padding_mask_function(padding_mask))
156
+ batch_arange = torch.arange(batch_size, device=cache_position.device)
157
+ head_arange = torch.arange(1, device=cache_position.device)
158
+ causal_mask = patched__vmap_for_bhqkv(mask_function)(
159
+ batch_arange, head_arange, cache_position, kv_arange
160
+ )
161
+ return causal_mask
162
+
128
163
 
129
164
  if patch_parse_processor_args:
130
165
 
@@ -218,7 +218,6 @@ def unflatten_sliding_window_cache(
218
218
  values: List[Any], context: torch.utils._pytree.Context, output_type=None
219
219
  ) -> SlidingWindowCache:
220
220
  """Restores a :class:`transformers.cache_utils.SlidingWindowCache` from python objects."""
221
- key_cache, value_cache = values
222
221
  return make_sliding_window_cache(list(zip(values[0], values[1])))
223
222
 
224
223
 
@@ -11,6 +11,7 @@ __data_arch__ = textwrap.dedent(
11
11
  """
12
12
  architecture,task
13
13
  ASTModel,feature-extraction
14
+ AutoencoderKL,image-to-image
14
15
  AlbertModel,feature-extraction
15
16
  BeitForImageClassification,image-classification
16
17
  BartForConditionalGeneration,summarization
@@ -154,6 +155,7 @@ __data_arch__ = textwrap.dedent(
154
155
  Wav2Vec2ForCTC,automatic-speech-recognition
155
156
  YolosForObjectDetection,object-detection
156
157
  YolosModel,image-feature-extraction
158
+ Alibaba-NLP/gte-large-en-v1.5,sentence-similarity
157
159
  emilyalsentzer/Bio_ClinicalBERT,fill-mask"""
158
160
  )
159
161
 
@@ -4687,3 +4687,145 @@ def _ccached_zai_glm_45():
4687
4687
  },
4688
4688
  }
4689
4689
  )
4690
+
4691
+
4692
+ def _ccached_microsoft_phi3_mini_128k_instruct():
4693
+ "microsoft/Phi-3-mini-128k-instruct"
4694
+ return transformers.Phi3Config(
4695
+ **{
4696
+ "_name_or_path": "Phi-3-mini-128k-instruct",
4697
+ "architectures": ["Phi3ForCausalLM"],
4698
+ "attention_dropout": 0.0,
4699
+ "auto_map": {
4700
+ "AutoConfig": "configuration_phi3.Phi3Config",
4701
+ "AutoModelForCausalLM": "modeling_phi3.Phi3ForCausalLM",
4702
+ },
4703
+ "bos_token_id": 1,
4704
+ "embd_pdrop": 0.0,
4705
+ "eos_token_id": 32000,
4706
+ "hidden_act": "silu",
4707
+ "hidden_size": 3072,
4708
+ "initializer_range": 0.02,
4709
+ "intermediate_size": 8192,
4710
+ "max_position_embeddings": 131072,
4711
+ "model_type": "phi3",
4712
+ "num_attention_heads": 32,
4713
+ "num_hidden_layers": 32,
4714
+ "num_key_value_heads": 32,
4715
+ "original_max_position_embeddings": 4096,
4716
+ "pad_token_id": 32000,
4717
+ "resid_pdrop": 0.0,
4718
+ "rms_norm_eps": 1e-05,
4719
+ "rope_scaling": {
4720
+ "long_factor": [
4721
+ 1.0700000524520874,
4722
+ 1.1200000047683716,
4723
+ 1.149999976158142,
4724
+ 1.4199999570846558,
4725
+ 1.5699999332427979,
4726
+ 1.7999999523162842,
4727
+ 2.129999876022339,
4728
+ 2.129999876022339,
4729
+ 3.009999990463257,
4730
+ 5.910000324249268,
4731
+ 6.950000286102295,
4732
+ 9.070000648498535,
4733
+ 9.930000305175781,
4734
+ 10.710000038146973,
4735
+ 11.130000114440918,
4736
+ 14.609999656677246,
4737
+ 15.409998893737793,
4738
+ 19.809999465942383,
4739
+ 37.279998779296875,
4740
+ 38.279998779296875,
4741
+ 38.599998474121094,
4742
+ 40.12000274658203,
4743
+ 46.20000457763672,
4744
+ 50.940006256103516,
4745
+ 53.66000747680664,
4746
+ 54.9373893737793,
4747
+ 56.89738845825195,
4748
+ 57.28738784790039,
4749
+ 59.98738479614258,
4750
+ 60.86738586425781,
4751
+ 60.887386322021484,
4752
+ 61.71739196777344,
4753
+ 62.91739273071289,
4754
+ 62.957393646240234,
4755
+ 63.41739273071289,
4756
+ 63.8173942565918,
4757
+ 63.83739471435547,
4758
+ 63.897396087646484,
4759
+ 63.93739700317383,
4760
+ 64.06739807128906,
4761
+ 64.11434936523438,
4762
+ 64.12435150146484,
4763
+ 64.15435028076172,
4764
+ 64.19435119628906,
4765
+ 64.24435424804688,
4766
+ 64.57435607910156,
4767
+ 64.69000244140625,
4768
+ 64.76000213623047,
4769
+ ],
4770
+ "short_factor": [
4771
+ 1.1,
4772
+ 1.1,
4773
+ 1.1,
4774
+ 1.3000000000000003,
4775
+ 1.3500000000000003,
4776
+ 1.3500000000000003,
4777
+ 1.4000000000000004,
4778
+ 1.5500000000000005,
4779
+ 2.000000000000001,
4780
+ 2.000000000000001,
4781
+ 2.000000000000001,
4782
+ 2.000000000000001,
4783
+ 2.000000000000001,
4784
+ 2.000000000000001,
4785
+ 2.000000000000001,
4786
+ 2.000000000000001,
4787
+ 2.000000000000001,
4788
+ 2.000000000000001,
4789
+ 2.000000000000001,
4790
+ 2.000000000000001,
4791
+ 2.000000000000001,
4792
+ 2.000000000000001,
4793
+ 2.000000000000001,
4794
+ 2.000000000000001,
4795
+ 2.000000000000001,
4796
+ 2.0500000000000007,
4797
+ 2.0500000000000007,
4798
+ 2.0500000000000007,
4799
+ 2.0500000000000007,
4800
+ 2.0500000000000007,
4801
+ 2.0500000000000007,
4802
+ 2.1000000000000005,
4803
+ 2.1000000000000005,
4804
+ 2.1500000000000004,
4805
+ 2.25,
4806
+ 2.25,
4807
+ 2.25,
4808
+ 2.25,
4809
+ 2.25,
4810
+ 2.3999999999999995,
4811
+ 2.4499999999999993,
4812
+ 2.499999999999999,
4813
+ 2.6999999999999984,
4814
+ 2.6999999999999984,
4815
+ 2.7499999999999982,
4816
+ 2.799999999999998,
4817
+ 2.8999999999999977,
4818
+ 3.049999999999997,
4819
+ ],
4820
+ "type": "longrope",
4821
+ },
4822
+ "rope_theta": 10000.0,
4823
+ "sliding_window": 262144,
4824
+ "tie_word_embeddings": false,
4825
+ "torch_dtype": "bfloat16",
4826
+ "transformers_version": "4.40.2",
4827
+ "use_cache": true,
4828
+ "attention_bias": false,
4829
+ "vocab_size": 32064,
4830
+ }
4831
+ )
@@ -8,6 +8,7 @@ import transformers
8
8
  from ...helpers.config_helper import update_config, build_diff_config
9
9
  from ...tasks import reduce_model_config, random_input_kwargs
10
10
  from .hub_api import task_from_arch, task_from_id, get_pretrained_config, download_code_modelid
11
+ from .model_specific import HANDLED_MODELS, load_specific_model
11
12
 
12
13
 
13
14
  def _code_needing_rewriting(model: Any) -> Any:
@@ -73,7 +74,7 @@ def get_untrained_model_with_inputs(
73
74
  print("-- configuration:", pprint.pformat(data['configuration']))
74
75
  """
75
76
  assert not use_preinstalled or not use_only_preinstalled, (
76
- f"model_id={model_id!r}, pretinstalled model is only available "
77
+ f"model_id={model_id!r}, preinstalled model is only available "
77
78
  f"if use_only_preinstalled is False."
78
79
  )
79
80
  if verbose:
@@ -89,145 +90,156 @@ def get_untrained_model_with_inputs(
89
90
  **(model_kwargs or {}),
90
91
  )
91
92
 
92
- if hasattr(config, "architecture") and config.architecture:
93
- archs = [config.architecture]
94
- if type(config) is dict:
95
- assert "_class_name" in config, f"Unable to get the architecture from config={config}"
96
- archs = [config["_class_name"]]
97
- else:
98
- archs = config.architectures # type: ignore
99
- task = None
100
- if archs is None:
101
- task = task_from_id(model_id)
102
- assert task is not None or (archs is not None and len(archs) == 1), (
103
- f"Unable to determine the architecture for model {model_id!r}, "
104
- f"architectures={archs!r}, conf={config}"
105
- )
106
- if verbose:
107
- print(f"[get_untrained_model_with_inputs] architectures={archs!r}")
108
- print(f"[get_untrained_model_with_inputs] cls={config.__class__.__name__!r}")
109
- if task is None:
110
- task = task_from_arch(archs[0], model_id=model_id, subfolder=subfolder)
111
- if verbose:
112
- print(f"[get_untrained_model_with_inputs] task={task!r}")
93
+ model, task, mkwargs, diff_config = None, None, {}, None
94
+ if use_pretrained and same_as_pretrained:
95
+ if model_id in HANDLED_MODELS:
96
+ model, task, config = load_specific_model(model_id, verbose=verbose)
113
97
 
114
- # model kwagrs
115
- if dynamic_rope is not None:
116
- assert (
117
- type(config) is not dict
118
- ), f"Unable to set dynamic_rope if the configuration is a dictionary\n{config}"
119
- assert hasattr(config, "rope_scaling"), f"Missing 'rope_scaling' in\n{config}"
120
- config.rope_scaling = (
121
- {"rope_type": "dynamic", "factor": 10.0} if dynamic_rope else None
98
+ if model is None:
99
+ if hasattr(config, "architecture") and config.architecture:
100
+ archs = [config.architecture]
101
+ if type(config) is dict:
102
+ assert (
103
+ "_class_name" in config
104
+ ), f"Unable to get the architecture from config={config}"
105
+ archs = [config["_class_name"]]
106
+ else:
107
+ archs = config.architectures # type: ignore
108
+ task = None
109
+ if archs is None:
110
+ task = task_from_id(model_id)
111
+ assert task is not None or (archs is not None and len(archs) == 1), (
112
+ f"Unable to determine the architecture for model {model_id!r}, "
113
+ f"architectures={archs!r}, conf={config}"
122
114
  )
115
+ if verbose:
116
+ print(f"[get_untrained_model_with_inputs] architectures={archs!r}")
117
+ print(f"[get_untrained_model_with_inputs] cls={config.__class__.__name__!r}")
118
+ if task is None:
119
+ task = task_from_arch(archs[0], model_id=model_id, subfolder=subfolder)
120
+ if verbose:
121
+ print(f"[get_untrained_model_with_inputs] task={task!r}")
122
+
123
+ # model kwagrs
124
+ if dynamic_rope is not None:
125
+ assert (
126
+ type(config) is not dict
127
+ ), f"Unable to set dynamic_rope if the configuration is a dictionary\n{config}"
128
+ assert hasattr(config, "rope_scaling"), f"Missing 'rope_scaling' in\n{config}"
129
+ config.rope_scaling = (
130
+ {"rope_type": "dynamic", "factor": 10.0} if dynamic_rope else None
131
+ )
123
132
 
124
- # updating the configuration
125
- config0 = copy.deepcopy(config)
126
- mkwargs = reduce_model_config(config, task) if not same_as_pretrained else {}
127
- if model_kwargs:
128
- for k, v in model_kwargs.items():
129
- if isinstance(v, dict):
130
- if k in mkwargs:
131
- mkwargs[k].update(v)
133
+ # updating the configuration
134
+ config0 = copy.deepcopy(config)
135
+ mkwargs = reduce_model_config(config, task) if not same_as_pretrained else {}
136
+ if model_kwargs:
137
+ for k, v in model_kwargs.items():
138
+ if isinstance(v, dict):
139
+ if k in mkwargs:
140
+ mkwargs[k].update(v)
141
+ else:
142
+ mkwargs[k] = v
132
143
  else:
133
144
  mkwargs[k] = v
134
- else:
135
- mkwargs[k] = v
136
- if mkwargs:
137
- update_config(config, mkwargs)
138
- try:
139
- diff_config = build_diff_config(config0, config)
140
- except (ValueError, AttributeError, TypeError) as e:
141
- diff_config = f"DIFF CONFIG ERROR {e}"
142
- if verbose:
143
- if diff_config:
144
- print("[get_untrained_model_with_inputs] -- updated config")
145
- pprint.pprint(diff_config)
146
- print("[get_untrained_model_with_inputs] --")
147
-
148
- # SDPA
149
- if model_kwargs and "attn_implementation" in model_kwargs:
150
- if hasattr(config, "_attn_implementation_autoset"):
151
- config._attn_implementation_autoset = False
152
- config._attn_implementation = model_kwargs["attn_implementation"] # type: ignore[union-attr]
145
+ if mkwargs:
146
+ update_config(config, mkwargs)
147
+ try:
148
+ diff_config = build_diff_config(config0, config)
149
+ except (ValueError, AttributeError, TypeError) as e:
150
+ diff_config = f"DIFF CONFIG ERROR {e}"
153
151
  if verbose:
152
+ if diff_config:
153
+ print("[get_untrained_model_with_inputs] -- updated config")
154
+ pprint.pprint(diff_config)
155
+ print("[get_untrained_model_with_inputs] --")
156
+
157
+ # SDPA
158
+ if model_kwargs and "attn_implementation" in model_kwargs:
159
+ if hasattr(config, "_attn_implementation_autoset"):
160
+ config._attn_implementation_autoset = False
161
+ config._attn_implementation = model_kwargs["attn_implementation"] # type: ignore[union-attr]
162
+ if verbose:
163
+ print(
164
+ f"[get_untrained_model_with_inputs] config._attn_implementation="
165
+ f"{config._attn_implementation!r}" # type: ignore[union-attr]
166
+ )
167
+ elif verbose:
154
168
  print(
155
- f"[get_untrained_model_with_inputs] config._attn_implementation="
156
- f"{config._attn_implementation!r}" # type: ignore[union-attr]
169
+ f"[get_untrained_model_with_inputs] default config._attn_implementation="
170
+ f"{getattr(config, '_attn_implementation', '?')!r}" # type: ignore[union-attr]
157
171
  )
158
- elif verbose:
159
- print(
160
- f"[get_untrained_model_with_inputs] default config._attn_implementation="
161
- f"{getattr(config, '_attn_implementation', '?')!r}" # type: ignore[union-attr]
162
- )
163
-
164
- if type(config) is dict and "_diffusers_version" in config:
165
- import diffusers
166
172
 
167
- package_source = diffusers
168
- else:
169
- package_source = transformers
173
+ if type(config) is dict and "_diffusers_version" in config:
174
+ import diffusers
170
175
 
171
- if use_pretrained:
172
- model = transformers.AutoModel.from_pretrained(model_id, **mkwargs)
173
- else:
174
- if archs is not None:
175
- try:
176
- cls_model = getattr(package_source, archs[0])
177
- except AttributeError as e:
178
- # The code of the models is not in transformers but in the
179
- # repository of the model. We need to download it.
180
- pyfiles = download_code_modelid(model_id, verbose=verbose)
181
- if pyfiles:
182
- if "." in archs[0]:
183
- cls_name = archs[0]
184
- else:
185
- modeling = [_ for _ in pyfiles if "/modeling_" in _]
186
- assert len(modeling) == 1, (
187
- f"Unable to guess the main file implemented class {archs[0]!r} "
188
- f"from {pyfiles}, found={modeling}."
189
- )
190
- last_name = os.path.splitext(os.path.split(modeling[0])[-1])[0]
191
- cls_name = f"{last_name}.{archs[0]}"
192
- if verbose:
193
- print(
194
- f"[get_untrained_model_with_inputs] custom code for {cls_name!r}"
195
- )
196
- print(
197
- f"[get_untrained_model_with_inputs] from folder "
198
- f"{os.path.split(pyfiles[0])[0]!r}"
199
- )
200
- cls_model = (
201
- transformers.dynamic_module_utils.get_class_from_dynamic_module(
202
- cls_name,
203
- pretrained_model_name_or_path=os.path.split(pyfiles[0])[0],
204
- )
205
- )
206
- else:
207
- raise AttributeError(
208
- f"Unable to find class 'tranformers.{archs[0]}'. "
209
- f"The code needs to be downloaded, config="
210
- f"\n{pprint.pformat(config)}."
211
- ) from e
176
+ package_source = diffusers
212
177
  else:
213
- assert same_as_pretrained and use_pretrained, (
214
- f"Model {model_id!r} cannot be built, the model cannot be built. "
215
- f"It must be downloaded. Use same_as_pretrained=True "
216
- f"and use_pretrained=True."
217
- )
178
+ package_source = transformers
218
179
 
219
- try:
220
- if type(config) is dict:
221
- model = cls_model(**config)
180
+ if use_pretrained:
181
+ model = transformers.AutoModel.from_pretrained(
182
+ model_id, trust_remote_code=True, **mkwargs
183
+ )
184
+ else:
185
+ if archs is not None:
186
+ try:
187
+ cls_model = getattr(package_source, archs[0])
188
+ except AttributeError as e:
189
+ # The code of the models is not in transformers but in the
190
+ # repository of the model. We need to download it.
191
+ pyfiles = download_code_modelid(model_id, verbose=verbose)
192
+ if pyfiles:
193
+ if "." in archs[0]:
194
+ cls_name = archs[0]
195
+ else:
196
+ modeling = [_ for _ in pyfiles if "/modeling_" in _]
197
+ assert len(modeling) == 1, (
198
+ f"Unable to guess the main file implemented class "
199
+ f"{archs[0]!r} from {pyfiles}, found={modeling}."
200
+ )
201
+ last_name = os.path.splitext(os.path.split(modeling[0])[-1])[0]
202
+ cls_name = f"{last_name}.{archs[0]}"
203
+ if verbose:
204
+ print(
205
+ f"[get_untrained_model_with_inputs] "
206
+ f"custom code for {cls_name!r}"
207
+ )
208
+ print(
209
+ f"[get_untrained_model_with_inputs] from folder "
210
+ f"{os.path.split(pyfiles[0])[0]!r}"
211
+ )
212
+ cls_model = (
213
+ transformers.dynamic_module_utils.get_class_from_dynamic_module(
214
+ cls_name,
215
+ pretrained_model_name_or_path=os.path.split(pyfiles[0])[0],
216
+ )
217
+ )
218
+ else:
219
+ raise AttributeError(
220
+ f"Unable to find class 'tranformers.{archs[0]}'. "
221
+ f"The code needs to be downloaded, config="
222
+ f"\n{pprint.pformat(config)}."
223
+ ) from e
222
224
  else:
223
- model = cls_model(config)
224
- except RuntimeError as e:
225
- raise RuntimeError(
226
- f"Unable to instantiate class {cls_model.__name__} with\n{config}"
227
- ) from e
225
+ assert same_as_pretrained and use_pretrained, (
226
+ f"Model {model_id!r} cannot be built, the model cannot be built. "
227
+ f"It must be downloaded. Use same_as_pretrained=True "
228
+ f"and use_pretrained=True."
229
+ )
230
+
231
+ try:
232
+ if type(config) is dict:
233
+ model = cls_model(**config)
234
+ else:
235
+ model = cls_model(config)
236
+ except RuntimeError as e:
237
+ raise RuntimeError(
238
+ f"Unable to instantiate class {cls_model.__name__} with\n{config}"
239
+ ) from e
228
240
 
229
241
  # input kwargs
230
- kwargs, fct = random_input_kwargs(config, task)
242
+ kwargs, fct = random_input_kwargs(config, task) # type: ignore[arg-type]
231
243
  if verbose:
232
244
  print(f"[get_untrained_model_with_inputs] use fct={fct}")
233
245
  if os.environ.get("PRINT_CONFIG") in (1, "1"):
@@ -243,7 +255,8 @@ def get_untrained_model_with_inputs(
243
255
 
244
256
  res["input_kwargs"] = kwargs
245
257
  res["model_kwargs"] = mkwargs
246
- res["dump_info"] = dict(config_diff=diff_config)
258
+ if diff_config is not None:
259
+ res["dump_info"] = dict(config_diff=diff_config)
247
260
 
248
261
  sizes = compute_model_size(model)
249
262
  res["model"] = model
@@ -0,0 +1,49 @@
1
+ from typing import Any, Dict, Tuple
2
+
3
+
4
+ class SpecificConfig:
5
+ """Creates a specific configuration for the loaded model."""
6
+
7
+ def __init__(self, **kwargs):
8
+ self._atts = set(kwargs)
9
+ for k, v in kwargs.items():
10
+ setattr(self, k, v)
11
+
12
+ def to_dict(self) -> Dict[str, Any]:
13
+ return {k: getattr(self, k) for k in self._atts if k != "_atts"}
14
+
15
+
16
+ def load_specific_model(
17
+ model_id: str, verbose: int = 0, **kwargs
18
+ ) -> Tuple[Any, str, SpecificConfig]:
19
+ """
20
+ Some models do not have any generic to be loaded.
21
+ This functions
22
+
23
+ :param model_id: model id
24
+ :param verbose: verbosiy
25
+ :param kwargs: additional parameters
26
+ :return: the model, the task associated to it, a configuration
27
+ """
28
+ assert model_id in HANDLED_MODELS, (
29
+ f"Unable to load model_id={model_id!r}, "
30
+ f"no function is mapped to this id in {sorted(HANDLED_MODELS)}"
31
+ )
32
+ return HANDLED_MODELS[model_id](model_id, verbose=verbose, **kwargs)
33
+
34
+
35
+ def _load_bingsu_adetailer(model_id: str, verbose: int = 0) -> Tuple[Any, str, SpecificConfig]:
36
+ """See `Bingsu/adetailer <https://huggingface.co/Bingsu/adetailer>`_."""
37
+ from huggingface_hub import hf_hub_download
38
+ from ultralytics import YOLO
39
+
40
+ path = hf_hub_download("Bingsu/adetailer", "face_yolov8n.pt")
41
+ model = YOLO(path)
42
+ return (
43
+ model,
44
+ "object-detection",
45
+ SpecificConfig(architecture=type(model), image_size=224, num_channels=3),
46
+ )
47
+
48
+
49
+ HANDLED_MODELS = {"Bingsu/adetailer": _load_bingsu_adetailer}
@@ -9,6 +9,7 @@ def get_phi2(
9
9
  sequence_length: int = 30,
10
10
  sequence_length2: int = 3,
11
11
  dynamic_rope: bool = False,
12
+ use_dim_not_dynamic: bool = False,
12
13
  **kwargs,
13
14
  ) -> Dict[str, Any]:
14
15
  """
@@ -18,6 +19,8 @@ def get_phi2(
18
19
  :param sequence_length: sequence length
19
20
  :param sequence_length2: new sequence length
20
21
  :param dynamic_rope: use dynamic rope (see :class:`transformers.LlamaConfig`)
22
+ :param use_dim_not_dynamic: uses ``torch.export.Dim`` and not a string for the batch size,
23
+ the sequence length and the cache length
21
24
  :param kwargs: to overwrite the configuration, example ``num_hidden_layers=1``
22
25
  :return: dictionary
23
26
 
@@ -62,9 +65,14 @@ def get_phi2(
62
65
  n_layers = config["num_hidden_layers"]
63
66
  num_key_value_heads = config["num_key_value_heads"]
64
67
 
65
- batch = torch.export.Dim("batch", min=1, max=1024)
66
- seq_length = torch.export.Dim("seq_length", min=1, max=4096)
67
- cache_length = torch.export.Dim("cache_length", min=1, max=4096)
68
+ if use_dim_not_dynamic:
69
+ batch = torch.export.Dim("batch", min=1, max=1024)
70
+ seq_length = torch.export.Dim("seq_length", min=1, max=4096)
71
+ cache_length = torch.export.Dim("cache_length", min=1, max=4096)
72
+ else:
73
+ batch = "batch"
74
+ seq_length = "seq_length"
75
+ cache_length = "cache_length"
68
76
 
69
77
  shapes = {
70
78
  "input_ids": {0: batch, 1: seq_length},
@@ -352,7 +352,7 @@ def validate_model(
352
352
  The following exporters are available:
353
353
 
354
354
  * ``export-nostrict``: run :func:`torch.export.export` (..., strict=False)
355
- * ``onnx-dynamo``: run :func:`torch.onnx.export` (..., dynamo=True),
355
+ * ``onnx-dynamo``: run :func:`torch.onnx.export` (...),
356
356
  models can be optimized with ``optimization`` in ``("ir", "os_ort")``
357
357
  * ``modelbuilder``: use :epkg:`ModelBuilder` to builds the onnx model
358
358
  * ``custom``: custom exporter (see :epkg:`experimental-experiment`),
@@ -712,6 +712,7 @@ def validate_model(
712
712
  print(f"[validate_model] done (dump onnx) in {duration}")
713
713
  data["onnx_filename"] = onnx_filename
714
714
  summary["time_onnx_save"] = duration
715
+ summary.update(compute_statistics(onnx_filename))
715
716
  if verbose:
716
717
  print(f"[validate_model] dumps statistics in {dump_folder!r}...")
717
718
  dump_stats = os.path.join(dump_folder, f"{folder_name}.stats")
@@ -815,6 +816,39 @@ def validate_model(
815
816
  return summary, data
816
817
 
817
818
 
819
+ def compute_statistics(onnx_filename: str) -> Dict[str, Union[float, int]]:
820
+ """Computes some statistics on the model itself."""
821
+ onx = onnx.load(onnx_filename, load_external_data=False)
822
+
823
+ def node_iter(proto):
824
+ if isinstance(proto, onnx.ModelProto):
825
+ yield from node_iter(proto.graph)
826
+ for f in proto.functions:
827
+ yield from node_iter(f)
828
+ elif isinstance(proto, (onnx.FunctionProto, onnx.GraphProto)):
829
+ for node in proto.node:
830
+ yield node
831
+ for att in node.attribute:
832
+ if att.type == onnx.AttributeProto.GRAPH:
833
+ yield from node_iter(att.g)
834
+ if hasattr(proto, "initializer"):
835
+ yield from proto.initializer
836
+ else:
837
+ raise NotImplementedError(f"Unexpected type={type(proto)}")
838
+
839
+ counts: Dict[str, Union[float, int]] = {}
840
+ for proto in node_iter(onx):
841
+ if isinstance(proto, onnx.NodeProto):
842
+ key = f"n_node_{proto.op_type}"
843
+ else:
844
+ key = f"n_node_initializer_{proto.data_type}"
845
+
846
+ if key not in counts:
847
+ counts[key] = 0
848
+ counts[key] += 1
849
+ return counts
850
+
851
+
818
852
  def _validate_do_run_model(
819
853
  data, summary, key, tag, expected_tag, verbose, repeat, warmup, quiet
820
854
  ):
@@ -205,7 +205,7 @@ def run_aligned(
205
205
  Model(), (x,), dynamic_shapes=({0: torch.export.Dim("batch")},)
206
206
  )
207
207
  onx = torch.onnx.export(
208
- Model(), (x,), dynamic_shapes=({0: torch.export.Dim("batch")},), dynamo=True
208
+ Model(), (x,), dynamic_shapes=({0: torch.export.Dim("batch")},)
209
209
  ).model_proto
210
210
  results = list(
211
211
  map(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: onnx-diagnostic
3
- Version: 0.7.9
3
+ Version: 0.7.10
4
4
  Summary: Investigate ONNX models
5
5
  Home-page: https://github.com/sdpython/onnx-diagnostic
6
6
  Author: Xavier Dupré
@@ -95,7 +95,7 @@ Getting started
95
95
 
96
96
  git clone https://github.com/sdpython/onnx-diagnostic.git
97
97
  cd onnx-diagnostic
98
- pip install -e .
98
+ pip install -e . -v
99
99
 
100
100
  or
101
101
 
@@ -1,4 +1,4 @@
1
- onnx_diagnostic/__init__.py,sha256=kVcl-JnGE4IT1aVApD12HyIKRM7Rq6QRFtmH09JgMwY,173
1
+ onnx_diagnostic/__init__.py,sha256=zdvFsRTL3vL-gFelvSYnpPCXNbg8EPwbC3qQ47KhLbw,174
2
2
  onnx_diagnostic/__main__.py,sha256=YmyV_Aq_ianDlHyKLHMa6h8YK3ZmFPpLVHLKjM91aCk,79
3
3
  onnx_diagnostic/_command_lines_parser.py,sha256=TVPlDjsWZd_Zb9DzN3zj0OGxd8nz_nUsjQyGkmyMNsA,32939
4
4
  onnx_diagnostic/api.py,sha256=BhCl_yCd78N7TlVtPOHjeYv1QBEy39TjZ647rcHqLh0,345
@@ -12,22 +12,22 @@ onnx_diagnostic/helpers/__init__.py,sha256=GJ2GT7cgnlIveVUwMZhuvUwidbTJaKv8CsSIO
12
12
  onnx_diagnostic/helpers/_log_helper.py,sha256=OTwQH0OIxs9B6nrSvR7MoxMimSw_8mU0mj133NvLk5o,16832
13
13
  onnx_diagnostic/helpers/args_helper.py,sha256=SRWnqC7EENg09RZlA50B_PcdiIhdbgA4C3ACfzl5nMs,4419
14
14
  onnx_diagnostic/helpers/bench_run.py,sha256=CGA6VMJZMH2gDhVueT9ypNm4PMcjGrrGFYp08nhWj9k,16539
15
- onnx_diagnostic/helpers/cache_helper.py,sha256=dFiKPnD3qT_rel9C7Az9AEnbV2drfSMSdXBRotJJUU4,24686
15
+ onnx_diagnostic/helpers/cache_helper.py,sha256=-2H4hMO5ZIINsaJS7mK9ETgv-kA_d-dlwT1TDp2Yjbo,24754
16
16
  onnx_diagnostic/helpers/config_helper.py,sha256=H2mOcMXfrcolFnt8EuqmRFkpQ3YdNRDfvm9ToI1vNH0,5618
17
17
  onnx_diagnostic/helpers/doc_helper.py,sha256=pl5MZd3_FaE8BqQnqoBuSBxoNCFcd2OJd3eITUSku5c,5897
18
18
  onnx_diagnostic/helpers/graph_helper.py,sha256=hevQT5a7_QuriVPQcbT5qe18n99Doyl5h3-qshx1-uk,14093
19
- onnx_diagnostic/helpers/helper.py,sha256=OsQz2um10DgGiX3fgOulTDFQop0wCMX6shPonQgN71w,62940
19
+ onnx_diagnostic/helpers/helper.py,sha256=mRQ-wo9P30m0Z0_v3EfEDwK_dZFTUhIVKo-5ut9DPW8,63194
20
20
  onnx_diagnostic/helpers/log_helper.py,sha256=ODtMLFfJvkyss9PJwEZFd5_8bLcliaMq0A17t0dSIFA,82771
21
21
  onnx_diagnostic/helpers/memory_peak.py,sha256=OT6mz0muBbBZY0pjgW2_eCk_lOtFRo-5w4jFo2Z6Kok,6380
22
22
  onnx_diagnostic/helpers/mini_onnx_builder.py,sha256=FgK-Kws1WpSYdYJCPyONwQYY3AjbgUHimZlaYyiNUfE,21286
23
23
  onnx_diagnostic/helpers/model_builder_helper.py,sha256=tJi4VkP0TS2yyDSxQPNu9WRoSnPCAjr6L0J49X2LdXk,12810
24
- onnx_diagnostic/helpers/onnx_helper.py,sha256=GApd3fmweLZ85GjEqo49ZCiOUSJ7vtXCBs-Tp3WlydI,39825
24
+ onnx_diagnostic/helpers/onnx_helper.py,sha256=oxl3x0EQowGP9kfz8aKDqnJZcvYY8FeZLsfoLJDiSUg,39826
25
25
  onnx_diagnostic/helpers/ort_session.py,sha256=UgUUeUslDxEFBc6w6f3HMq_a7bn4TBlItmojqWquSj4,29281
26
26
  onnx_diagnostic/helpers/rt_helper.py,sha256=qbV6zyMs-iH6H65WHC2tu4h0psnHg0TX5fwfO_k-glg,4623
27
- onnx_diagnostic/helpers/torch_helper.py,sha256=r7uvT5Pmf4lvVf1LfzdoIFJeFVvnwXLayipgHmOK9SY,33081
27
+ onnx_diagnostic/helpers/torch_helper.py,sha256=e0KkSTdoZthc5Yuf9e8XVGAx-lqOYy4DeRRe-N4QUYQ,33478
28
28
  onnx_diagnostic/reference/__init__.py,sha256=rLZsxOlnb7-81F2CzepGnZLejaROg4JvgFaGR9FwVQA,208
29
29
  onnx_diagnostic/reference/evaluator.py,sha256=RzNzjFDeMe-4X51Tb22N6aagazY5ktNq-mRmPcfY5EU,8848
30
- onnx_diagnostic/reference/ort_evaluator.py,sha256=1O7dHj8Aspolidg6rB2Nm7hT3HaGb4TxAgjCCD0XVcQ,26159
30
+ onnx_diagnostic/reference/ort_evaluator.py,sha256=nituItsP3IKDDWF9z-iGX_iAubrTcdk8pb1GVBp9sCU,26161
31
31
  onnx_diagnostic/reference/quantized_tensor.py,sha256=5u67uS2uGacdMD5VYCbpojNjiesDlV_kO0fAJ0vUWGE,1098
32
32
  onnx_diagnostic/reference/report_results_comparison.py,sha256=OsyQN8EHZZoj97u74RQP-7WFpebPOso5GEDpdkLWu6M,3645
33
33
  onnx_diagnostic/reference/torch_evaluator.py,sha256=gf8EPoX4C4yGgQ-DqxXxaGU26WdEhn8Gd6iesDLqAV0,27692
@@ -52,7 +52,7 @@ onnx_diagnostic/reference/ops/op_qlinear_conv.py,sha256=DgiUwoj-gW5xv9CVFXPPRJbK
52
52
  onnx_diagnostic/reference/ops/op_quick_gelu.py,sha256=43QNWbOK88-h7qqe0ubMTbVt3Qo4YmNZPfrbu5kIefM,631
53
53
  onnx_diagnostic/reference/ops/op_replace_zero.py,sha256=Fe8yFJeg33_5e1RGtv6fqBZOY-qpOCv7PukjdubzChA,323
54
54
  onnx_diagnostic/reference/ops/op_rotary.py,sha256=GbJhk6id6rSelEK1VuD-LBPM6xDckpmsmJuydSJbMws,628
55
- onnx_diagnostic/reference/ops/op_scan.py,sha256=1dGjcmwhSk9VJWAOrvAks9es71Qug5e3NcGkUH-bKSw,2072
55
+ onnx_diagnostic/reference/ops/op_scan.py,sha256=qmPdrUrhOrxzjiwlOYAyyl-Ztxc_rkAU4oweJgOlbZ8,2077
56
56
  onnx_diagnostic/reference/ops/op_scatter_elements.py,sha256=D8fkrNlk22C-o3MddLpaex7vS2NT4KXDzqhYvK250zA,3775
57
57
  onnx_diagnostic/reference/ops/op_scatternd_of_shape.py,sha256=PUSRHd_CugWkEMiy9SeKApk26edTXVjDUNC8fLRRvwA,812
58
58
  onnx_diagnostic/reference/ops/op_simplified_layer_normalization.py,sha256=1ChLxn_1kYbbN6KTa0uJAHEyJlutBo-B1CY8YVs7EaM,280
@@ -89,36 +89,37 @@ onnx_diagnostic/tasks/text_generation.py,sha256=hV-oK1bWjtepxkA491Va_0CWrELZbfP4
89
89
  onnx_diagnostic/tasks/text_to_image.py,sha256=mOS3Ruosi3hzRMxXLDN7ZkAbi7NnQb7MWwQP_okGVHs,2962
90
90
  onnx_diagnostic/tasks/zero_shot_image_classification.py,sha256=jJCMWuOqGv5ahCfjrcqxuYCJFhTgHV5KUf2yyv2yxYA,4624
91
91
  onnx_diagnostic/torch_export_patches/__init__.py,sha256=0SaZedwznm1hQUCvXZsGZORV5vby954wEExr5faepGg,720
92
- onnx_diagnostic/torch_export_patches/onnx_export_errors.py,sha256=Nx3HLII-KIemfMydraTRlwK9O0kgVug57SiLT9y9KOY,23749
92
+ onnx_diagnostic/torch_export_patches/onnx_export_errors.py,sha256=KYux1-Ea3zCxffxc-17DVfO0G_XCU1flPw_XUc_Fcmg,28008
93
93
  onnx_diagnostic/torch_export_patches/onnx_export_serialization.py,sha256=klvqiMjccwGhiRnLRVbwTi5WWkMfvtnOV5ycirPcAdA,11354
94
94
  onnx_diagnostic/torch_export_patches/patch_expressions.py,sha256=vr4tt61cbDnaaaduzMj4UBZ8OUtr6GfDpIWwOYqjWzs,3213
95
95
  onnx_diagnostic/torch_export_patches/patch_inputs.py,sha256=3ySY1nAzINSS1hAzTycwfdbPas8G5CDL2MjnaAHBkMU,7825
96
96
  onnx_diagnostic/torch_export_patches/patch_module.py,sha256=R2d9IHM-RwsBKDsxuBIJnEqMoxbS9gd4YWFGG2wwV5A,39881
97
97
  onnx_diagnostic/torch_export_patches/patch_module_helper.py,sha256=2U0AdyZuU0W54QTdE7tY7imVzMnpQ5091ADNtTCkT8Y,6967
98
98
  onnx_diagnostic/torch_export_patches/eval/__init__.py,sha256=57x62uZNA80XiWgkG8Fe0_8YJcIVrvKLPqvwLDPJwgc,24008
99
- onnx_diagnostic/torch_export_patches/eval/model_cases.py,sha256=DTvdHPtNQh25Akv5o3D4Jxf1L1-SJ7w14tgvj8AAns8,26577
99
+ onnx_diagnostic/torch_export_patches/eval/model_cases.py,sha256=OU8-63VDhiWtQV3scBV9JyGXn8ds74OzY2-IOZkwg0A,26580
100
100
  onnx_diagnostic/torch_export_patches/patches/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
101
101
  onnx_diagnostic/torch_export_patches/patches/patch_torch.py,sha256=TFjuw--sTYPCoVEaYlYLJuElx_CUynJR6s6ypoZtRWw,18956
102
- onnx_diagnostic/torch_export_patches/patches/patch_transformers.py,sha256=tcDNJzOIivyOM6XbTm4munHKHAmVrOKE6nbqIdl-4dg,66290
102
+ onnx_diagnostic/torch_export_patches/patches/patch_transformers.py,sha256=wXopyo0-6KmATOfqXMLEvxpe_jDRRIY8fWRjUjMlSkI,67776
103
103
  onnx_diagnostic/torch_export_patches/serialization/__init__.py,sha256=BHLdRPtNAtNPAS-bPKEj3-foGSPvwAbZXrHzGGPDLEw,1876
104
104
  onnx_diagnostic/torch_export_patches/serialization/diffusers_impl.py,sha256=drq3EH_yjcSuIWYsVeUWm8Cx6YCZFU6bP_1PLtPfY5I,945
105
- onnx_diagnostic/torch_export_patches/serialization/transformers_impl.py,sha256=dAKi4zujlBxDvxvaVI_qH4qW9AlpVFMtCkvGTNCJCUY,9353
105
+ onnx_diagnostic/torch_export_patches/serialization/transformers_impl.py,sha256=mcmZGekzQlLgE_o3SdKlRgCx4ewwyyAuNWZ9CaN_zrI,9317
106
106
  onnx_diagnostic/torch_models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
107
107
  onnx_diagnostic/torch_models/llms.py,sha256=soyg4yC87ptGoeulJhKqw5opGmuLvH1pn_ZDXZ4Jr8E,90
108
- onnx_diagnostic/torch_models/validate.py,sha256=IkWyuwKmIqetMN5ziD9jPwSgRAMzJnQqPElIQFJiJwc,65907
108
+ onnx_diagnostic/torch_models/validate.py,sha256=Qu9gW1AatgpmsWzXN3s-vVCKnKDYTV1wPO3wnUU44wU,67161
109
109
  onnx_diagnostic/torch_models/hghub/__init__.py,sha256=vi1Q7YHdddj1soiBN42MSvJdFqe2_KUoWafHISjwOu8,58
110
110
  onnx_diagnostic/torch_models/hghub/hub_api.py,sha256=Bvr-sTAhS6s6UCkt-KsY_7Mdai08-AQzvHrzbYCSuvk,13186
111
- onnx_diagnostic/torch_models/hghub/hub_data.py,sha256=W05mciqUqhaYEfYNHtUeuwOMOZoQTuDidRLEIx4z1CE,8523
112
- onnx_diagnostic/torch_models/hghub/hub_data_cached_configs.py,sha256=mboN04WTZMPgfw_JOP01aINWjmq6qmOKQhDE28Fc_zY,282283
113
- onnx_diagnostic/torch_models/hghub/model_inputs.py,sha256=h6Pi0dkUFXpDGudJ5mQQ9NSQCOjpF6Pm-J6_shsWiH4,11546
111
+ onnx_diagnostic/torch_models/hghub/hub_data.py,sha256=jN2Y-96DRmj3hBCQT4ugCT6Q5rKv5y5TUi80G-95Zko,8610
112
+ onnx_diagnostic/torch_models/hghub/hub_data_cached_configs.py,sha256=3yH1pQbCYNDmRMNUCwMFf5ELnAa35ubTKD2JRF5y9Ls,287515
113
+ onnx_diagnostic/torch_models/hghub/model_inputs.py,sha256=-YX0guKGqj14cc8ZTco3QjCNXXBtf8inzwrsQdvQr6w,12559
114
+ onnx_diagnostic/torch_models/hghub/model_specific.py,sha256=ZFajyL9MPZp7N6rveKB0IEAYeNKesbo0ItYoZIz90wc,1540
114
115
  onnx_diagnostic/torch_models/untrained/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
115
- onnx_diagnostic/torch_models/untrained/llm_phi2.py,sha256=ynBTDHJHCk44NjLT_t6OiFDBdPP0rFGPteiONDxvztw,3708
116
+ onnx_diagnostic/torch_models/untrained/llm_phi2.py,sha256=JbGZmW41MPJcQgqaJc9R2G00nI79nI-lABN-ffA1lmY,4037
116
117
  onnx_diagnostic/torch_models/untrained/llm_tiny_llm.py,sha256=QXw_Bs2SzfeiQMf-tmtVl83SmVOL4-Um7Qy-f0E48QI,2507
117
118
  onnx_diagnostic/torch_onnx/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
118
119
  onnx_diagnostic/torch_onnx/runtime_info.py,sha256=1g9F_Jf9AAgYQU4stbsrFXwQl-30mWlQrFbQ7val8Ps,9268
119
- onnx_diagnostic/torch_onnx/sbs.py,sha256=1EL25DeYFzlBSiFG_XjePBLvsiItRXbdDrr5-QZW2mA,16878
120
- onnx_diagnostic-0.7.9.dist-info/licenses/LICENSE.txt,sha256=Vv6TXglX6Rc0d-f8aREhayhT-6PMQXEyOmI2NKlUCMc,1045
121
- onnx_diagnostic-0.7.9.dist-info/METADATA,sha256=UIT85yMNIqhtCArUezpyfFnbkz1KY4Q11EjKCBKZVWs,7431
122
- onnx_diagnostic-0.7.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
123
- onnx_diagnostic-0.7.9.dist-info/top_level.txt,sha256=KwNkXewmcobM3ZT1DJLVWH6ebJzA5qKg7cWqKfpGNT4,16
124
- onnx_diagnostic-0.7.9.dist-info/RECORD,,
120
+ onnx_diagnostic/torch_onnx/sbs.py,sha256=fN799L_G1c2RKEuNcKt_MnQri5dwD4OzeCkBBFFoUBI,16865
121
+ onnx_diagnostic-0.7.10.dist-info/licenses/LICENSE.txt,sha256=Vv6TXglX6Rc0d-f8aREhayhT-6PMQXEyOmI2NKlUCMc,1045
122
+ onnx_diagnostic-0.7.10.dist-info/METADATA,sha256=5FswMlBjyOZNZ-pxujgExFBAiJ3rNd9DfPwWL0f9edw,7435
123
+ onnx_diagnostic-0.7.10.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
124
+ onnx_diagnostic-0.7.10.dist-info/top_level.txt,sha256=KwNkXewmcobM3ZT1DJLVWH6ebJzA5qKg7cWqKfpGNT4,16
125
+ onnx_diagnostic-0.7.10.dist-info/RECORD,,