Views
No views yet
(N, 1) — one scale per output channelabsmax / 127.0 per token (row)compressed-tensors (int-quantized)lm_head onlyD[m,n] = a_scale[m] * b_scale[n] * int32_accum[m,n]a_scale[m]: per-token activation scale (computed dynamically at runtime)b_scale[n]: per-channel weight scale (stored in checkpoint)int32_accum[m,n]: INT8 x INT8 accumulated in INT32pip install vllm>=0.6.01from vllm import LLM, SamplingParams
2
3# Load the INT8 W8A8 quantized model
4llm = LLM(
5 model="JongYeop/Llama-3.1-8B-Instruct-INT8-W8A8-Dynamic-Per-Token",
6)
7
8# Generate text
9prompts = ["Hello, my name is"]
10sampling_params = SamplingParams(temperature=0.7, top_p=0.9, max_tokens=100)
11outputs = llm.generate(prompts, sampling_params)
12
13for output in outputs:
14 print(output.outputs[0].text)1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3tokenizer = AutoTokenizer.from_pretrained("JongYeop/Llama-3.1-8B-Instruct-INT8-W8A8-Dynamic-Per-Token")
4model = AutoModelForCausalLM.from_pretrained(
5 "JongYeop/Llama-3.1-8B-Instruct-INT8-W8A8-Dynamic-Per-Token",
6 device_map="auto"
7)
8
9messages = [
10 {"role": "system", "content": "You are a helpful assistant."},
11 {"role": "user", "content": "What is the capital of France?"}
12]
13
14input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device)
15output = model.generate(input_ids, max_new_tokens=100)
16print(tokenizer.decode(output[0], skip_special_tokens=True))recipe.yaml.1quant_stage:
2 quant_modifiers:
3 QuantizationModifier:
4 ignore: ["lm_head"]
5 config_groups:
6 group_0:
7 weights:
8 num_bits: 8
9 type: int
10 strategy: channel # Per-channel (one scale per output channel)
11 dynamic: false
12 symmetric: true
13 input_activations:
14 num_bits: 8
15 type: int
16 strategy: token # Per-token (one scale per row)
17 dynamic: true # Scales computed at runtime
18 symmetric: true
19 targets: ["Linear"]1@software{llm-compressor,
2 title = {LLM Compressor},
3 author = {vLLM Team},
4 url = {https://github.com/vllm-project/llm-compressor},
5 year = {2024}
6}
7
8@article{llama3,
9 title={Llama 3 Model Card},
10 author={AI@Meta},
11 year={2024},
12 url={https://github.com/meta-llama/llama3}
13}