TensorRT-LLM icon indicating copy to clipboard operation
TensorRT-LLM copied to clipboard

LLama Int4 AWQ (W4A8) Fails

Open neory9771 opened this issue 2 years ago • 2 comments

System Info

NVIDIA A100-SXM4-80GB x86_64 GNU/Linux TensorRT-LLM version: 0.9.0.dev2024020600

Who can help?

@trac

Information

  • [ ] The official example scripts
  • [X] My own modified scripts

Tasks

  • [ ] An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • [ ] My own task or dataset (give details below)

Reproduction

python3 ../quantization/quantize.py \
--model_dir /data/Llama-2-13B-Chat-fp16 \
--output_dir /data/tensorRT_LLM/13/trt_ckpt/float16/1-gpu_4k_main_w4a8_awq/ \
--dtype float16 \
--qformat w4a8_awq 

Expected behavior

Model quantized

actual behavior

Got an error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/ammo/torch/export/model_config_export.py", line 300, in export_model_config
    for model_config in torch_to_model_config(
  File "/usr/local/lib/python3.10/dist-packages/ammo/torch/export/model_config_export.py", line 178, in torch_to_model_config
    build_decoder_config(layer, model_metadata_config, decoder_type, dtype)
  File "/usr/local/lib/python3.10/dist-packages/ammo/torch/export/layer_utils.py", line 964, in build_decoder_config
    config.attention = build_attention_config(layer, model_metadata_config, dtype, config)
  File "/usr/local/lib/python3.10/dist-packages/ammo/torch/export/layer_utils.py", line 677, in build_attention_config
    config.dense = build_linear_config(layer, LINEAR_ROW, dtype)
  File "/usr/local/lib/python3.10/dist-packages/ammo/torch/export/layer_utils.py", line 640, in build_linear_config
    config.weights_scaling_factor_2 = get_weight_scaling_factor_2(module)
  File "/usr/local/lib/python3.10/dist-packages/ammo/torch/export/layer_utils.py", line 308, in get_weight_scaling_factor_2
    or not module.weight_quantizer.is_enable
  File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1695, in __getattr__
    raise AttributeError(f"'{type(self).__name__}' object has no attribute '{name}'")
AttributeError: 'SequentialQuantizer' object has no attribute 'is_enable'
Searching awq_lite parameters...
Calibrating batch 0
Calibrating batch 0
Quantization done. Total time used: 181.16 s.
torch.distributed not initialized, assuming single world_size.
torch.distributed not initialized, assuming single world_size.
torch.distributed not initialized, assuming single world_size.
torch.distributed not initialized, assuming single world_size.
torch.distributed not initialized, assuming single world_size.
torch.distributed not initialized, assuming single world_size.
torch.distributed not initialized, assuming single world_size.
Cannot export model to the model_config. The AMMO optimized model state_dict (including the quantization factors) is saved to /data/tensorRT_LLM/llama_fetch_pypi_2024-02-08/13/trt_ckpt/float16/1-gpu_4k_main_w4a8_awq/ammo_model.0.pth using torch.save for further inspection.
Detailed export error: 'SequentialQuantizer' object has no attribute 'is_enable'

additional notes

N/A

neory9771 avatar Feb 15 '24 13:02 neory9771

issue fixed after updating tensorrt llm,

neory9771 avatar Feb 16 '24 12:02 neory9771

Hi @khsibr have you encountered this problem? #1104 , I run quantize.py successfully, but i run trtllm-build failed.

littletomatodonkey avatar Feb 20 '24 02:02 littletomatodonkey