Skip to content

Commit 221de59

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

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/llmcompressor/entrypoints/weights_ptq/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ def ptq_weights(
4040
max_workers: int = 1,
4141
device: Optional[torch.device | str] = None,
4242
):
43+
"""
44+
Name TBD
45+
46+
:param model_stub: huggingface model hub or path to local weights files
47+
:param scheme: weight quantization scheme or preset scheme name
48+
:param ignore: modules to ignore. Modules ending with "norm" are automatically
49+
ignored
50+
:param max_workers: number of worker threads to process files with
51+
:param device: gpu device to accelerate quantization with
52+
"""
4353
# validate arguments
4454
model_files = get_checkpoint_files(model_stub)
4555
scheme_name, scheme = validate_scheme(scheme)
@@ -87,6 +97,16 @@ def _process_file(
8797
ignore: str | list[str],
8898
device: str | torch.device,
8999
) -> tuple[int, dict[str, str]]:
100+
"""
101+
Quantize and compress tensors in a given safetensors file
102+
103+
:param file_path: safetensors file to process
104+
:param save_path: save path of file with quantized weights
105+
:param scheme: quantization scheme to apply to tensors
106+
:param ignore: modules to ignore. Modules ending with "norm" are automatically
107+
ignored
108+
:param device: device used to quantize and compress weights
109+
"""
90110
tensors = load_file(file_path)
91111

92112
for name in list(tensors.keys()):

src/llmcompressor/entrypoints/weights_ptq/model_utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ def get_checkpoint_files(model_stub: str | os.PathLike) -> list[str]:
3030

3131

3232
def walk_file_paths(root_dir: str, ignore: str | None = None) -> list[str]:
33+
"""
34+
Return all file paths relative to the root directory
35+
"""
36+
3337
all_files = []
3438
for dirpath, _, filenames in os.walk(root_dir):
3539
for filename in filenames:

0 commit comments

Comments
 (0)