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

[Feature Request] message_to_prompt -> .apply_chat_template #498

Open
1 of 2 tasks
ocss884 opened this issue Apr 1, 2024 · 1 comment
Open
1 of 2 tasks

[Feature Request] message_to_prompt -> .apply_chat_template #498

ocss884 opened this issue Apr 1, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request Prompt Related to camel prompts

Comments

@ocss884
Copy link
Member

ocss884 commented Apr 1, 2024

Required prerequisites

Motivation

In current support for open-souce models we have a function called message_to_prompt to convert the openai user-assistant alternating format into model corresponding template. I believe it is just what the .apply_chat_template method do. For models which don't have a build-in template or need special treatment we could consider writing a function for these use cases.

ref:
https://huggingface.co/docs/transformers/main/en/chat_templating

def messages_to_prompt(messages: List[OpenAIMessage], model: ModelType) -> str:

Solution

No response

Alternatives

No response

Additional context

No response

@ocss884 ocss884 added enhancement New feature or request Prompt Related to camel prompts labels Apr 1, 2024
@ocss884
Copy link
Member Author

ocss884 commented Apr 2, 2024

Emmm ok I see some inflexibilities of directly applying this method like it cannot apply to a single message but should be a chat history. During inference it is fine since we always fed the whole history to agents, but the rest of the time like how we need it in the score_based.py it just doesn't work. Maybe we should come up a better solution to utilize the tokenizer shipped chat_template and some customization of ours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Prompt Related to camel prompts
Projects
Status: Backlog
Development

No branches or pull requests

2 participants