Views
No views yet
1# pip install transformers accelerate
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4tokenizer = AutoTokenizer.from_pretrained("Llama-2-7b-pruned70-retrained-instruct")
5model = AutoModelForCausalLM.from_pretrained("Llama-2-7b-pruned70-retrained-instruct", device_map="auto")
6
7input_text = "Write a recipe for banana bread:\n"
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-instruct | Llama-2-7b-pruned70-retrained-instruct |
|---|---|---|---|
| MMLU | 5-shot | 48.60% | 42.33% |
| HellaSwag | 10-shot | 79.45% | 77.21% |
| WinoGrande | 5-shot | 75.69% | 71.90% |
| ARC-c | 25-shot | 53.92% | 47.35% |
| TruthfulQA | 0-shot | 43.63% | 42.25% |
| GSM8K | 5-shot | 15.92% | 14.25% |