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

Implement v2.llama3 grammar sampling + some API request edge cases error handling #189

Merged
merged 8 commits into from
May 16, 2024

Conversation

jeffreymeetkai
Copy link
Collaborator

  • Implement v2.llama3 grammar sampling
  • Adjust v2 grammar sampling
  • Implement error handling for some API request edge cases

v2 FSM:
image
v2.llama3 FSM:
image

)[0]
+ prompt_template.fn_param_sep_token
)
final_prompt += "all" + prompt_template.fn_param_sep_token
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we create another abstract class for get_force_text_response_prefix() --> "" by default
and in template_v2, we will overwrite this by returning: "all\n". So in the future, if we change the template we don't have to if-else at this ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure ok

return ["<|start_header_id|>assistant<|end_header_id|>\n\n"]

def get_stop_tokens_for_generation(self) -> List[str]:
return ["<|eot_id|>", "<|end_of_text|>"]

def get_start_of_function_call_token(self) -> str:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can remove this, right ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, not sure why it was here. Removed

@@ -312,3 +553,4 @@ def get_chat_template_jinja(self) -> str:

def get_force_function_call_prefix(self, function_name: str):
return f"{self.function_separator}{function_name}\n"
return f"{self.function_separator}{function_name}\n"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh why made it repeated ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it was accidental. Removed

@jeffreymeetkai jeffreymeetkai merged commit 7eb4f58 into main May 16, 2024
3 checks passed
@jeffreymeetkai jeffreymeetkai deleted the functionary-v2.5-grammar-sampling branch May 16, 2024 10:10
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.

3 participants