Views
No views yet
gpt2 using vicgalle/alpaca-gpt4i only use the inputs from 1 to i but not the future tokens.1>>> from transformers import AutoTokenizer, AutoModelForCausalLM
2>>> model_name = "Sharathhebbar24/convo_bot_gpt2"
3>>> model = AutoModelForCausalLM.from_pretrained(model_name)
4>>> tokenizer = AutoTokenizer.from_pretrained("gpt2")
5>>> def generate_text(prompt):
6>>> inputs = tokenizer.encode(prompt, return_tensors='pt')
7>>> outputs = mod1.generate(inputs, max_length=64, pad_token_id=tokenizer.eos_token_id)
8>>> generated = tokenizer.decode(outputs[0], skip_special_tokens=True)
9>>> return generated
10>>> prompt = """
11>>> Below is an instruction that describes a task. Write a response that appropriately completes the request.
12>>> ### Instruction: Who is the world's most famous painter?
13>>> ###
14>>> """
15>>> res = generate_text(prompt)
16>>> res| Metric | Value |
|---|---|
| Avg. | 28.30 |
| AI2 Reasoning Challenge (25-Shot) | 22.35 |
| HellaSwag (10-Shot) | 31.07 |
| MMLU (5-Shot) | 26.12 |
| TruthfulQA (0-shot) | 38.71 |
| Winogrande (5-shot) | 51.54 |
| GSM8k (5-shot) | 0.00 |