Update demo vllm script and docs
@@ -560,18 +560,18 @@ CUDA_VISIBLE_DEVICES=0 vllm serve rednote-hilab/dots.ocr-1.5 --tensor-parallel-s
|
|||||||
CUDA_VISIBLE_DEVICES=0 vllm serve rednote-hilab/dots.ocr-1.5-svg --tensor-parallel-size 1 --gpu-memory-utilization 0.9 --chat-template-content-format string --served-model-name model --trust-remote-code
|
CUDA_VISIBLE_DEVICES=0 vllm serve rednote-hilab/dots.ocr-1.5-svg --tensor-parallel-size 1 --gpu-memory-utilization 0.9 --chat-template-content-format string --served-model-name model --trust-remote-code
|
||||||
|
|
||||||
# vLLM API Demo
|
# vLLM API Demo
|
||||||
# See dots_ocr/model/inference.py for details on parameter and prompt settings
|
# See dots_ocr/model/inference.py and dots_ocr/utils/prompts.py for details on parameter and prompt settings
|
||||||
# that help achieve the best output quality.
|
# that help achieve the best output quality.
|
||||||
## document parsing
|
## document parsing
|
||||||
python3 ./demo/demo_vllm.py --prompt_mode prompt_layout_all_en
|
python3 ./demo/demo_vllm.py --prompt_mode prompt_layout_all_en
|
||||||
## web parsing
|
## web parsing
|
||||||
|
python3 ./demo/demo_vllm.py --prompt_mode prompt_web_parsing --image_path ./assets/showcase_dots_ocr_1_5/origin/webpage_1.png
|
||||||
## scene spoting
|
## scene spoting
|
||||||
|
python3 ./demo/demo_vllm.py --prompt_mode prompt_scene_spotting --image_path ./assets/showcase_dots_ocr_1_5/origin/scene_1.jpg
|
||||||
## image parsing with svg code
|
## image parsing with svg code
|
||||||
|
python3 ./demo/demo_vllm_svg.py --prompt_mode prompt_image_to_svg
|
||||||
## general qa
|
## general qa
|
||||||
|
python3 ./demo/demo_vllm_general.py
|
||||||
```
|
```
|
||||||
|
|
||||||
### Hugginface inference
|
### Hugginface inference
|
||||||
|
|||||||
|
After Width: | Height: | Size: 164 KiB |
|
After Width: | Height: | Size: 129 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 42 KiB |
|
After Width: | Height: | Size: 112 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 53 KiB |
|
After Width: | Height: | Size: 4.1 MiB |
|
After Width: | Height: | Size: 374 KiB |
@@ -11,6 +11,7 @@ parser = argparse.ArgumentParser()
|
|||||||
parser.add_argument("--ip", type=str, default="localhost")
|
parser.add_argument("--ip", type=str, default="localhost")
|
||||||
parser.add_argument("--port", type=str, default="8000")
|
parser.add_argument("--port", type=str, default="8000")
|
||||||
parser.add_argument("--model_name", type=str, default="rednote-hilab/dots.ocr")
|
parser.add_argument("--model_name", type=str, default="rednote-hilab/dots.ocr")
|
||||||
|
parser.add_argument("--image_path", type=str, default="demo/demo_image1.jpg")
|
||||||
parser.add_argument("--prompt_mode", type=str, default="prompt_layout_all_en",help=(
|
parser.add_argument("--prompt_mode", type=str, default="prompt_layout_all_en",help=(
|
||||||
"Choose a task prompt: "
|
"Choose a task prompt: "
|
||||||
"prompt_layout_all_en=full document layout+OCR to JSON/MD; "
|
"prompt_layout_all_en=full document layout+OCR to JSON/MD; "
|
||||||
@@ -28,7 +29,7 @@ require_version("openai>=1.5.0", "To fix: pip install openai>=1.5.0")
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
addr = f"http://{args.ip}:{args.port}/v1"
|
addr = f"http://{args.ip}:{args.port}/v1"
|
||||||
image_path = "demo/demo_image1.jpg"
|
image_path = args.image_path
|
||||||
prompt = dict_promptmode_to_prompt[args.prompt_mode]
|
prompt = dict_promptmode_to_prompt[args.prompt_mode]
|
||||||
image = Image.open(image_path)
|
image = Image.open(image_path)
|
||||||
response = inference_with_vllm(
|
response = inference_with_vllm(
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ gradio_image_annotation
|
|||||||
PyMuPDF
|
PyMuPDF
|
||||||
openai
|
openai
|
||||||
qwen_vl_utils
|
qwen_vl_utils
|
||||||
transformers==4.51.3
|
transformers==4.56.1
|
||||||
huggingface_hub
|
huggingface_hub
|
||||||
modelscope
|
modelscope
|
||||||
# flash-attn==2.8.0.post2 # to speed up inference need flash-attn
|
# flash-attn==2.8.0.post2 # to speed up inference need flash-attn
|
||||||
|
|||||||