=================================== FAILURES ===================================
________________ test_llmcompressor_static_fp8_attention_config ________________
dataloader = <test.helpers.DataLoader object at 0x7644d9faf980>
tmp_path = PosixPath('/tmp/pytest-of-hostuser/pytest-6/test_llmcompressor_static_fp8_1')
def test_llmcompressor_static_fp8_attention_config(dataloader, tmp_path):
model_name = get_model_path("stas/tiny-random-llama-2")
autoround = AutoRound(
model_name,
scheme="FP8_STATIC",
seqlen=8,
nsamples=2,
iters=0,
dataset=dataloader,
static_attention_dtype="fp8",
)
_, quantized_model_path = autoround.quantize_and_save(tmp_path, format="llm_compressor")
with open(os.path.join(quantized_model_path, "config.json")) as f:
saved_config = json.load(f)
saved_groups = saved_config["quantization_config"]["config_groups"]
attention_group = None
for group in saved_groups.values():
if "Linear" not in group["targets"]:
attention_group = group
break
assert attention_group is not None
assert attention_group["weights"] is None
assert attention_group["input_activations"]["num_bits"] == 8
assert attention_group["input_activations"]["type"] == "float"
assert attention_group["input_activations"]["strategy"] == "tensor"
assert attention_group["input_activations"]["dynamic"] is False
assert attention_group["input_activations"]["symmetric"] is True
assert saved_config["quantization_config"]["kv_cache_scheme"] is not None
> model = AutoModelForCausalLM.from_pretrained(quantized_model_path, torch_dtype="auto", trust_remote_code=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
test_cpu/export/test_llmc_format.py:310:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../auto_round/utils/common.py:140: in patched
return underlying_func(klass, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/home/hostuser/.venv/lib/python3.12/site-packages/transformers/models/auto/auto_factory.py:402: in from_pretrained
return model_class.from_pretrained(
/home/hostuser/.venv/lib/python3.12/site-packages/transformers/modeling_utils.py:4416: in from_pretrained
hf_quantizer.preprocess_model(
/home/hostuser/.venv/lib/python3.12/site-packages/transformers/quantizers/base.py:171: in preprocess_model
self._process_model_before_weight_loading(model, **kwargs)
/home/hostuser/.venv/lib/python3.12/site-packages/transformers/quantizers/quantizer_compressed_tensors.py:72: in _process_model_before_weight_loading
self.compressor.compress_model(model=model)
/home/hostuser/.venv/lib/python3.12/site-packages/compressed_tensors/compressors/model_compressors/model_compressor.py:169: in compress_model
compress_module(module, self.force_compression_format)
/home/hostuser/.venv/lib/python3.12/site-packages/compressed_tensors/compressors/base.py:193: in compress_module
compressor.compress_module(module)
/home/hostuser/.venv/lib/python3.12/site-packages/compressed_tensors/compressors/base.py:109: in compress_module
compressed_state_dict = cls.compress(state_dict, scheme)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'compressed_tensors.compressors.naive_quantized.base.FloatQuantizationCompressor'>
state_dict = {'q_scale': tensor(..., device='meta', size=(1,), dtype=torch.bfloat16), 'k_scale': tensor(..., device='meta', size=(1,), dtype=torch.bfloat16), 'v_scale': tensor(..., device='meta', size=(1,), dtype=torch.bfloat16)}
scheme = QuantizationScheme(targets=['LlamaAttention'], weights=None, input_activations=QuantizationArgs(num_bits=8, type='floa...s_minmax', observer_kwargs={}), output_activations=None, format=<CompressionFormat.float_quantized: 'float-quantized'>)
@classmethod
def compress(
cls, state_dict: TensorStateDict, scheme: QuantizationScheme
) -> TensorStateDict:
"""
Compress a per-module state dict.
Quantizes the weight to the dtype specified by the scheme's
QuantizationArgs. Handles block quantization padding if needed.
:param state_dict: local-name state dict (weight, weight_scale, …)
:param scheme: quantization scheme for the weight
:return: compressed state dict
"""
state_dict = state_dict.copy()
> weight = state_dict.pop("weight")
^^^^^^^^^^^^^^^^^^^^^^^^
E KeyError: 'weight'
/home/hostuser/.venv/lib/python3.12/site-packages/compressed_tensors/compressors/naive_quantized/base.py:63: KeyError
Error log: https://dev.azure.com/lpot-inc/neural-compressor/_build/results?buildId=69556&view=logs&j=12b2e751-7154-5290-1608-528fefa418c8&t=9b52bf1f-13f5-5471-05d0-3b24c18057e6&l=3573
Root cause: vllm-project/compressed-tensors@2aeeccd