sparseml.framework package

Submodules

sparseml.framework.info module

Functionality related to integrating with, detecting, and getting information for support and sparsification in ML frameworks.

The file is executable and will get the framework info for a given framework:

Compile the available setup and information for a given framework.

positional arguments:
framework the ML framework or path to a framework file to load the

framework info for

optional arguments:
-h, --help

show this help message and exit

--path PATH

A full file path to save the framework info to. If not supplied, will print out the framework info to the console.

class sparseml.framework.info.FrameworkInferenceProviderInfo(*, name: str, description: str, device: str, supported_sparsification: sparseml.sparsification.info.SparsificationInfo = None, available: bool = False, properties: Dict[str, Any] = {}, warnings: List[str] = [])[source]

Bases: pydantic.main.BaseModel

Class for storing information for an inference provider within a frameworks engine. For example, the gpu provider within PyTorch. Extends pydantics BaseModel class for serialization to and from json in addition to proper type checking on construction.

available: bool
description: str
device: str
name: str
properties: Dict[str, Any]
supported_sparsification: Optional[sparseml.sparsification.info.SparsificationInfo]
warnings: List[str]
class sparseml.framework.info.FrameworkInfo(*, framework: sparseml.base.Framework, package_versions: Dict[str, Optional[str]], sparsification: sparseml.sparsification.info.SparsificationInfo = None, inference_providers: List[sparseml.framework.info.FrameworkInferenceProviderInfo] = [], properties: Dict[str, Any] = {}, training_available: bool = False, sparsification_available: bool = False, exporting_onnx_available: bool = False, inference_available: bool = False)[source]

Bases: pydantic.main.BaseModel

Class for storing the information for an ML frameworks info and availability on the current system. Extends pydantics BaseModel class for serialization to and from json in addition to proper type checking on construction.

exporting_onnx_available: bool
framework: sparseml.base.Framework
inference_available: bool
inference_providers: List[sparseml.framework.info.FrameworkInferenceProviderInfo]
package_versions: Dict[str, Optional[str]]
properties: Dict[str, Any]
sparsification: Optional[sparseml.sparsification.info.SparsificationInfo]
sparsification_available: bool
training_available: bool
sparseml.framework.info.framework_info(framework: Any)sparseml.framework.info.FrameworkInfo[source]

Detect the information for the given ML framework such as package versions, availability for core actions such as training and inference, sparsification support, and inference provider support.

Parameters

framework (Any) – The item to detect the ML framework for. See detect_framework() for more information.

Returns

The framework info for the given framework

Return type

FrameworkInfo

sparseml.framework.info.load_framework_info(load: str)sparseml.framework.info.FrameworkInfo[source]

Load the framework info from a file or raw json. If load exists as a path, will read from the file and use that. Otherwise will try to parse the input as a raw json str.

Parameters

load (str) – Either a file path to a json file or a raw json string.

Returns

The loaded framework info.

Return type

FrameworkInfo

sparseml.framework.info.save_framework_info(framework: Any, path: Optional[str] = None)[source]

Save the framework info for a given framework. If path is provided, will save to a json file at that path. If path is not provided, will print out the info.

Parameters
  • framework (Any) – The item to detect the ML framework for. See detect_framework() for more information.

  • path (Optional[str]) – The path, if any, to save the info to in json format. If not provided will print out the info.

Module contents

Functionality related to integrating with, detecting, and getting information for support and sparsification in ML frameworks.