SaylorTwift HF Staff commited on
Commit
1c2fa85
·
verified ·
1 Parent(s): 2a4d2a5

Set LFM2.5 response_template directly (chat template not recognized by add_response_schema)

Browse files
Files changed (1) hide show
  1. train_lora.py +8 -0
train_lora.py CHANGED
@@ -91,6 +91,14 @@ def make_rollout_worker(dataset, tokenizer):
91
 
92
  def main():
93
  tokenizer = AutoTokenizer.from_pretrained(MODEL)
 
 
 
 
 
 
 
 
94
  # The trainer dataset is discovered from the env server, not loaded from the
95
  # Hub: HarborSessionFactory.create() only accepts instructions the server
96
  # itself serves, and prompt_rows() is its blessed export (one row per task,
 
91
 
92
  def main():
93
  tokenizer = AutoTokenizer.from_pretrained(MODEL)
94
+ # LFM2.5-2.6B's chat_template.jinja doesn't byte-match any template TRL's
95
+ # add_response_schema recognizes, and the rollout-loop ctor requires a
96
+ # response parser. TRL ships one purpose-built for LFM2.5's Python-style
97
+ # tool calls; set it directly. (Only the ctor needs it: in loop-owning mode
98
+ # the harness, not TRL, parses responses.)
99
+ from trl.chat_template_utils import lfm2_2_5_template
100
+
101
+ tokenizer.response_template = lfm2_2_5_template
102
  # The trainer dataset is discovered from the env server, not loaded from the
103
  # Hub: HarborSessionFactory.create() only accepts instructions the server
104
  # itself serves, and prompt_rows() is its blessed export (one row per task,