Views
No views yet
1Below is an instruction that describes a task. Write a response that appropriately completes the request.
2
3### Instruction:
4{your_instruction}
5
6### Response:1from transformers import GPT2LMHeadModel, GPT2Tokenizer
2
3model = GPT2LMHeadModel.from_pretrained("koganrath/LiteGPT-Instruct")
4tokenizer = GPT2Tokenizer.from_pretrained("gpt2")
5
6instruction = "List three primary colors."
7prompt = f"""Below is an instruction that describes a task. Write a response that appropriately completes the request.
8
9### Instruction:
10{instruction}
11
12### Response:
13"""
14
15inputs = tokenizer(prompt, return_tensors="pt")
16outputs = model.generate(**inputs, max_new_tokens=50)
17print(tokenizer.decode(outputs[0], skip_special_tokens=True))