2025-03-10 08:53:56 +01:00
|
|
|
# launch server
|
2025-05-10 09:14:09 -07:00
|
|
|
# python -m sglang.launch_server --model-path Alibaba-NLP/gme-Qwen2-VL-2B-Instruct --is-embedding
|
2025-03-10 08:53:56 +01:00
|
|
|
|
|
|
|
|
import requests
|
|
|
|
|
|
|
|
|
|
url = "http://127.0.0.1:30000"
|
|
|
|
|
|
|
|
|
|
text_input = "Represent this image in embedding space."
|
|
|
|
|
image_path = "https://huggingface.co/datasets/liuhaotian/llava-bench-in-the-wild/resolve/main/images/023.jpg"
|
|
|
|
|
|
|
|
|
|
payload = {
|
|
|
|
|
"model": "gme-qwen2-vl",
|
2025-05-11 23:22:11 +08:00
|
|
|
"input": [{"text": text_input}, {"image": image_path}],
|
2025-03-10 08:53:56 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
response = requests.post(url + "/v1/embeddings", json=payload).json()
|
|
|
|
|
|
|
|
|
|
print("Embeddings:", [x.get("embedding") for x in response.get("data", [])])
|