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] Adds basic support for image content in OpenAI chat routes #113

Merged
merged 5 commits into from
Jan 30, 2024
Merged

[Feature] Adds basic support for image content in OpenAI chat routes #113

merged 5 commits into from
Jan 30, 2024

Conversation

fozziethebeat
Copy link
Contributor

This adds piping so that OpenAI Chat Requests can forward input images to be properly processed by LLaVa type models. This includes a bit of piping, expanded OpenAI request types (copied from openai-python) and some testing.

I've tested this manually by running:

python3 -m sglang.launch_server --model-path liuhaotian/llava-v1.5-7b --tokenizer-path llava-hf/llava-1.5-7b-hf --chat-template vicuna_v1.1 --port 30000

and

python test/srt/test_openai_server.py

Output came out as expected:

 Paris. The country is known for its rich history, art, culture, and cuisine. It is also home to the
 United Nations Educational,
 Paris. The country is known for its rich history, art, culture, and cuisine. It is also home to the
 United Nations Educational,
 The capital of France is Paris. (pronounced "Par-ee")
 The image displays a graph with various data points, including a line that goes from 0 to 100.

There are several other lines on
 1. United States - Washington D.C.
2. Canada - Ottawa
3. Mexico - Mexico City

python/sglang/srt/conversation.py Outdated Show resolved Hide resolved
python/sglang/srt/server.py Show resolved Hide resolved
Copy link
Contributor

@comaniac comaniac left a comment

Choose a reason for hiding this comment

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

LGTM. I'll leave to others for the change in tokenizer manager.

@merrymercy merrymercy merged commit 1d0fbe8 into sgl-project:main Jan 30, 2024
@merrymercy
Copy link
Contributor

@fozziethebeat Thanks!

@fozziethebeat
Copy link
Contributor Author

Thanks for taking the contribution!

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