Views
No views yet
1# pip install transformers accelerate
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4tokenizer = AutoTokenizer.from_pretrained("neuralmagic/Llama-2-7b-pruned70-retrained")
5model = AutoModelForCausalLM.from_pretrained("neuralmagic/Llama-2-7b-pruned70-retrained", device_map="auto")
6
7input_text = "Write me a poem about Machine Learning."
8input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
9
10outputs = model.generate(**input_ids)
11print(tokenizer.decode(outputs[0]))| Benchmark | Metric | Llama-2-7b | Llama-2-7b-pruned70-retrained |
|---|---|---|---|
| MMLU | 5-shot | 46.9% | 36.5% |
| HellaSwag | 0-shot | 78.6% | 74.1% |
| WinoGrande | 5-shot | 74.0% | 69.5% |
| ARC-c | 25-shot | 53.1% | 45.4% |
| TruthfulQA | 5-shot | 38.8% | 36.7% |
| GSM8K | 5-shot | 14.5% | 8.0% |
| HumanEval | pass@1 | 13.4% | 14.4% |