from unsloth import FastModel
model, tokenizer = FastModel.from_pretrained(
"Saya72me/kotonone-lora",
max_seq_length=2048, load_in_4bit=True,
)
FastModel.for_inference(model)
if hasattr(tokenizer, "tokenizer"):
tokenizer = tokenizer.tokenizer
enc = tokenizer.apply_chat_template(
[{"role": "user", "content": "あなたは誰ですか?"}],
add_generation_prompt=True, tokenize=True,
return_dict=True, return_tensors="pt", enable_thinking=False,
).to("cuda")
out = model.generate(**enc, max_new_tokens=256, temperature=0.3, top_p=0.9, do_sample=True)
print(tokenizer.decode(out[0][enc["input_ids"].shape[1]:], skip_special_tokens=True))