Views
No views yet


1vllm serve "/PATH/CapRL-3B" \
2 --trust-remote-code \
3 --tensor-parallel-size=1 \
4 --pipeline-parallel-size=1 \
5 --gpu_memory_utilization=0.95 \
6 --served-model-name=caprl \
7 --port 8000 \
8 --host 0.0.0.01import base64
2from openai import OpenAI
3# Set OpenAI's API key and API base to use vLLM's API server.
4openai_api_key = "EMPTY"
5openai_api_base = "http://localhost:8000/v1"
6client = OpenAI(
7 api_key=openai_api_key,
8 base_url=openai_api_base,
9)
10image_path = "/path/to/local/image.png"
11with open(image_path, "rb") as f:
12 encoded_image = base64.b64encode(f.read())
13encoded_image_text = encoded_image.decode("utf-8")
14base64_qwen = f"data:image;base64,{encoded_image_text}"
15chat_response = client.chat.completions.create(
16 model="caprl",
17 messages=[
18 {"role": "system", "content": "You are a helpful assistant."},
19 {
20 "role": "user",
21 "content": [
22 {
23 "type": "image_url",
24 "image_url": {
25 "url": base64_qwen
26 },
27 },
28 {"type": "text", "text": "What is the text in the illustrate?"},
29 ],
30 },
31 ],
32 temperature=1.0,
33 max_tokens=max_tokens,
34 top_p=1.0,
35 extra_body={
36 "repetition_penalty": 1.0,
37 },
38)
39print("Chat response:", chat_response)


