onnx-diagnostic 0.7.0__py3-none-any.whl → 0.7.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.
Files changed (29) hide show
  1. onnx_diagnostic/__init__.py +1 -1
  2. onnx_diagnostic/_command_lines_parser.py +213 -5
  3. onnx_diagnostic/export/dynamic_shapes.py +48 -20
  4. onnx_diagnostic/export/shape_helper.py +126 -0
  5. onnx_diagnostic/ext_test_case.py +31 -0
  6. onnx_diagnostic/helpers/cache_helper.py +42 -20
  7. onnx_diagnostic/helpers/config_helper.py +16 -1
  8. onnx_diagnostic/helpers/log_helper.py +1561 -177
  9. onnx_diagnostic/helpers/torch_helper.py +6 -2
  10. onnx_diagnostic/tasks/__init__.py +2 -0
  11. onnx_diagnostic/tasks/image_text_to_text.py +69 -18
  12. onnx_diagnostic/tasks/text_generation.py +17 -8
  13. onnx_diagnostic/tasks/text_to_image.py +91 -0
  14. onnx_diagnostic/torch_export_patches/onnx_export_errors.py +24 -7
  15. onnx_diagnostic/torch_export_patches/onnx_export_serialization.py +144 -349
  16. onnx_diagnostic/torch_export_patches/patches/patch_transformers.py +87 -7
  17. onnx_diagnostic/torch_export_patches/serialization/__init__.py +46 -0
  18. onnx_diagnostic/torch_export_patches/serialization/diffusers_impl.py +34 -0
  19. onnx_diagnostic/torch_export_patches/serialization/transformers_impl.py +259 -0
  20. onnx_diagnostic/torch_models/hghub/hub_api.py +73 -5
  21. onnx_diagnostic/torch_models/hghub/hub_data.py +7 -2
  22. onnx_diagnostic/torch_models/hghub/hub_data_cached_configs.py +28 -0
  23. onnx_diagnostic/torch_models/hghub/model_inputs.py +74 -14
  24. onnx_diagnostic/torch_models/validate.py +45 -16
  25. {onnx_diagnostic-0.7.0.dist-info → onnx_diagnostic-0.7.2.dist-info}/METADATA +1 -1
  26. {onnx_diagnostic-0.7.0.dist-info → onnx_diagnostic-0.7.2.dist-info}/RECORD +29 -24
  27. {onnx_diagnostic-0.7.0.dist-info → onnx_diagnostic-0.7.2.dist-info}/WHEEL +0 -0
  28. {onnx_diagnostic-0.7.0.dist-info → onnx_diagnostic-0.7.2.dist-info}/licenses/LICENSE.txt +0 -0
  29. {onnx_diagnostic-0.7.0.dist-info → onnx_diagnostic-0.7.2.dist-info}/top_level.txt +0 -0
@@ -43,7 +43,10 @@ def update_config(config: Any, mkwargs: Dict[str, Any]):
43
43
  else:
44
44
  update_config(getattr(config, k), v)
45
45
  continue
46
- setattr(config, k, v)
46
+ if type(config) is dict:
47
+ config[k] = v
48
+ else:
49
+ setattr(config, k, v)
47
50
 
48
51
 
49
52
  def _pick(config, *atts, exceptions: Optional[Dict[str, Callable]] = None):
@@ -66,6 +69,18 @@ def _pick(config, *atts, exceptions: Optional[Dict[str, Callable]] = None):
66
69
  raise AssertionError(f"Unable to find any of these {atts!r} in {config}")
67
70
 
68
71
 
72
+ def pick(config, name: str, default_value: Any) -> Any:
73
+ """
74
+ Returns the value of a attribute if config has it
75
+ otherwise the default value.
76
+ """
77
+ if not config:
78
+ return default_value
79
+ if type(config) is dict:
80
+ return config.get(name, default_value)
81
+ return getattr(config, name, default_value)
82
+
83
+
69
84
  @functools.cache
70
85
  def config_class_from_architecture(arch: str, exc: bool = False) -> Optional[type]:
71
86
  """