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

Support conversation_style of openai format (OpenAI API style) #890

Merged
merged 13 commits into from
Apr 28, 2024
Prev Previous commit
Next Next commit
simplify logic with from_dict
xingyaoww committed Apr 28, 2024
commit aa6cd952331f43bfc86d68534fbf8d926b052052
6 changes: 2 additions & 4 deletions torchtune/data/_converters.py
Original file line number Diff line number Diff line change
@@ -106,8 +106,6 @@ def openai_to_llama2_messages(

messages = []
for message in conversations:
role = message["role"]
content = message["content"]
masked = (role != "assistant") and (not train_on_input)
messages.append(Message(role=role, content=content, masked=masked))
message["masked"] = (message["role"] != "assistant") and (not train_on_input)
messages.append(Message.from_dict(message))
return messages