Views
No views yet
1from vllm import LLM, SamplingParams
2from transformers import AutoTokenizer
3
4model_id = "neuralmagic/Qwen2.5-1.5B-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-1.5B-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-1.5B | Qwen2.5-1.5B-quantized.w8a8 (this model) | Recovery |
| MMLU (5-shot) | 60.98 | 60.35 | 99.0% |
| ARC Challenge (25-shot) | 49.66 | 49.66 | 100.0% |
| GSM-8K (5-shot, strict-match) | 60.96 | 60.12 | 98.6% |
| Hellaswag (10-shot) | 67.65 | 67.72 | 100.1% |
| Winogrande (5-shot) | 65.04 | 66.06 | 101.6% |
| TruthfulQA (0-shot, mc2) | 46.57 | 46.14 | 99.1% |
| Average | 58.48 | 58.34 | 99.8% |