Views
No views yet
SFTTrainer (completion-only loss).posttraining/)### Instruction:
{instruction}
### Response:1from transformers import AutoModelForCausalLM, AutoTokenizer
2
3m = AutoModelForCausalLM.from_pretrained("submarat/gpt2-small-fineweb-edu-10b-sft")
4tok = AutoTokenizer.from_pretrained("submarat/gpt2-small-fineweb-edu-10b-sft")
5
6prompt = "### Instruction:\nList three tips for staying focused while studying.\n\n### Response:\n"
7ids = tok(prompt, return_tensors="pt").input_ids
8out = m.generate(ids, max_new_tokens=80, do_sample=True, top_k=40, temperature=0.7,
9 repetition_penalty=1.3, pad_token_id=tok.eos_token_id)
10print(tok.decode(out[0][ids.shape[1]:], skip_special_tokens=True))submarat/gpt2-small-fineweb-edu-10b (124M, exact-GELU)