Image-Text-to-Text
Transformers
Safetensors
English
Chinese
venusocr
text-generation
ocr
document-parsing
vision-language-model
formula-recognition
table-recognition
speculative-decoding
ptp2
vllm
conversational
custom_code
Instructions to use flow3rdown/VenusOCR with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use flow3rdown/VenusOCR with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="flow3rdown/VenusOCR", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("flow3rdown/VenusOCR", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use flow3rdown/VenusOCR with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "flow3rdown/VenusOCR" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flow3rdown/VenusOCR", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/flow3rdown/VenusOCR
- SGLang
How to use flow3rdown/VenusOCR with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "flow3rdown/VenusOCR" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flow3rdown/VenusOCR", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "flow3rdown/VenusOCR" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "flow3rdown/VenusOCR", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use flow3rdown/VenusOCR with Docker Model Runner:
docker model run hf.co/flow3rdown/VenusOCR
Download scripts/patch_vllm_v0_20_ptp2.sh from flow3rdown/VenusOCR: direct link, hf CLI and curl.
- Browser
- Download file 2.57 kB
-
https://huggingface.co/flow3rdown/VenusOCR/resolve/main/scripts/patch_vllm_v0_20_ptp2.sh
- Command line
-
hf download hf://flow3rdown/VenusOCR/scripts/patch_vllm_v0_20_ptp2.sh
-
curl -L -o patch_vllm_v0_20_ptp2.sh https://huggingface.co/flow3rdown/VenusOCR/resolve/main/scripts/patch_vllm_v0_20_ptp2.sh
2.57 kB
| # Patch vLLM v0.20.x for Speculators PTPv2 + VenusOCR support. | |
| # | |
| # Usage: | |
| # bash scripts/patch_vllm_v0_20_ptp2.sh | |
| # bash scripts/patch_vllm_v0_20_ptp2.sh --package-dir /path/to/site-packages/vllm | |
| # bash scripts/patch_vllm_v0_20_ptp2.sh --check | |
| # bash scripts/patch_vllm_v0_20_ptp2.sh --reverse | |
| set -euo pipefail | |
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| ASSETS_DIR="$SCRIPT_DIR/patches/vllm_v0_20_ptp2" | |
| usage() { | |
| echo "Usage: $0 [--vllm-root PATH | --package-dir PATH] [--venusocr-source PATH] [--no-venusocr] [--check | --reverse]" | |
| } | |
| PACKAGE_DIR="${VLLM_PACKAGE:-}" | |
| VENUSOCR_SOURCE="${VENUSOCR_SOURCE:-$ASSETS_DIR/venusocr.py}" | |
| WITH_VENUSOCR=1 | |
| MODE="patch" | |
| while [[ $# -gt 0 ]]; do | |
| case "$1" in | |
| --vllm-root) PACKAGE_DIR="$2/vllm"; shift 2 ;; | |
| --package-dir) PACKAGE_DIR="$2"; shift 2 ;; | |
| --venusocr-source) VENUSOCR_SOURCE="$2"; shift 2 ;; | |
| --no-venusocr) WITH_VENUSOCR=0; shift ;; | |
| --check) MODE="check"; shift ;; | |
| --reverse) MODE="reverse"; shift ;; | |
| -h|--help) usage; exit 0 ;; | |
| *) echo "[ERROR] Unknown argument: $1" >&2; usage >&2; exit 2 ;; | |
| esac | |
| done | |
| PATCH_PYTHON="${PATCH_PYTHON:-python}" | |
| if [[ -z "$PACKAGE_DIR" ]]; then | |
| PACKAGE_DIR="$("$PATCH_PYTHON" -c 'import importlib.util, pathlib; spec = importlib.util.find_spec("vllm"); assert spec and spec.origin, "vllm not found"; print(pathlib.Path(spec.origin).parent)')" | |
| fi | |
| if [[ ! -f "$PACKAGE_DIR/config/speculative.py" ]]; then | |
| echo "[ERROR] Not a vLLM package directory: $PACKAGE_DIR" >&2 | |
| exit 1 | |
| fi | |
| ARGS=("$PACKAGE_DIR" --assets "$ASSETS_DIR") | |
| if [[ "$MODE" == "check" ]]; then | |
| ARGS+=(--check) | |
| elif [[ "$MODE" == "reverse" ]]; then | |
| ARGS+=(--reverse) | |
| elif [[ "$WITH_VENUSOCR" -eq 1 ]]; then | |
| if [[ ! -f "$VENUSOCR_SOURCE" ]]; then | |
| echo "[ERROR] VenusOCR source not found: $VENUSOCR_SOURCE" >&2 | |
| echo " Pass --venusocr-source PATH or --no-venusocr." >&2 | |
| exit 1 | |
| fi | |
| ARGS+=(--venusocr-source "$VENUSOCR_SOURCE") | |
| fi | |
| "$PATCH_PYTHON" "$ASSETS_DIR/patch_vllm.py" "${ARGS[@]}" | |
| if [[ "$MODE" == "patch" ]]; then | |
| VLLM_PYTHON="${VLLM_PYTHON:-$PATCH_PYTHON}" | |
| "$VLLM_PYTHON" -m py_compile \ | |
| "$PACKAGE_DIR/model_executor/models/qwen3_ptp2.py" \ | |
| "$PACKAGE_DIR/v1/spec_decode/ptp2.py" \ | |
| "$PACKAGE_DIR/transformers_utils/configs/speculators/algos.py" \ | |
| "$PACKAGE_DIR/config/speculative.py" \ | |
| "$PACKAGE_DIR/v1/worker/gpu_model_runner.py" | |
| echo "[OK] Static compilation passed with $VLLM_PYTHON" | |
| fi | |