pyTorchAutoForge 0.2.2.dev0__tar.gz → 0.3.1.dev0__tar.gz

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 (102) hide show
  1. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/LICENSE +1 -1
  2. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/PKG-INFO +15 -26
  3. pytorchautoforge-0.3.1.dev0/README.md +23 -0
  4. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/_version.py +2 -2
  5. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/onnx/ModelHandlerONNx.py +13 -9
  6. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/datasets/DatasetClasses.py +2 -2
  7. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/datasets/ImagesAugmentation.py +356 -601
  8. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/datasets/LabelsClasses.py +25 -1
  9. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/datasets/auxiliary_functions.py +1 -1
  10. pytorchautoforge-0.3.1.dev0/pyTorchAutoForge/datasets/noise_models/GeometricAugs.py +336 -0
  11. pytorchautoforge-0.3.1.dev0/pyTorchAutoForge/datasets/noise_models/IntensityAugs.py +178 -0
  12. pytorchautoforge-0.3.1.dev0/pyTorchAutoForge/datasets/noise_models/NoiseErrorsAugs.py +242 -0
  13. pytorchautoforge-0.3.1.dev0/pyTorchAutoForge/datasets/noise_models/OpticsErrorsAugs.py +33 -0
  14. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/evaluation/ModelProfiler.py +1 -1
  15. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/ModelAutoBuilder.py +145 -62
  16. pytorchautoforge-0.3.1.dev0/pyTorchAutoForge/model_building/backbones/__init__.py +0 -0
  17. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/backbones/efficient_net.py +13 -4
  18. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/convolutionalBlocks.py +1 -30
  19. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/factories/block_factories.py +8 -1
  20. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/fullyConnectedBlocks.py +1 -5
  21. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/modelBuildingBlocks.py +6 -10
  22. pytorchautoforge-0.3.1.dev0/pyTorchAutoForge/model_building/poolingBlocks.py +108 -0
  23. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/optimization/ModelTrainingManager.py +3 -3
  24. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/setup/AutoForgeInit.py +21 -1
  25. pytorchautoforge-0.3.1.dev0/pyTorchAutoForge/utils/context_management.py +15 -0
  26. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyproject.toml +6 -5
  27. pytorchautoforge-0.2.2.dev0/README.md +0 -33
  28. pytorchautoforge-0.2.2.dev0/pyTorchAutoForge/utils/context_management.py +0 -32
  29. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/.gitignore +0 -0
  30. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/conda_install.sh +0 -0
  31. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/environment.yml +0 -0
  32. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/__init__.py +0 -0
  33. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/__init__.py +0 -0
  34. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/matlab/CTorchModelWrapper.m +0 -0
  35. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/matlab/EnumTorchWrapperMode.m +0 -0
  36. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/matlab/TorchModelMATLABwrapper.py +0 -0
  37. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/matlab/__init__.py +0 -0
  38. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/mlflow/__init__.py +0 -0
  39. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/mlflow/mlflow_api.py +0 -0
  40. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/onnx/__init__.py +0 -0
  41. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/tcp/.deprecated/torchModelOverTCP_legacy.py +0 -0
  42. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/tcp/__init__.py +0 -0
  43. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/tcp/tcpServerPy.py +0 -0
  44. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/tcp/tcp_socket_server.py +0 -0
  45. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/tcp/tcp_torchModel_eval.py +0 -0
  46. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/telegram/AutoForge_AlertSystem_bot.py.wip +0 -0
  47. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/telegram/__init__.py +0 -0
  48. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/telegram/bot_token_private.json +0 -0
  49. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/tensorrt/.gitkeep +0 -0
  50. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/tensorrt/TODO +0 -0
  51. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/tensorrt/TRTengineExporter.py +0 -0
  52. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/tensorrt/__init__.py +0 -0
  53. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/torch/__init__.py +0 -0
  54. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/api/torch/torchModulesIO.py +0 -0
  55. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/datasets/.experimental.py +0 -0
  56. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/datasets/DataAugmentation.py +0 -0
  57. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/datasets/DataloaderIndex.py +0 -0
  58. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/datasets/__init__.py +0 -0
  59. /pytorchautoforge-0.2.2.dev0/pyTorchAutoForge/datasets/noise_models/FrameCameraNoiseModels.py → /pytorchautoforge-0.3.1.dev0/pyTorchAutoForge/datasets/noise_models/FrameCameraErrorModels.py +0 -0
  60. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/datasets/noise_models/__init__.py +0 -0
  61. {pytorchautoforge-0.2.2.dev0/pyTorchAutoForge/model_building/backbones → pytorchautoforge-0.3.1.dev0/pyTorchAutoForge/datasets/vector_error_models}/__init__.py +0 -0
  62. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/evaluation/ModelEvaluator.py +0 -0
  63. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/evaluation/ModelExplainer.py +0 -0
  64. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/evaluation/ResultsPlotter.py +0 -0
  65. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/evaluation/__init__.py +0 -0
  66. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/extra/data_analysis_tools_module.py +0 -0
  67. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/extra/experimental_pysr_module.py +0 -0
  68. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/extra/xgboost_regression_module.py +0 -0
  69. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/hparams_optim/ModelHparamsOptimizer.py +0 -0
  70. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/hparams_optim/OptunaStudyAnalyzer.py +0 -0
  71. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/hparams_optim/__init__.py +0 -0
  72. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/hparams_optim/optuna_auxiliary.py +0 -0
  73. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/hparams_optim/seedNewOptunaStudy.py +0 -0
  74. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/.deprecated/_modelBuildingFunctions.py +0 -0
  75. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/.deprecated/_modelBuldingBlocks.py +0 -0
  76. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/ModelAssembler.py +0 -0
  77. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/ModelMutator.py +0 -0
  78. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/__init__.py +0 -0
  79. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/backbones/README.md +0 -0
  80. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/backbones/base_backbones.py +0 -0
  81. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/backbones/image_processing_operators.py +0 -0
  82. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/backbones/input_adapters.py +0 -0
  83. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/model_building/backbones/spatial_features_operators.py +0 -0
  84. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/optimization/.gitignore +0 -0
  85. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/optimization/__init__.py +0 -0
  86. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/optimization/lossFunctionsClasses.py +0 -0
  87. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/optimization/sessionConfig.yaml +0 -0
  88. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/programs/profile_and_export_model.py +0 -0
  89. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/setup/BaseConfigClass.py +0 -0
  90. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/setup/__init__.py +0 -0
  91. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/tensorboard/tensorboard_fcns.py +0 -0
  92. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/utils/DeviceManager.py +0 -0
  93. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/utils/LossLandscapeVisualizer.py +0 -0
  94. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/utils/TODO +0 -0
  95. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/utils/__init__.py +0 -0
  96. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/utils/argument_parsers.py +0 -0
  97. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/utils/conversion_utils.py +0 -0
  98. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/utils/pytest_test.py +0 -0
  99. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/utils/rename_images.py +0 -0
  100. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/utils/test_fixtures/images_fixtures.py +0 -0
  101. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/utils/timing_utils.py +0 -0
  102. {pytorchautoforge-0.2.2.dev0 → pytorchautoforge-0.3.1.dev0}/pyTorchAutoForge/utils/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 PeterC
3
+ Copyright (c) 2025 Pietro Califano
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyTorchAutoForge
3
- Version: 0.2.2.dev0
4
- Summary: PyTorchAutoForge library is based on raw PyTorch and designed to automate DNN development, model tracking and deployment, tightly integrated with MLflow and Optuna. It supports Spiking networks libraries (WIP). Deployment can be performed using ONNx, pyTorch facilities or TensorRT (WIP). The library is designed to be compatible with Jetson Orin Nano Jetpack rev6.1, with bash script to automatically configure virtualenv.
3
+ Version: 0.3.1.dev0
4
+ Summary: PyTorchAutoForge library is based on raw PyTorch and designed to automate DNN development, model tracking and deployment, tightly integrated with MLflow and Optuna. It supports Spiking networks libraries (WIP). Deployment can be performed using ONNX, pyTorch facilities or TensorRT (WIP). The library is designed to be compatible with Jetson Orin Nano Jetpack rev6.1, with bash script to automatically configure virtualenv.
5
5
  Author-email: "Pietro Califano (PC)" <petercalifano.gs@gmail.com>
6
6
  License: MIT
7
7
  License-File: LICENSE
@@ -18,14 +18,13 @@ Requires-Dist: dacite
18
18
  Requires-Dist: expelliarmus; platform_machine == 'x86_64'
19
19
  Requires-Dist: inputimeout
20
20
  Requires-Dist: kornia
21
- Requires-Dist: lietorch; platform_machine == 'x86_64'
22
21
  Requires-Dist: matplotlib<=3.10.0
23
- Requires-Dist: mlflow<=3.2
22
+ Requires-Dist: mlflow<=3.4
24
23
  Requires-Dist: msgpack
25
24
  Requires-Dist: mypy
26
25
  Requires-Dist: norse; platform_machine == 'x86_64'
27
26
  Requires-Dist: numpy
28
- Requires-Dist: onnx<=1.18.0
27
+ Requires-Dist: onnx
29
28
  Requires-Dist: onnxruntime
30
29
  Requires-Dist: onnxscript
31
30
  Requires-Dist: optuna
@@ -36,7 +35,7 @@ Requires-Dist: seaborn
36
35
  Requires-Dist: statsmodels
37
36
  Requires-Dist: tonic; platform_machine == 'x86_64'
38
37
  Requires-Dist: torch-tb-profiler
39
- Requires-Dist: torch<=2.8.0; platform_machine == 'x86_64'
38
+ Requires-Dist: torch; platform_machine == 'x86_64'
40
39
  Requires-Dist: torchinfo
41
40
  Requires-Dist: torchvision; platform_machine == 'x86_64'
42
41
  Provides-Extra: cuda-all
@@ -45,35 +44,25 @@ Requires-Dist: pynvml; (platform_machine == 'x86_64') and extra == 'cuda-all'
45
44
  Description-Content-Type: text/markdown
46
45
 
47
46
  # pyTorchAutoForge
48
- _Warning: Work in progress :)_
47
+ **_WARNING: work in progress. Do not hesitate to open issues for improvements or problems!_**
49
48
 
50
49
  A library based on PyTorch (<https://pytorch.org/>) and designed to automate ML models development, tracking and deployment, integrated with MLflow and Optuna (<https://mlflow.org/>, <https://optuna.org/>). It also supports spiking networks libraries (WIP). Model optimization and deployment can be performed using ONNx, pyTorch facilities or TensorRT (WIP). The library aims to be compatible with Jetson Orin Nano Jetpack rev6.1. Several other functionalities and utilities for sklearn and pySR (<https://github.com/MilesCranmer/PySR>) are included (see README and documentation).
51
50
 
52
51
  ## Installation using pip
53
52
 
54
- This is the suggested installation method, the others are mostly intended for development and may not be completely up-to-date with the newest release versions.
55
- Run in a conda or virtual environment:
53
+ The suggested installation method is through pip as the others are mostly intended for development and may not be completely up-to-date with the newest release versions.
54
+ In whatever conda or virtual environment you like (preferably with a sufficiently new torch release, to install from pypi:
56
55
 
57
56
  ```bash
58
57
  pip install pyTorchAutoForge
59
58
  ```
60
59
 
61
- Dependencies for the core modules should be installed automatically using pip.
60
+ Or from a local copy of the repository (requires `hatch` module for the build):
62
61
 
63
- ## Manual installation (venv)
64
-
65
- 1) Clone the repository
66
- 2) Create a virtual environment using python >= 3.10 (tested with 3.11), using `python -m venv <your_venv_name>`
67
- 3) Activate the virtual environment using `source <your_venv_name>/bin/activate`
68
- 4) Install the requirements using `pip install -r requirements.txt`
69
- 5) Install the package using `pip install .` in the root folder of the repository
70
-
71
- ## Manual installation (conda)
72
-
73
- ### Option A:
74
- 1) Clone the repository
75
- 2) Create a new conda environment (python >=3.10) using the provided `enrivonment.yml` file
62
+ ```bash
63
+ cd pyTorchAutoforge
64
+ pip install .
65
+ ```
76
66
 
77
- ### Option B;
78
- 1) Clone the repository
79
- 2) Use the automatic installation script `conda_install.sh`. There are several options, use those you need. It will automatically create a new environment named **autoforge**.
67
+ An automatic installation script `conda_install.sh` is provided and should work in most cases. Note that it will automatically create a new environment named **autoforge** and makes several assumptions about your environment.
68
+ Dependencies for the core modules should be installed automatically using pip. However, this is currently not fully tested. Please open related issues.
@@ -0,0 +1,23 @@
1
+ # pyTorchAutoForge
2
+ **_WARNING: work in progress. Do not hesitate to open issues for improvements or problems!_**
3
+
4
+ A library based on PyTorch (<https://pytorch.org/>) and designed to automate ML models development, tracking and deployment, integrated with MLflow and Optuna (<https://mlflow.org/>, <https://optuna.org/>). It also supports spiking networks libraries (WIP). Model optimization and deployment can be performed using ONNx, pyTorch facilities or TensorRT (WIP). The library aims to be compatible with Jetson Orin Nano Jetpack rev6.1. Several other functionalities and utilities for sklearn and pySR (<https://github.com/MilesCranmer/PySR>) are included (see README and documentation).
5
+
6
+ ## Installation using pip
7
+
8
+ The suggested installation method is through pip as the others are mostly intended for development and may not be completely up-to-date with the newest release versions.
9
+ In whatever conda or virtual environment you like (preferably with a sufficiently new torch release, to install from pypi:
10
+
11
+ ```bash
12
+ pip install pyTorchAutoForge
13
+ ```
14
+
15
+ Or from a local copy of the repository (requires `hatch` module for the build):
16
+
17
+ ```bash
18
+ cd pyTorchAutoforge
19
+ pip install .
20
+ ```
21
+
22
+ An automatic installation script `conda_install.sh` is provided and should work in most cases. Note that it will automatically create a new environment named **autoforge** and makes several assumptions about your environment.
23
+ Dependencies for the core modules should be installed automatically using pip. However, this is currently not fully tested. Please open related issues.
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.2.2.dev0'
32
- __version_tuple__ = version_tuple = (0, 2, 2, 'dev0')
31
+ __version__ = version = '0.3.1.dev0'
32
+ __version_tuple__ = version_tuple = (0, 3, 1, 'dev0')
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -5,9 +5,7 @@ from pyTorchAutoForge.utils import AddZerosPadding, torch_to_numpy, timeit_avera
5
5
  from numpy.testing import assert_allclose
6
6
  from pyTorchAutoForge.utils import numpy_to_torch
7
7
 
8
- # TODO: add support to use onnx simplify
9
- #simplified_model, check_status = onnxsim.simplify(onnx_model)
10
-
8
+ # TODO update torch exporter API
11
9
  class ModelHandlerONNx:
12
10
  """
13
11
  _summary_
@@ -64,12 +62,13 @@ class ModelHandlerONNx:
64
62
  print('No name provided for the ONNx model. Assign default value.')
65
63
  onnx_model_name = 'onnx_export'
66
64
 
67
- os.makedirs(os.path.dirname(self.onnx_export_path), exist_ok=True)
65
+ # Create export folder if it does not exist
66
+ os.makedirs(self.onnx_export_path, exist_ok=True)
68
67
 
69
68
  # Check if any model is already exported in the export path and append ID to the filename if any
70
69
  nameID = 0
71
70
  onnx_model_name_tmp = onnx_model_name + "_" + str(nameID)
72
- while os.path.isfile(os.path.join(os.path.dirname(self.onnx_export_path), onnx_model_name_tmp + ".onnx")):
71
+ while os.path.isfile(os.path.join(self.onnx_export_path, onnx_model_name_tmp + ".onnx")):
73
72
  onnx_model_name_tmp = onnx_model_name + "_" + str(nameID)
74
73
  nameID += 1
75
74
 
@@ -112,6 +111,7 @@ class ModelHandlerONNx:
112
111
 
113
112
  # Assign input tensor from init if not provided
114
113
  if input_tensor is None and self.dummy_input_sample is not None:
114
+ assert torch.is_tensor(self.dummy_input_sample), "Dummy input sample must be a torch tensor."
115
115
  input_tensor = self.dummy_input_sample
116
116
  else:
117
117
  raise ValueError("Input tensor must be provided or dummy input sample must be provided when constructing this class.")
@@ -150,7 +150,7 @@ class ModelHandlerONNx:
150
150
  # Reload the model from disk
151
151
  self.onnx_model = self.onnx_load(onnx_filepath=self.onnx_filepath)
152
152
 
153
- self.onnx_validate(self.onnx_model,
153
+ self.onnx_validate(onnx_model=self.onnx_model,
154
154
  test_sample=numpy_to_torch(self.dummy_input_sample))
155
155
 
156
156
  if self.run_onnx_simplify:
@@ -165,7 +165,7 @@ class ModelHandlerONNx:
165
165
  onnx_model_name: str = 'onnx_dynamo_export',
166
166
  dynamic_axes: dict | None = None,
167
167
  IO_names: dict | None = None,
168
- enable_verbose: bool = False) -> None:
168
+ enable_verbose: bool = False) -> str:
169
169
  """Export the model to ONNx format using TorchDynamo."""
170
170
 
171
171
  # Prepare export folder and compose name
@@ -174,6 +174,7 @@ class ModelHandlerONNx:
174
174
 
175
175
  # Assign input tensor from init if not provided
176
176
  if input_tensor is None and self.dummy_input_sample is not None:
177
+ assert torch.is_tensor(self.dummy_input_sample), "Dummy input sample must be a torch tensor."
177
178
  input_tensor = self.dummy_input_sample
178
179
  else:
179
180
  raise ValueError("Input tensor must be provided or dummy input sample must be provided when constructing this class.")
@@ -206,6 +207,9 @@ class ModelHandlerONNx:
206
207
  dynamo=True, report=self.generate_report,
207
208
  verbose=enable_verbose)
208
209
 
210
+ if onnx_program is None:
211
+ raise RuntimeError("TorchDynamo ONNX export failed, no model generated.")
212
+
209
213
  # Call model optimization
210
214
  onnx_program.optimize()
211
215
 
@@ -254,8 +258,8 @@ class ModelHandlerONNx:
254
258
  # %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
255
259
  def onnx_validate(self,
256
260
  onnx_model: onnx.ModelProto | str,
257
- test_sample : torch.Tensor | numpy.ndarray = None,
258
- output_sample : torch.Tensor | numpy.ndarray = None) -> None:
261
+ test_sample : torch.Tensor | numpy.ndarray | None = None,
262
+ output_sample : torch.Tensor | numpy.ndarray | None = None) -> None:
259
263
  """Validate the ONNx model using onnx.checker.check_model."""
260
264
 
261
265
  # If onnx_model is a string, load the model from the file
@@ -872,7 +872,7 @@ class ImagesLabelsDatasetBase(Dataset):
872
872
 
873
873
  return cls(image_paths, camera_path, transform, image_backend)
874
874
 
875
- def get_all_labels_container(self):
875
+ def get_all_labels_container(self) -> ImagesLabelsContainer:
876
876
  """
877
877
  Get the labels container for this dataset.
878
878
 
@@ -899,7 +899,7 @@ class ImagesLabelsDatasetBase(Dataset):
899
899
 
900
900
  container = ImagesLabelsContainer(images=np.empty_like((0, 0)),
901
901
  labels=lbl_array,
902
- labels_datakeys=self.dset_cfg.lbl_dtype,
902
+ labels_datakeys=self.dset_cfg.lbl_vector_data_keys,
903
903
  labels_sizes=lbl_size_dict)
904
904
  return container
905
905