Run this model with HF Jobs

Run flow3rdown/VenusOCR on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs and TRL to fine-tune https://huggingface.co/flow3rdown/VenusOCR. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/flow3rdown/VenusOCR on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/flow3rdown/VenusOCR. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Quantize for lower memory use

Use HF Jobs to create a 4-bit version of https://huggingface.co/flow3rdown/VenusOCR. Push it to a new model repo, then reload it from there and report its memory footprint. Run `hf jobs --help` first to learn the CLI.
VenusOCR / scripts /patch_vllm_v0_20_ptp2.sh
flow3rdown's picture
Upload folder using huggingface_hub
e096bf2 verified
Raw History Blame Contribute Delete
2.57 kB
#!/usr/bin/env bash
# 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