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

String prompt builder / concrete HuggingEngine #32

Closed
zhudotexe opened this issue Feb 23, 2024 · 0 comments · Fixed by #38
Closed

String prompt builder / concrete HuggingEngine #32

zhudotexe opened this issue Feb 23, 2024 · 0 comments · Fixed by #38
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@zhudotexe
Copy link
Owner

I began some investigation into a concrete HuggingEngine in the hf-concrete-base branch with the release of Chat Templates in Transformers v4.34 but found that it was pretty difficult to work with in the Kani model:

  • "malformatted" chat histories (e.g. two consecutive user messages) raised a raw Jinja2 error
  • difficult to get the token length of one chat message, due to the above (e.g. a chat history of a single asst message)

Instead, I think it's possible to make a more generic ChatMessage[] -> str prompt builder, which would make the lives of anyone who wants to implement a HuggingEngine easier and allow us to refactor the existing example HuggingEngine implementations. Some considerations:

  • ability to translate message types (e.g. FUNCTION -> USER)
  • ability to groupby message types for groupwise wrapping (e.g. USER, USER -> <s> [INST] USER [/INST]; SYSTEM, USER -> <s> [INST] <<SYS>> SYS <</SYS>> USER [/INST])
@zhudotexe zhudotexe added the enhancement New feature or request label Feb 23, 2024
@zhudotexe zhudotexe added this to the 1.0 milestone Feb 23, 2024
@zhudotexe zhudotexe self-assigned this Feb 23, 2024
@zhudotexe zhudotexe mentioned this issue Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant