Views
No views yet
1# pip install transformers accelerate
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4tokenizer = AutoTokenizer.from_pretrained("neuralmagic/Llama-2-7b-instruct")
5model = AutoModelForCausalLM.from_pretrained("neuralmagic/Llama-2-7b-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-pruned50-retrained-instruct |
|---|---|---|---|
| MMLU | 5-shot, top-1 | xxxx | xxxx |
| HellaSwag | 0-shot | xxxx | xxxx |
| WinoGrande | partial score | xxxx | xxxx |
| ARC-c | xxxx | xxxx | |
| TruthfulQA | 5-shot | xxxx | xxxx |
| HumanEval | pass@1 | xxxx | xxxx |
| GSM8K | maj@1 | xxxx | xxxx |