modelscope / ms-swift

Use PEFT or Full-parameter to finetune 400+ LLMs or 100+ MLLMs. (LLM: Qwen2.5, Llama3.2, GLM4, Internlm2.5, Yi1.5, Mistral, Baichuan2, DeepSeek, Gemma2, ...; MLLM: Qwen2-VL, Qwen2-Audio, Llama3.2-Vision, Llava, InternVL2, MiniCPM-V-2.6, GLM4v, Xcomposer2.5, Yi-VL, DeepSeek-VL, Phi3.5-Vision, ...)
https://swift.readthedocs.io/zh-cn/latest/Instruction/index.html
Apache License 2.0
4.16k stars 368 forks source link

Paligemma deployment: OpenAI chat template failing #1567

Closed utkarsh995 closed 3 months ago

utkarsh995 commented 3 months ago

I have deployed deployed paligemma-3b-mix-448 using: swift deploy --model_type paligemma-3b-mix-448

On calling the completions API using curl: curl http://localhost:8000/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "paligemma-3b-mix-448", "messages": [{"role": "user", "content": "Picture 1:<img>https://modelscope-open.oss-cn-hangzhou.aliyuncs.com/images/rose.jpg</img>\nWhat kind of flower is in the picture and how many are there?"}], "max_tokens": 256, "temperature": 0 }'

or

curl http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" -d '{ "model": "paligemma-3b-mix-448", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "caption" }, { "type": "image_url", "image_url": { "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg" } } ] } ] }'

I am getting the following error in output: {"message":"The chat templatepaligemmacorresponding to the modelpaligemma-3b-mix-448is in text generation format. Please use thecompletionsAPI.","object":"error"}

What do I need to modify? Can I get a sample OpenAI API format request which works for paligemma(specifically paligemma-3b-mix-448) model?

Jintao-Huang commented 3 months ago

http://localhost:8000/v1/completions

This is a base model.