Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion skyrl-train/skyrl_train/generators/skyrl_gym_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ async def agent_loop(

# init() returns the first prompt to be given to the model, and optional metadata dict
chat_history, _ = env.init(chat_history)
initial_chat_history_length = len(chat_history)
chat_end_index = len(chat_history)
input_ids = self.tokenizer.apply_chat_template(
chat_history,
Expand Down Expand Up @@ -221,7 +222,7 @@ async def agent_loop(
prompt_ids = input_ids[:initial_prompt_length]
if retokenize_chat_history:
response_encodings = self.tokenizer.apply_chat_template(
chat_history[len(prompt) :],
chat_history[initial_chat_history_length:],
chat_template=self.custom_chat_template,
add_generation_prompt=False,
return_dict=True,
Expand Down