Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,7 @@ def localversion_func(version: ScmVersion) -> str:
),
("tqdm>=4.66.3,<=4.67.1" if BUILD_TYPE == "release" else "tqdm>=4.66.3"),
("torch>=2.9.0,<=2.10.0" if BUILD_TYPE == "release" else "torch>=2.9.0"),
(
"transformers>=4.56.1,<=4.57.6"
if BUILD_TYPE == "release"
else "transformers>=4.56.1,<=4.57.6"
),
"transformers>=4.56.1",
("datasets>=4.0.0,<=4.4.1" if BUILD_TYPE == "release" else "datasets>=4.0.0"),
(
# auto-round 0.9.1 cannot work with accelerate <1.10.0
Expand All @@ -148,7 +144,7 @@ def localversion_func(version: ScmVersion) -> str:
(
"compressed-tensors==0.13.0"
if BUILD_TYPE == "release"
else "compressed-tensors>=0.13.1a2"
else "compressed-tensors==0.14.1a20260225"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The version for compressed-tensors appears to have a typo in the year. 2026 is in the future, which will likely cause package installation to fail as this version probably doesn't exist. Did you mean to use 2024?

Suggested change
else "compressed-tensors==0.14.1a20260225"
else "compressed-tensors==0.14.1a20240225"

),
],
extras_require={
Expand Down
5 changes: 1 addition & 4 deletions src/llmcompressor/modifiers/transform/smoothquant/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,8 @@ def _resolve_mappings(self, model: Module) -> list[SmoothQuantMapping]:
)

for mapping in self.mappings:
# we deliberately don't use the ignore list when matching mappings
# so that we can handle layers that need smoothing but not all operations
# we only skip if no layers in mapping would be smoothed.
for *nested_balance_layers, smooth_layers in match_modules_set(
model, tree_leaves(mapping)
model, tree_leaves(mapping), ignore=self.ignore
):
if len(smooth_layers) > 1:
raise ValueError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ def save_pretrained_wrapper(
# convert to accelerate offloaded for optimal saving with transformers
to_accelerate(model)

# Remove hf_device_map before saving to avoid a bug where
# transformers builds module_map with HF model keys but then applies
# revert_weight_conversion (which renames keys to checkpoint format)
# causing a KeyError when looking up renamed keys in module_map.
# After to_accelerate(), all parameters are real tensors (not meta,
# because init_hook is skipped), so model.state_dict() can be used
# directly without the module_map offload path.
if hasattr(model, "hf_device_map"):
delattr(model, "hf_device_map")

# save (compressed) model structure
original_save_pretrained.__get__(model, model_class)(
save_directory,
Expand Down
5 changes: 4 additions & 1 deletion src/llmcompressor/utils/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@
from loguru import logger
from safetensors.torch import save_file
from transformers import AutoModelForCausalLM, PreTrainedModel
from transformers.modeling_utils import TORCH_INIT_FUNCTIONS
try:
from transformers.modeling_utils import TORCH_INIT_FUNCTIONS
except ImportError:
from transformers.initialization import TORCH_INIT_FUNCTIONS
from transformers.utils import SAFE_WEIGHTS_INDEX_NAME, WEIGHTS_INDEX_NAME

__all__ = [
Expand Down
Loading