Skip to content

Commit 1520a25

Browse files
committed
Use deprecated decorator instead of manual deprecation warning
Signed-off-by: Fynn Schmitt-Ulms <[email protected]>
1 parent 074475e commit 1520a25

File tree

1 file changed

+5
-14
lines changed
  • src/compressed_tensors/quantization/lifecycle

1 file changed

+5
-14
lines changed

src/compressed_tensors/quantization/lifecycle/apply.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
infer_quantization_status,
3939
is_kv_cache_quant_scheme,
4040
)
41-
from compressed_tensors.utils.helpers import replace_module
41+
from compressed_tensors.utils.helpers import deprecated, replace_module
4242
from compressed_tensors.utils.match import match_named_modules, match_targets
4343
from compressed_tensors.utils.offload import update_parameter_data
4444
from compressed_tensors.utils.safetensors_load import get_safetensors_folder
@@ -243,15 +243,14 @@ def apply_quantization_status(model: Module, status: QuantizationStatus):
243243
model.apply(compress_quantized_weights)
244244

245245

246+
@deprecated(
247+
message="This function is deprecated and will be removed in a future release."
248+
"Please use `match_targets` from `compressed_tensors.utils.match` instead."
249+
)
246250
def find_name_or_class_matches(
247251
name: str, module: Module, targets: Iterable[str], check_contains: bool = False
248252
) -> List[str]:
249253
"""
250-
DEPRECATED: Use `match_targets` instead.
251-
252-
This function is deprecated and will be removed in a future release.
253-
Please use `match_targets` from `compressed_tensors.utils.match` instead.
254-
255254
Returns all targets that match the given name or the class name.
256255
Returns empty list otherwise.
257256
The order of the output `matches` list matters.
@@ -260,14 +259,6 @@ def find_name_or_class_matches(
260259
2. matches on regex patterns
261260
3. matches on module names
262261
"""
263-
import warnings
264-
265-
warnings.warn(
266-
"find_name_or_class_matches is deprecated and will be removed in a future release. "
267-
"Please use compressed_tensors.utils.match.match_targets instead.",
268-
DeprecationWarning,
269-
stacklevel=2,
270-
)
271262
if check_contains:
272263
raise NotImplementedError(
273264
"This function is deprecated, and the check_contains=True option has been removed."

0 commit comments

Comments
 (0)