Skip to content

Commit

Permalink
revert changes not needed for compression
Browse files Browse the repository at this point in the history
  • Loading branch information
Sara Adkins committed Sep 3, 2024
1 parent ea9e927 commit 1c3ad5c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion src/transformers/modeling_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4035,7 +4035,7 @@ def from_pretrained(
dispatch_model(model, **device_map_kwargs)

if hf_quantizer is not None:
hf_quantizer.postprocess_model(model, resolved_archive_file=resolved_archive_file)
hf_quantizer.postprocess_model(model)
model.hf_quantizer = hf_quantizer

if _adapter_model_path is not None:
Expand Down
8 changes: 0 additions & 8 deletions src/transformers/quantizers/quantizer_compressed_tensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@ def _is_compressed_key(key: str) -> bool:

return [key for key in unexpected_keys if not _is_compressed_key(key)]

def update_missing_keys(self, model, missing_keys: List[str], prefix: str) -> List[str]:
def _is_decompressed_key(key: str) -> bool:
# key names in decompressed state dict that will not be present in
# a compressed state dict
return key.endswith("weight") or "scale" in key or "zero_point" in key

return [key for key in missing_keys if not _is_decompressed_key(key)]

def _process_model_before_weight_loading(self, model, **kwargs):
from compressed_tensors.quantization import apply_quantization_config

Expand Down

0 comments on commit 1c3ad5c

Please sign in to comment.