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

Fix Llama2 formatting #1997

Merged
merged 1 commit into from
Jul 19, 2023
Merged

Fix Llama2 formatting #1997

merged 1 commit into from
Jul 19, 2023

Conversation

ruanslv
Copy link
Contributor

@ruanslv ruanslv commented Jul 18, 2023

Following: https://github.com/facebookresearch/llama/blob/cfc3fc8c1968d390eb830e65c63865e980873a06/llama/generation.py#L212

  • Double spacing in sys prompt
  • No need for whitespace between system prompt and first message
  • Whitespace needed between assistant message and EOS token

@ruanslv
Copy link
Contributor Author

ruanslv commented Jul 18, 2023

@merrymercy @infwinston

@infwinston
Copy link
Member

infwinston commented Jul 18, 2023

@ruanslv thanks, looking into it, just one question about the double spaces
https://github.com/facebookresearch/llama/blob/cfc3fc8c1968d390eb830e65c63865e980873a06/llama/generation.py#L47C88-L47C112

, while being safe.  Your answers 

@@ -847,17 +847,17 @@ def get_conv_template(name: str) -> Conversation:
register_conv_template(
Conversation(
name="llama-2",
system="<s>[INST] <<SYS>>\nYou are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. "
system="<s>[INST] <<SYS>>\nYou are a helpful, respectful and honest assistant. Always answer as helpfully as possible, while being safe. "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or is that a typo in llama repo?

Copy link
Member

@infwinston infwinston left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming the double space in the official llama repo is typo given you are the author. I'll merge this now. Thanks a lot for fixing the format! @ruanslv

@infwinston infwinston merged commit 974537e into lm-sys:main Jul 19, 2023
1 check passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants