我在modelscope上通过ollama部署了模型 IAILabs/Qwen2.5-VL-7B-Instruct-GGUF,但是使用 modelscope 上的示例代码调用这个模型报错。
modelscope 上的示例代码是:
from openai import OpenAI
client = OpenAI(
base_url='xxx',
api_key='xxx', # ModelScope Token
)
response = client.chat.completions.create(
model='IAILabs/Qwen2.5-VL-7B-Instruct-GGUF', # ModelScope Model-Id
messages=[{
'role':
'user',
'content': [{
'type': 'text',
'text': '描述这幅图',
}, {
'type': 'image_url',
'image_url': {
'url':
'https://modelscope.oss-cn-beijing.aliyuncs.com/demo/images/audrey_hepburn.jpg',
},
}],
}],
stream=True
)
for chunk in response:
print(chunk.choices[0].delta.content, end='', flush=True)
报错信息是:
openai.BadRequestError: Error code: 400 - {'error': {'code': None, 'message': 'invalid image input', 'param': None, 'type': 'invalid_request_error'}, 'request_id': 'd5165c0c-dda0-41be-9f6c-2ab60f33d524'}
请问这是什么原因?
{"role":"user","content":[{"image":“path/to/img.png”,{"text":“your prompt”}}]}
ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!欢迎加入技术交流群:微信公众号:魔搭ModelScope社区,钉钉群号:44837352