Skip to content

Commit a76563a

Browse files
authored
Replace readme paths with urls (#1097)
## Purpose ## * Files with the `.md` extension are not listed in the [MANIFEST.in](https://github.com/vllm-project/llm-compressor/blob/main/MANIFEST.in), meaning that they will not be included in the LLM Compressor pypi package. This means that references to these files are left dangling for users who have installed from the pypi package. Rather than including `.md` in the package and having to also ship all the large images files associated with them, this PR moves the references to urls hosted by github * While the github url paths may change between versions, this solution works in lieu of a dedicated readthedoc build for each version * This solution also aligns with the practice of other libraries which point to hosted urls rather than file paths * Note that this does not apply to files which are themselves `.md` files, as these files will not be included in the pypi distribution * `src/llmcompressor/transformers/finetune/README.md` * `src/llmcompressor/pipelines/sequential/README.md` ## Changes ## * Replace readme file paths with urls * Small change to `DisableQuantization` to better catch cases where exceptions such as tracing exceptions are triggered ## Testing ## * N/A --------- Signed-off-by: Kyle Sayers <[email protected]>
1 parent 768be88 commit a76563a

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

src/llmcompressor/modifiers/quantization/gptq/base.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ def on_initialize(self, state: State, **kwargs) -> bool:
247247
warnings.warn(
248248
f"Failed to trace {model_name} with inputs {input_names}. For more "
249249
"information on tracing with the sequential pipeline, see "
250-
"`src/llmcompressor/transformers/tracing/GUIDE.md`"
250+
"https://github.com/vllm-project/llm-compressor/blob/main/"
251+
"src/llmcompressor/transformers/tracing/GUIDE.md"
251252
)
252253
if isinstance(exception, unfixable_errors):
253254
raise exception

src/llmcompressor/modifiers/smoothquant/utils.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import functools
2-
import pathlib
32
from collections import namedtuple
43
from typing import Dict, List, Tuple, Union
54

@@ -94,7 +93,10 @@ def wrapper(*args, **kwargs):
9493
try:
9594
return func(*args, **kwargs)
9695
except Exception as original_exception:
97-
readme_location = pathlib.Path(__file__).parent / "README.md"
96+
readme_location = (
97+
"https://github.com/vllm-project/llm-compressor/tree/main/"
98+
"src/llmcompressor/modifiers/smoothquant"
99+
)
98100
raise RuntimeError(
99101
f"Error resolving mappings for given architecture."
100102
f"Please refer to the README at {readme_location} for more information."

src/llmcompressor/utils/helpers.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -1091,9 +1091,11 @@ def DisableQuantization(model: torch.nn.Module):
10911091
"""
10921092
Disable quantization from QuantizationModifier
10931093
"""
1094-
model.apply(disable_quantization)
1095-
yield
1096-
model.apply(enable_quantization)
1094+
try:
1095+
model.apply(disable_quantization)
1096+
yield
1097+
finally:
1098+
model.apply(enable_quantization)
10971099

10981100

10991101
@contextlib.contextmanager

tests/llmcompressor/modifiers/smoothquant/test_utils.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212

1313
@pytest.mark.unit
1414
def test_handle_mapping_resolution_errors():
15-
README_LOCATION = "llmcompressor/modifiers/smoothquant/README.md"
15+
README_LOCATION = (
16+
"https://github.com/vllm-project/llm-compressor/tree/main/"
17+
"src/llmcompressor/modifiers/smoothquant"
18+
)
1619

1720
@handle_mapping_resolution_errors
1821
def func_that_raises_exception():

0 commit comments

Comments
 (0)