Add Support for Qwen2-VL Multi-modal Embedding Models (#3694)

This commit is contained in:
Pan Lyu
2025-03-07 08:46:20 +08:00
committed by GitHub
parent 13bc39c5d6
commit 361971b859
11 changed files with 356 additions and 34 deletions

View File

@@ -214,13 +214,13 @@ class Engine:
def encode(
self,
prompt: Union[str, List[str], List[Dict], List[List[Dict]]],
image_data: Optional[Union[List[str], str]] = None,
) -> Dict:
"""
The arguments of this function is the same as `sglang/srt/managers/io_struct.py::EmbeddingReqInput`.
Please refer to `EmbeddingReqInput` for the documentation.
"""
obj = EmbeddingReqInput(text=prompt)
obj = EmbeddingReqInput(text=prompt, image_data=image_data)
loop = asyncio.get_event_loop()
generator = self.tokenizer_manager.generate_request(obj, None)
ret = loop.run_until_complete(generator.__anext__())