Richard1999
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,40 @@
|
|
1 |
-
---
|
2 |
-
license: mit
|
3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
---
|
4 |
+
|
5 |
+
## Quick Start
|
6 |
+
|
7 |
+
```python
|
8 |
+
from vllm import LLM, SamplingParams
|
9 |
+
from PIL import Image
|
10 |
+
|
11 |
+
model_name = "RUC-AIBOX/Virgo-72B"
|
12 |
+
placeholder = "<|image_pad|>"
|
13 |
+
llm = LLM(
|
14 |
+
model=model_name,
|
15 |
+
trust_remote_code=True,
|
16 |
+
tensor_parallel_size=8,
|
17 |
+
)
|
18 |
+
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$."
|
19 |
+
prompt = ("<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n"
|
20 |
+
f"<|im_start|>user\n<|vision_start|>{placeholder}<|vision_end|>"
|
21 |
+
f"{question}<|im_end|>\n"
|
22 |
+
"<|im_start|>assistant\n")
|
23 |
+
stop_token_ids = None
|
24 |
+
sampling_params = SamplingParams(
|
25 |
+
temperature=0.0,
|
26 |
+
top_k=1,
|
27 |
+
top_p=1.0,
|
28 |
+
stop_token_ids=stop_token_ids,
|
29 |
+
repetition_penalty=1.05,
|
30 |
+
max_tokens=8192
|
31 |
+
)
|
32 |
+
image = Image.open("case/2246_image_1.jpg")
|
33 |
+
inputs = {
|
34 |
+
"prompt": prompt,
|
35 |
+
"multi_modal_data": {
|
36 |
+
"image": image
|
37 |
+
},
|
38 |
+
}
|
39 |
+
outputs = llm.generate(inputs, sampling_params)
|
40 |
+
print(outputs[0].outputs[0].text)
|