Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why are all the past messages for any given question -> answer pair included? #11

Open
mainrs opened this issue Jul 1, 2024 · 0 comments

Comments

@mainrs
Copy link

mainrs commented Jul 1, 2024

LlamaGym/llamagym/agent.py

Lines 95 to 107 in 92d7827

for i in range(2, len(messages), 2):
prompt = self.tokenizer.apply_chat_template(
messages[: i + 1], tokenize=False, add_generation_prompt=False
)
conversation_chunks = prompt.split("[/INST] ")
query = "[/INST] ".join(conversation_chunks[:-1]) + "[/INST] "
response = conversation_chunks[-1]
query = self.tokenizer(query, return_tensors="pt").input_ids[0]
response = self.tokenizer(response, return_tensors="pt").input_ids[0]
queries.append(query)
responses.append(response)

The code iterates over every assistant message and forms a query by appending all previous messages to it. I read up on literature and I couldn't find anything that states that training can be done in this way.

I'd assume that one would only use the current question and answer pair.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant