Views
No views yet
1from vllm import LLM, SamplingParams
2from transformers import AutoTokenizer
3
4model_id = "neuralmagic/Qwen2.5-0.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-0.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-0.5B | Qwen2.5-0.5B-quantized.w8a8 (this model) | Recovery |
| MMLU (5-shot) | 47.57 | 47.35 | 99.5% |
| ARC Challenge (25-shot) | 34.90 | 34.47 | 98.8% |
| GSM-8K (5-shot, strict-match) | 34.19 | 34.19 | 100.0% |
| Hellaswag (10-shot) | 51.83 | 51.63 | 99.6% |
| Winogrande (5-shot) | 55.80 | 55.64 | 99.7% |
| TruthfulQA (0-shot, mc2) | 39.90 | 40.32 | 101.1% |
| Average | 44.03 | 43.93 | 99.8% |