sparseml package¶
Subpackages¶
- sparseml.deepsparse package
- sparseml.framework package
- sparseml.keras package
- Subpackages
- sparseml.keras.datasets package
- sparseml.keras.framework package
- sparseml.keras.models package
- sparseml.keras.optim package
- Submodules
- sparseml.keras.optim.manager module
- sparseml.keras.optim.mask_pruning module
- sparseml.keras.optim.mask_pruning_creator module
- sparseml.keras.optim.modifier module
- sparseml.keras.optim.modifier_epoch module
- sparseml.keras.optim.modifier_lr module
- sparseml.keras.optim.modifier_params module
- sparseml.keras.optim.modifier_pruning module
- sparseml.keras.optim.utils module
- Module contents
- sparseml.keras.sparsification package
- sparseml.keras.utils package
- Submodules
- sparseml.keras.base module
- Module contents
- Subpackages
- sparseml.onnx package
- sparseml.optim package
- sparseml.pytorch package
- Subpackages
- sparseml.pytorch.datasets package
- sparseml.pytorch.framework package
- sparseml.pytorch.models package
- sparseml.pytorch.nn package
- sparseml.pytorch.optim package
- Submodules
- sparseml.pytorch.optim.analyzer_as module
- sparseml.pytorch.optim.analyzer_module module
- sparseml.pytorch.optim.analyzer_pruning module
- sparseml.pytorch.optim.manager module
- sparseml.pytorch.optim.mask_creator_pruning module
- sparseml.pytorch.optim.mask_pruning module
- sparseml.pytorch.optim.modifier module
- sparseml.pytorch.optim.modifier_as module
- sparseml.pytorch.optim.modifier_epoch module
- sparseml.pytorch.optim.modifier_lr module
- sparseml.pytorch.optim.modifier_params module
- sparseml.pytorch.optim.modifier_pruning module
- sparseml.pytorch.optim.modifier_quantization module
- sparseml.pytorch.optim.modifier_regularizer module
- sparseml.pytorch.optim.optimizer module
- sparseml.pytorch.optim.sensitivity_as module
- sparseml.pytorch.optim.sensitivity_lr module
- sparseml.pytorch.optim.sensitivity_pruning module
- Module contents
- sparseml.pytorch.sparsification package
- sparseml.pytorch.utils package
- Subpackages
- Submodules
- sparseml.pytorch.utils.benchmarker module
- sparseml.pytorch.utils.callbacks module
- sparseml.pytorch.utils.exporter module
- sparseml.pytorch.utils.helpers module
- sparseml.pytorch.utils.logger module
- sparseml.pytorch.utils.loss module
- sparseml.pytorch.utils.model module
- sparseml.pytorch.utils.module module
- sparseml.pytorch.utils.ssd_helpers module
- sparseml.pytorch.utils.yolo_helpers module
- Module contents
- Submodules
- sparseml.pytorch.base module
- Module contents
- Subpackages
- sparseml.sparsification package
- sparseml.tensorflow_v1 package
- Subpackages
- sparseml.tensorflow_v1.datasets package
- sparseml.tensorflow_v1.framework package
- sparseml.tensorflow_v1.models package
- sparseml.tensorflow_v1.nn package
- sparseml.tensorflow_v1.optim package
- Submodules
- sparseml.tensorflow_v1.optim.analyzer_module module
- sparseml.tensorflow_v1.optim.manager module
- sparseml.tensorflow_v1.optim.mask_creator_pruning module
- sparseml.tensorflow_v1.optim.mask_pruning module
- sparseml.tensorflow_v1.optim.modifier module
- sparseml.tensorflow_v1.optim.modifier_epoch module
- sparseml.tensorflow_v1.optim.modifier_lr module
- sparseml.tensorflow_v1.optim.modifier_params module
- sparseml.tensorflow_v1.optim.modifier_pruning module
- sparseml.tensorflow_v1.optim.schedule_lr module
- sparseml.tensorflow_v1.optim.sensitivity_pruning module
- Module contents
- sparseml.tensorflow_v1.sparsification package
- sparseml.tensorflow_v1.utils package
- Submodules
- sparseml.tensorflow_v1.base module
- Module contents
- Subpackages
- sparseml.utils package
Submodules¶
sparseml.base module¶
-
class
sparseml.base.
Framework
(value)[source]¶ Bases:
enum.Enum
Framework types known of/supported within the sparseml/deepsparse ecosystem
-
deepsparse
= 'deepsparse'¶
-
keras
= 'keras'¶
-
onnx
= 'onnx'¶
-
pytorch
= 'pytorch'¶
-
tensorflow_v1
= 'tensorflow_v1'¶
-
unknown
= 'unknown'¶
-
-
sparseml.base.
check_version
(package_name: str, min_version: Optional[str] = None, max_version: Optional[str] = None, raise_on_error: bool = True, alternate_package_names: Optional[List[str]] = None) → bool[source]¶ - Parameters
package_name (str) – the name of the package to check the version of
min_version (str) – The minimum version for the package that it must be greater than or equal to, if unset will require no minimum version
max_version (str) – The maximum version for the package that it must be less than or equal to, if unset will require no maximum version.
raise_on_error (bool) – True to raise any issues such as not installed, minimum version, or maximum version as ImportError. False to return the result.
alternate_package_names (Optional[List[str]]) – List of alternate names to look for the package under if package_name is not found. Useful for nightly builds.
- Returns
If raise_on_error, will return False if the package is not installed or the version is outside the accepted bounds and True if everything is correct.
- Return type
bool
-
sparseml.base.
detect_framework
(item: Any) → sparseml.base.Framework[source]¶ Detect the supported ML framework for a given item. Supported input types are the following: - A Framework enum - A string of any case representing the name of the framework
(deepsparse, onnx, keras, pytorch, tensorflow_v1)
A supported file type within the framework such as model files: (onnx, pth, h5, pb)
An object from a supported ML framework such as a model instance
If the framework cannot be determined, will return Framework.unknown
- Parameters
item (Any) – The item to detect the ML framework for
- Returns
The detected framework from the given item
- Return type
-
sparseml.base.
detect_frameworks
(item: Any) → List[sparseml.base.Framework][source]¶ Detects the supported ML frameworks for a given item. Supported input types are the following: - A Framework enum - A string of any case representing the name of the framework
(deepsparse, onnx, keras, pytorch, tensorflow_v1)
A supported file type within the framework such as model files: (onnx, pth, h5, pb)
An object from a supported ML framework such as a model instance
If the framework cannot be determined, an empty list will be returned
- Parameters
item (Any) – The item to detect the ML framework for
- Returns
The detected ML frameworks from the given item
- Return type
List[Framework]
-
sparseml.base.
execute_in_sparseml_framework
(framework: Any, function_name: str, *args, **kwargs) → Any[source]¶ Execute a general function that is callable from the root of the frameworks package under SparseML such as sparseml.pytorch. Useful for benchmarking, analyzing, etc. Will pass the args and kwargs to the callable function.
- Parameters
framework (Any) – The item to detect the ML framework for to run the function under, see detect_frameworks for more details on acceptible inputs
function_name (str) – The name of the function in SparseML that should be run with the given args and kwargs.
args – Any positional args to be passed into the function.
kwargs – Any key word args to be passed into the function.
- Returns
The return value from the executed function.
- Return type
Any
-
sparseml.base.
get_version
(package_name: str, raise_on_error: bool, alternate_package_names: Optional[List[str]] = None) → Optional[str][source]¶ - Parameters
package_name (str) – The name of the full package, as it would be imported, to get the version for
raise_on_error (bool) – True to raise an error if package is not installed or couldn’t be imported, False to return None
alternate_package_names (Optional[List[str]]) – List of alternate names to look for the package under if package_name is not found. Useful for nightly builds.
- Returns
the version of the desired package if detected, otherwise raises an error
- Return type
str
sparseml.log module¶
Root logging file to handle standard logging setups for the package
-
sparseml.log.
get_main_logger
() → logging.Logger[source]¶ - Returns
a main logger that can be used in external scripts for logging in a standard format that is consistent with other loggers in sparseml
sparseml.version module¶
Functionality for storing and setting the version info for SparseML
Module contents¶
Tooling to help train, test, and optimize models for better performance