|
--- |
|
license: mit |
|
--- |
|
|
|
## Quick Start |
|
|
|
```python |
|
from vllm import LLM, SamplingParams |
|
from PIL import Image |
|
|
|
model_name = "RUC-AIBOX/Virgo-72B" |
|
placeholder = "<|image_pad|>" |
|
llm = LLM( |
|
model=model_name, |
|
trust_remote_code=True, |
|
tensor_parallel_size=8, |
|
) |
|
question = "Please first think deeply about the question, and then put the final answer in \\boxed{}.\nIn the diagram, $\\angle E A D=90^{\\circ}, \\angle A C D=90^{\\circ}$, and $\\angle A B C=90^{\\circ}$. Also, $E D=13, E A=12$, $D C=4$, and $C B=2$. Determine the length of $A B$." |
|
prompt = ("<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n" |
|
f"<|im_start|>user\n<|vision_start|>{placeholder}<|vision_end|>" |
|
f"{question}<|im_end|>\n" |
|
"<|im_start|>assistant\n") |
|
stop_token_ids = None |
|
sampling_params = SamplingParams( |
|
temperature=0.0, |
|
top_k=1, |
|
top_p=1.0, |
|
stop_token_ids=stop_token_ids, |
|
repetition_penalty=1.05, |
|
max_tokens=8192 |
|
) |
|
image = Image.open("case/2246_image_1.jpg") |
|
inputs = { |
|
"prompt": prompt, |
|
"multi_modal_data": { |
|
"image": image |
|
}, |
|
} |
|
outputs = llm.generate(inputs, sampling_params) |
|
print(outputs[0].outputs[0].text) |
|
|