Skip to content

[BUG] BLOCK_SIZE doesn't take effect before quantization #565

Closed

Description

@Hongbosherlock

When I using NVIDIA AMMO toolkit for AWQ weight quantization.
I run

# Quantize HF LLaMA 7B checkpoint into INT4 AWQ format
python quantize.py --model_dir ./tmp/llama/7B \
                --dtype float16 \
                --qformat int4_awq \
                --export_path ./quantized_int4-awq \
                --calib_size 32

then in https://github.com/NVIDIA/TensorRT-LLM/blob/main/examples/llama/quantize.py#L61C5-L61C18

print(batch_encoded.shape)

I got torch.Size([32, 1195])

I found that the maximum length of these 32 samples after applying 'tokenizer.encode()' is 1195. All samples have been padded to a length of 1195 instead of being truncated to 512.

So, It seems that the block_size=512 here didn't take effect.
https://github.com/NVIDIA/TensorRT-LLM/blob/main/examples/llama/quantize.py#L37

Activity

  1. changed the title [-][BUG] BLOCK_SIZE don't take effect before quantization[/-] [+][BUG] BLOCK_SIZE doesn't take effect before quantization[/+] on Dec 5, 2023
  2. Hongbosherlock commented on Dec 5, 2023

    @Hongbosherlock
    Author

    llm-awq re-organize the calib data so that every batch has the same sequence length and there's no need for padding.
    see here:https://github.com/mit-han-lab/llm-awq/blob/main/awq/utils/calib_data.py
    I don't know if it will affect the positional_embedding and further affect the data distribution during calibration.

  3. added
    triaged
    Low Precision
    on Dec 7, 2023
  4. Tracin commented on Dec 7, 2023

    @Tracin
    Collaborator

    I do not think this may lead to accuracy problem, but this will consume larger GPU memory. #293 I will make this merged ASAP.

  5. Tracin commented on Dec 13, 2023

    @Tracin
    Collaborator

    I will close this issue, if you have any further problems I will reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Low Precisiontriaged

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions