Views
No views yet
1from vllm import LLM, SamplingParams
2from transformers import AutoTokenizer
3
4model_id = "neuralmagic/Qwen2.5-3B-quantized.w8a8"
5number_gpus = 1
6max_model_len = 8192
7
8sampling_params = SamplingParams(temperature=0.7, top_p=0.8, max_tokens=256)
9
10tokenizer = AutoTokenizer.from_pretrained(model_id)
11
12prompt = "Give me a short introduction to large language model."
13
14llm = LLM(model=model_id, tensor_parallel_size=number_gpus, max_model_len=max_model_len)
15
16outputs = llm.generate(prompt, sampling_params)
17
18generated_text = outputs[0].outputs[0].text
19print(generated_text)lm_eval \
--model vllm \
--model_args pretrained="neuralmagic/Qwen2.5-3B-quantized.w8a8",dtype=auto,gpu_memory_utilization=0.9,add_bos_token=True,max_model_len=4096,enable_chunk_prefill=True,tensor_parallel_size=1 \
--tasks openllm \
--batch_size auto| Benchmark | Qwen2.5-3B | Qwen2.5-3B-quantized.w8a8 (this model) | Recovery |
| MMLU (5-shot) | 65.68 | 64.73 | 98.6% |
| ARC Challenge (25-shot) | 63.59 | 62.86 | 98.9% |
| GSM-8K (5-shot, strict-match) | 68.23 | 66.26 | 97.1% |
| Hellaswag (10-shot) | 74.46 | 74.07 | 99.5% |
| Winogrande (5-shot) | 70.64 | 70.48 | 99.8% |
| TruthfulQA (0-shot, mc2) | 48.93 | 47.93 | 97.9% |
| Average | 63.59 | 62.86 | 98.9% |