post_init_sparse
Classes
- class SparsityMethod
Bases:
object- apply_masks(model, mask_dict)
- Parameters:
model (Module)
mask_dict (dict[str, Tensor])
- Return type:
None
- calculate_masks(state_dict)
Gets a model state_dict, returns a state_dict-like mask_dict with masks
- Parameters:
state_dict (dict[str, Tensor])
- Return type:
dict[str, Tensor]
- do_sparsity(model, mask_dict=None)
- Parameters:
model (Module)
- filter_function()
- static fix_state_dict_inplace(state_dict, verbose=False, change_dtype=False)
- class SparsityMethod2o4
Bases:
SparsityMethod- calculate_masks(state_dict)
Gets a model state_dict, returns a state_dict-like mask_dict with masks
- Parameters:
state_dict (dict[str, Tensor])
- Return type:
dict[str, Tensor]
- create_mask(score, value=0)
- static filter_function(name, modules_to_sparsify_in_block)