Skip to content

Commit f1f0e29

Browse files
committed
model_free_ptq
Signed-off-by: Kyle Sayers <kylesayrs@gmail.com>
1 parent 221de59 commit f1f0e29

File tree

8 files changed

+12
-11
lines changed

8 files changed

+12
-11
lines changed

src/llmcompressor/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
create_session,
2727
reset_session,
2828
)
29-
from llmcompressor.entrypoints import Oneshot, oneshot, train, ptq_weights
29+
from llmcompressor.entrypoints import Oneshot, oneshot, train, model_free_ptq

src/llmcompressor/entrypoints/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@
99

1010
from .oneshot import Oneshot, oneshot
1111
from .train import train
12-
from .weights_ptq import ptq_weights
12+
from .model_free import model_free_ptq
1313
from .utils import post_process, pre_process

src/llmcompressor/entrypoints/weights_ptq/__init__.py renamed to src/llmcompressor/entrypoints/model_free/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,28 @@
1111
from loguru import logger
1212
from safetensors.torch import load_file, save_file
1313

14-
from llmcompressor.entrypoints.weights_ptq.helpers import (
14+
from llmcompressor.entrypoints.model_free.helpers import (
1515
gpu_if_available,
1616
validate_scheme,
1717
)
18-
from llmcompressor.entrypoints.weights_ptq.lifecycle import (
18+
from llmcompressor.entrypoints.model_free.lifecycle import (
1919
calibrate_weights,
2020
compress_module,
2121
initialize_quantized_linear,
2222
)
23-
from llmcompressor.entrypoints.weights_ptq.model_utils import (
23+
from llmcompressor.entrypoints.model_free.model_utils import (
2424
get_checkpoint_files,
2525
is_weights_file,
2626
)
27-
from llmcompressor.entrypoints.weights_ptq.save_utils import (
27+
from llmcompressor.entrypoints.model_free.save_utils import (
2828
update_config,
2929
update_safetensors_index,
3030
)
3131

32-
__all__ = ["ptq_weights"]
32+
__all__ = ["model_free_ptq"]
3333

3434

35-
def ptq_weights(
35+
def model_free_ptq(
3636
model_stub: str | os.PathLike,
3737
save_directory: str | os.PathLike,
3838
scheme: QuantizationScheme | str,
@@ -41,7 +41,8 @@ def ptq_weights(
4141
device: Optional[torch.device | str] = None,
4242
):
4343
"""
44-
Name TBD
44+
Quantize a model without the need for a model definition. This function operates on
45+
a model stub or folder containing weights saved in safetensors files
4546
4647
:param model_stub: huggingface model hub or path to local weights files
4748
:param scheme: weight quantization scheme or preset scheme name
File renamed without changes.

src/llmcompressor/entrypoints/weights_ptq/lifecycle.py renamed to src/llmcompressor/entrypoints/model_free/lifecycle.py

File renamed without changes.

src/llmcompressor/entrypoints/weights_ptq/model_utils.py renamed to src/llmcompressor/entrypoints/model_free/model_utils.py

File renamed without changes.

src/llmcompressor/entrypoints/weights_ptq/save_utils.py renamed to src/llmcompressor/entrypoints/model_free/save_utils.py

File renamed without changes.

tests/llmcompressor/pipelines/test_ptq_weights.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from compressed_tensors.quantization import QuantizationArgs, QuantizationScheme
77
from safetensors.torch import load_file
88

9-
from llmcompressor import oneshot, ptq_weights
9+
from llmcompressor import model_free_ptq, oneshot
1010
from llmcompressor.modifiers.quantization import QuantizationModifier
1111
from tests.testing_utils import requires_gpu
1212

@@ -51,7 +51,7 @@ def test_weights_ptq_e2e(scheme, tmp_path):
5151
ptq_outdir = tmp_path / "weights_out"
5252
oneshot_outdir = tmp_path / "oneshot_out"
5353

54-
ptq_weights(
54+
model_free_ptq(
5555
model,
5656
ptq_outdir,
5757
scheme=scheme,

0 commit comments

Comments
 (0)