Skip to content

Commit

Permalink
Rename is_target to is_sparse_target
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-tuli committed Dec 23, 2024
1 parent 9bc14b6 commit ef46c4f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/compressed_tensors/quantization/lifecycle/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"apply_quantization_status",
"find_name_or_class_matches",
"expand_sparse_target_names",
"is_target",
"is_sparse_target",
]

from compressed_tensors.quantization.utils.helpers import is_module_quantized
Expand Down Expand Up @@ -265,11 +265,11 @@ def expand_sparse_target_names(
return {
name
for name, module in iter_named_leaf_modules(model)
if is_target(name, module, targets, ignore)
if is_sparse_target(name, module, targets, ignore)
}


def is_target(
def is_sparse_target(
name: str, module: Module, targets: Iterable[str], ignore: Iterable[str]
) -> bool:
"""
Expand Down
4 changes: 2 additions & 2 deletions tests/test_quantization/lifecycle/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
apply_quantization_config,
apply_quantization_status,
expand_sparse_target_names,
is_target,
is_sparse_target,
)
from compressed_tensors.quantization.utils import iter_named_leaf_modules
from tests.testing_utils import requires_accelerate
Expand Down Expand Up @@ -361,5 +361,5 @@ def test_expand_targets_with_llama_stories(
],
)
def test_is_target_with_mock(mock_module, name, targets, ignore, expected):
result = is_target(name, mock_module, targets, ignore)
result = is_sparse_target(name, mock_module, targets, ignore)
assert result == expected

0 comments on commit ef46c4f

Please sign in to comment.