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 system prompts #38

Merged
merged 1 commit into from
Oct 18, 2024
Merged

fix system prompts #38

merged 1 commit into from
Oct 18, 2024

Conversation

Cmxu
Copy link

@Cmxu Cmxu commented Sep 20, 2024

No description provided.

@Cmxu
Copy link
Author

Cmxu commented Sep 20, 2024

Need to give 'type': 'text' for content. Current implementation causes system prompt to be ignored. For example, with LLaVA-Next-Video:

prompt = [{'role': 'system', 'content': [{'text': 'Be Helpful.'}]}, {'role': 'user', 'content': [{'type': 'text', 'text': 'Help.'}, {'type': 'video'}]}]
processor.apply_chat_template(prompt, add_generation_prompt = True)

Results in
USER: <video>\nHelp. ASSISTANT:

But,

prompt = [{'role': 'system', 'content': [{'type': 'text', 'text': 'Be Helpful.'}]}, {'role': 'user', 'content': [{'type': 'text', 'text': 'Help.'}, {'type': 'video'}]}]
processor.apply_chat_template(prompt, add_generation_prompt = True)

Results in
Be Helpful. USER: <video>\nHelp. ASSISTANT:

@zjysteven
Copy link
Owner

Thank you for the PR and sorry for my late response. This is a good catch. I will investigate a bit before merging it though, because I remember clearly that for some models (e.g., LLaVA-1.5) the system prompts work fine.

@zjysteven zjysteven merged commit b4ee72c into zjysteven:main Oct 18, 2024
danielwusg pushed a commit to sunfanyunn/lmms-finetune that referenced this pull request Nov 18, 2024
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.

2 participants