llmcompressor.pytorch.utils.sparsification
Helper functions for retrieving information related to model sparsification
Classes:
-
ModuleSparsificationInfo
–Helper class for providing information related to torch Module parameters
ModuleSparsificationInfo
Helper class for providing information related to torch Module parameters and the amount of sparsification applied. Includes information for pruning and quantization
Parameters:
-
module
Module
) –torch Module to analyze
-
state_dict
Optional[Dict[str, Tensor]]
, default:None
) –optional state_dict to analyze in place of the torch model. This is used when analyzing an FSDP model, where the full weights may not be accessible
Attributes:
-
params_quantized
(int
) –:return: number of parameters across quantized layers
-
params_quantized_percent
(float
) –:return: percentage of parameters that have been quantized
-
params_sparse
(int
) –:return: total number of sparse (0) trainable parameters in the model
-
params_sparse_percent
(float
) –:return: percent of sparsified parameters in the entire model
-
params_total
(int
) –:return: total number of trainable parameters in the model
Source code in llmcompressor/pytorch/utils/sparsification.py
params_quantized property
Returns:
-
int
–number of parameters across quantized layers
params_quantized_percent property
Returns:
-
float
–percentage of parameters that have been quantized
params_sparse property
Returns:
-
int
–total number of sparse (0) trainable parameters in the model
params_sparse_percent property
Returns:
-
float
–percent of sparsified parameters in the entire model