Skip to content

Conversation

jiqing-feng
Copy link

The commit #415 breaks the llm-compressor save_pretrain
To reproduce it, run the llm-compressor example
python llama3_example.py
error:

Traceback (most recent call last):
  File "/home/sdp/jiqing/llm-compressor/examples/awq/llama_example.py", line 74, in <module>
    model.save_pretrained(SAVE_DIR, save_compressed=True)
  File "/home/sdp/jiqing/llm-compressor/src/llmcompressor/transformers/sparsification/compressed_tensors_utils.py", line 87, in save_pretrained_wrapper
    compressor = get_model_compressor(
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/home/sdp/jiqing/llm-compressor/src/llmcompressor/transformers/sparsification/compressed_tensors_utils.py", line 240, in get_model_compressor
    return ModelCompressor.from_pretrained_model(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.12/site-packages/compressed_tensors/compressors/model_compressors/model_compressor.py", line 201, in from_pretrained_model
    return cls(
           ^^^^
  File "/opt/venv/lib/python3.12/site-packages/compressed_tensors/compressors/model_compressors/model_compressor.py", line 317, in __init__
    for format in self.compression_formats:
TypeError: 'CompressionFormat' object is not iterable

The reason is that the llm-compressor pass quantization_format as a CompressionFormat instead of str here.

The BaseCompressor.load_from_registry can only accept str type, so we need to convert it.

After this PR, the save issue can be fixed.

@jiqing-feng
Copy link
Author

Hi @dsikka . Would you please review this PR? Thanks!

@dsikka
Copy link
Collaborator

dsikka commented Aug 15, 2025

Hi @jiqing-feng this is a bug in llmcompressor. It is resolved here: vllm-project/llm-compressor#1713

@dsikka dsikka closed this Aug 15, 2025
Signed-off-by: jiqing-feng <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants