Skip to content

Commit 83b2e7a

Browse files
authored
Add: targets and ignore to sparsity compression config (#159)
1 parent a654f6c commit 83b2e7a

File tree

1 file changed

+6
-1
lines changed
  • src/compressed_tensors/config

1 file changed

+6
-1
lines changed

src/compressed_tensors/config/base.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
from enum import Enum
16-
from typing import Optional
16+
from typing import List, Optional
1717

1818
from compressed_tensors.registry import RegistryMixin
1919
from pydantic import BaseModel
@@ -37,11 +37,16 @@ class SparsityCompressionConfig(RegistryMixin, BaseModel):
3737
Base data class for storing sparsity compression parameters
3838
3939
:param format: name of compression format
40+
:param targets: List of layer names or layer types that aren't sparse and should
41+
be ignored during compression. By default, assume all layers are targeted
42+
:param ignore: List of layer names (unique) to ignore from targets. Defaults to None
4043
:param global_sparsity: average sparsity of the entire model
4144
:param sparsity_structure: structure of the sparsity, such as
4245
"unstructured", "2:4", "8:16" etc
4346
"""
4447

4548
format: str
49+
targets: Optional[List[str]] = None
50+
ignore: Optional[List[str]] = None
4651
global_sparsity: Optional[float] = 0.0
4752
sparsity_structure: Optional[str] = "unstructured"

0 commit comments

Comments
 (0)