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

support more LaTeX delimiters #3335

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

support more LaTeX delimiters #3335

wants to merge 3 commits into from

Conversation

kai01ai
Copy link

@kai01ai kai01ai commented May 15, 2024

Why are these changes needed?

Certain advanced models, such as GPT/Yi, have the capability to generate LaTeX formulas enclosed within \[...\], but this format is not support yet. This PR add more LaTeX delimiters for better display format in Chatbot Arena.

However, there is a bug while specific this latex_delimiters_set in stream mode, as mentioned in gradio-app/gradio#8006, we should wait the bug fixed then test and merge this PR

Update:
Above bug will not trigger after offline deployed webui test. But there is another bug that markdown is treating \ as escape character first, so \\[ will be rendered as [ first, then it will not match LaTeX delimiters defined in latex_delimiters_set. The solution might be escape model output by replace \\[ with \\\\[ before render...

Related issue number (if applicable)

Checks

  • I've run format.sh to lint the changes in this PR.
  • I've included any doc changes needed.
  • I've made sure the relevant tests are passing (if applicable).

@lisadunlap lisadunlap self-requested a review May 15, 2024 16:36
@kai01ai
Copy link
Author

kai01ai commented May 20, 2024

Ready for review!

Before this patch:
image
After this patch:
image

@kai01ai kai01ai marked this pull request as ready for review May 20, 2024 04:02
@kai01ai
Copy link
Author

kai01ai commented May 20, 2024

cc @lisadunlap

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

1 participant