Views
No views yet
1Message: <NPC dialogue>
2Reputation: <reputation delta>
3Abilities: <optional ability or abilities used>| Column | Description |
|---|---|
system_message | NPC identity, job, current location, and abilities |
player_message | Player name, reputation, and message |
ai_message | Target NPC response, reputation change, and abilities used |
1You are controlling a medieval fantasy RPG NPC. Use the NPC identity, location, abilities, and the player's reputation/message to answer exactly in the requested NPC output format.
2
3NPC state:
4Name: Richard
5Job: Stable Hand
6Current_location: Plain : Neutral
7Abilities: "[Flee : Get away from the current area]"
8
9Player input:
10Name: Claire
11Reputation: Bad
12Message: Run while you still can
13
14NPC output:1Message: What is the meaning of this? I'm leaving right now!
2Reputation: -2
3Abilities: "[Flee : Get away from the current area]"1import torch
2from peft import PeftModel
3from transformers import AutoModelForCausalLM, AutoTokenizer
4
5base_model_id = "LiquidAI/LFM2.5-350M"
6adapter_id = "ItsHotdogFred/lfm2.5-350m-npc-lora"
7
8tokenizer = AutoTokenizer.from_pretrained(adapter_id, trust_remote_code=True)
9base_model = AutoModelForCausalLM.from_pretrained(
10 base_model_id,
11 dtype=torch.float16,
12 device_map="auto",
13 trust_remote_code=True,
14)
15model = PeftModel.from_pretrained(base_model, adapter_id)
16model.eval()
17
18prompt = """You are controlling a medieval fantasy RPG NPC. Use the NPC identity, location, abilities, and the player's reputation/message to answer exactly in the requested NPC output format.
19
20NPC state:
21Name: Richard
22Job: Stable Hand
23Current_location: Plain : Neutral
24Abilities: "[Flee : Get away from the current area]"
25
26Player input:
27Name: Claire
28Reputation: Bad
29Message: Run while you still can
30
31NPC output:
32"""
33
34inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
35with torch.no_grad():
36 output_ids = model.generate(
37 **inputs,
38 max_new_tokens=120,
39 do_sample=True,
40 temperature=0.7,
41 top_p=0.9,
42 pad_token_id=tokenizer.eos_token_id,
43 )
44
45generated_ids = output_ids[0, inputs["input_ids"].shape[-1]:]
46print(tokenizer.decode(generated_ids, skip_special_tokens=True).strip())LiquidAI/LFM2.5-350M16320.055123.22e-490/10LiquidAI/LFM2.5-350M. Check the base model card and license terms before commercial use or redistribution.1@misc{vonwerra2022trl,
2 title = {{TRL: Transformer Reinforcement Learning}},
3 author = {Leandro von Werra and Younes Belkada and Lewis Tunstall and Edward Beeching and Tristan Thrush and Nathan Lambert and Shengyi Huang and Kashif Rasul and Quentin GalloueDec},
4 year = 2020,
5 journal = {GitHub repository},
6 publisher = {GitHub},
7 howpublished = {\url{https://github.com/huggingface/trl}}
8}