Image-Text-to-Text
Transformers
Safetensors
qwen3_5
signature-detection
visual-grounding
document-ai
vqa
structured-outputs
pydantic
unsloth
qwen3.5
vllm
conversational
Run this model with HF Jobs
Run OpenTensorLab/Qwen3.5-9B-Signature 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/OpenTensorLab/Qwen3.5-9B-Signature. 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/OpenTensorLab/Qwen3.5-9B-Signature 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/OpenTensorLab/Qwen3.5-9B-Signature. 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/OpenTensorLab/Qwen3.5-9B-Signature. 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.
Instructions to use OpenTensorLab/Qwen3.5-9B-Signature with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenTensorLab/Qwen3.5-9B-Signature with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenTensorLab/Qwen3.5-9B-Signature") 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 AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("OpenTensorLab/Qwen3.5-9B-Signature") model = AutoModelForMultimodalLM.from_pretrained("OpenTensorLab/Qwen3.5-9B-Signature", device_map="auto") 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?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenTensorLab/Qwen3.5-9B-Signature with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenTensorLab/Qwen3.5-9B-Signature" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenTensorLab/Qwen3.5-9B-Signature", "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/OpenTensorLab/Qwen3.5-9B-Signature
- SGLang
How to use OpenTensorLab/Qwen3.5-9B-Signature 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 "OpenTensorLab/Qwen3.5-9B-Signature" \ --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": "OpenTensorLab/Qwen3.5-9B-Signature", "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 "OpenTensorLab/Qwen3.5-9B-Signature" \ --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": "OpenTensorLab/Qwen3.5-9B-Signature", "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" } } ] } ] }' - Unsloth Desktop
- Docker Model Runner
How to use OpenTensorLab/Qwen3.5-9B-Signature with Docker Model Runner:
docker model run hf.co/OpenTensorLab/Qwen3.5-9B-Signature
|
Download README.md from OpenTensorLab/Qwen3.5-9B-Signature: direct link, hf CLI and curl.
- Browser
- Download file 13.4 kB
-
https://huggingface.co/OpenTensorLab/Qwen3.5-9B-Signature/resolve/main/README.md
- Command line
-
hf download hf://OpenTensorLab/Qwen3.5-9B-Signature/README.md
-
curl -L -o README.md https://huggingface.co/OpenTensorLab/Qwen3.5-9B-Signature/resolve/main/README.md
13.4 kB
| license: apache-2.0 | |
| library_name: transformers | |
| pipeline_tag: image-text-to-text | |
| base_model: | |
| - Qwen/Qwen3.5-9B | |
| datasets: | |
| - OpenTensorLab/signature-detection-sft | |
| tags: | |
| - signature-detection | |
| - visual-grounding | |
| - document-ai | |
| - vqa | |
| - structured-outputs | |
| - pydantic | |
| - unsloth | |
| - qwen3.5 | |
| - vllm | |
| # Qwen3.5 Signature Detection & Visual Grounding Suite | |
| Fine-tuned **Qwen3.5** vision-language models (**9B** and **4B**) specialized in document signature verification, signer role attribution, counting, and normalized `[0, 1000]` bounding-box localization. | |
| Trained using **Unsloth** on [`OpenTensorLab/signature-detection-sft`](https://huggingface.co/datasets/OpenTensorLab/signature-detection-sft), this model family outputs deterministic, Pydantic-validated JSON across single-role queries, hard-negative checks, full-page open discovery, and document VQA. | |
| > **Recommended Checkpoint:** **`OpenTensorLab/Qwen3.5-9B-Signature`** (and its **`W4A16`** quantized release) delivers the strongest spatial precision, role disambiguation, and hard-negative rejection performance across complex multi-signer forms and vouchers. | |
| --- | |
| ## Model Family & Available Artifacts | |
| All checkpoints are grouped in the [Qwen3.5 Signature Detection & Visual Grounding Collection](https://huggingface.co/collections/OpenTensorLab/signature-detection): | |
| | Repository | Base Model | Format / Precision | Recommended Use Case | | |
| | :--- | :--- | :--- | :--- | | |
| | **[`OpenTensorLab/Qwen3.5-9B-Signature`](https://huggingface.co/OpenTensorLab/Qwen3.5-9B-Signature)** | `Qwen/Qwen3.5-9B` | Merged `BF16` | Best overall accuracy, fine-grained bounding boxes, and downstream quantization | | |
| | **[`OpenTensorLab/Qwen3.5-9B-Signature-W4A16`](https://huggingface.co/OpenTensorLab/Qwen3.5-9B-Signature-W4A16)** | `Qwen/Qwen3.5-9B` | `W4A16` Quantized | High-throughput production serving on single-GPU setups via `vLLM` | | |
| | **[`OpenTensorLab/Qwen3.5-9B-Signature-Adapter`](https://huggingface.co/OpenTensorLab/Qwen3.5-9B-Signature-Adapter)** | `Qwen/Qwen3.5-9B` | LoRA Adapter (`r=16, alpha=16`) | Lightweight adapter loading or multi-LoRA serving | | |
| | **[`OpenTensorLab/Qwen3.5-4B-Signature`](https://huggingface.co/OpenTensorLab/Qwen3.5-4B-Signature)** | `Qwen/Qwen3.5-4B` | Merged `BF16` | Low-latency / constrained-VRAM document extraction | | |
| | **[`OpenTensorLab/Qwen3.5-4B-Signature-Adapter`](https://huggingface.co/OpenTensorLab/Qwen3.5-4B-Signature-Adapter)** | `Qwen/Qwen3.5-4B` | LoRA Adapter (`r=16, alpha=32`) | Lightweight 4B adapter deployment | | |
| --- | |
| ## Capabilities & Supported Tasks | |
| The models are trained across four complementary document-understanding tasks: | |
| 1. **Positive Grounding (`positive_grounding`):** Verifies whether a specific role (e.g., *Director*, *Secretary*, *Applicant*, *Authorized Signatory*) has signed the document and returns exact `[x1, y1, x2, y2]` coordinates. | |
| 2. **Hard-Negative Rejection (`hard_negative_grounding`):** Accurately returns `"is_present": false` and `"signatures": []` when queried for plausible roles that are absent from the page, suppressing false-positive hallucinations. | |
| 3. **Open Discovery (`open_discovery`):** Scans the entire page (`"Identify and locate all signatures present on this document."`) and extracts every signature alongside its associated role label and bounding box. | |
| 4. **Document VQA (`pure_vqa`):** Answers signature count and signer-role inventory questions in the unified JSON schema. | |
| --- | |
| ## Output JSON Schema | |
| Every response strictly conforms to the following Pydantic schema: | |
| ```json | |
| { | |
| "answer": "Yes, the Director signature is present on this document.", | |
| "is_present": true, | |
| "count": 2, | |
| "signatures": [ | |
| { | |
| "role": "Director", | |
| "bbox_2d": [730, 309, 914, 377] | |
| }, | |
| { | |
| "role": "Director", | |
| "bbox_2d": [788, 809, 942, 882] | |
| } | |
| ] | |
| } | |
| ``` | |
| * **`answer`** (`str`): Natural-language summary answering the prompt. | |
| * **`is_present`** (`bool`): `true` if at least one matching signature is detected; `false` otherwise. | |
| * **`count`** (`int`): Total number of items in `signatures`. | |
| * **`signatures`** (`list[dict]`): | |
| * **`role`** (`str`): Signer role, title, or label associated with the signature. | |
| * **`bbox_2d`** (`list[int]`): `[xmin, ymin, xmax, ymax]` normalized to **`[0, 1000]`** relative to the upright image width and height. | |
| --- | |
| ## Serving & Inference | |
| ### 1. High-Throughput Serving with vLLM | |
| #### Option A: Serving Merged or Quantized Checkpoints (Recommended) | |
| ```bash | |
| vllm serve OpenTensorLab/Qwen3.5-9B-Signature-W4A16 \ | |
| --host 0.0.0.0 \ | |
| --port 8000 \ | |
| --trust-remote-code \ | |
| --max-model-len 16384 \ | |
| --enable-prefix-caching \ | |
| --default-chat-template-kwargs '{"enable_thinking": false}' | |
| ``` | |
| #### Option B: Serving the LoRA Adapter on Top of the Base Model | |
| ```bash | |
| vllm serve OpenTensorLab/Qwen3.5-9B-W4A16-AutoRound-GPTQ \ | |
| --host 0.0.0.0 \ | |
| --port 8000 \ | |
| --enable-lora \ | |
| --lora-modules signature-adapter=OpenTensorLab/Qwen3.5-9B-Signature-Adapter \ | |
| --max-lora-rank 16 \ | |
| --max-loras 1 \ | |
| --trust-remote-code \ | |
| --max-model-len 16384 \ | |
| --enable-prefix-caching \ | |
| --default-chat-template-kwargs '{"enable_thinking": false}' | |
| ``` | |
| > **Note:** When serving with `--lora-modules`, pass (the registered adapter name) in your OpenAI SDK requests instead of the base model ID. For the 4B adapter, swap the base model and path to `Qwen/Qwen3.5-4B` and `OpenTensorLab/Qwen3.5-4B-Signature-Adapter`. | |
| ### 2. Structured Extraction with OpenAI SDK & Pydantic | |
| > **Important:** Ensure input images are EXIF-transposed and rotated upright (`0°`) before inference, as all training coordinates are normalized to upright page orientations. | |
| ```python | |
| import base64 | |
| from io import BytesIO | |
| from openai import OpenAI | |
| from PIL import Image, ImageOps | |
| from pydantic import BaseModel, ConfigDict | |
| class SignatureItem(BaseModel): | |
| model_config = ConfigDict(extra="forbid") | |
| role: str | |
| bbox_2d: list[int] | |
| class SignatureResponse(BaseModel): | |
| model_config = ConfigDict(extra="forbid") | |
| answer: str | |
| is_present: bool | |
| count: int | |
| signatures: list[SignatureItem] | |
| def encode_upright_image(image_path: str) -> tuple[str, int, int]: | |
| img = ImageOps.exif_transpose(Image.open(image_path)).convert("RGB") | |
| width, height = img.size | |
| buf = BytesIO() | |
| img.save(buf, format="JPEG", quality=95) | |
| b64 = base64.b64encode(buf.getvalue()).decode("utf-8") | |
| return b64, width, height | |
| client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY") | |
| b64_img, width, height = encode_upright_image("document.jpg") | |
| completion = client.chat.completions.parse( | |
| model="OpenTensorLab/Qwen3.5-9B-Signature-W4A16", | |
| temperature=0.0, | |
| messages=[ | |
| { | |
| "role": "user", | |
| "content": [ | |
| {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{b64_img}"}}, | |
| {"type": "text", "text": "Identify and locate all signatures present on this document."}, | |
| ], | |
| } | |
| ], | |
| response_format=SignatureResponse, | |
| ) | |
| result: SignatureResponse = completion.choices[0].message.parsed | |
| print(result.model_dump_json(indent=2)) | |
| # Convert normalized [0, 1000] coordinates back to pixel coordinates | |
| for sig in result.signatures: | |
| x1, y1, x2, y2 = sig.bbox_2d | |
| pixel_box = [ | |
| int(x1 / 1000 * width), | |
| int(y1 / 1000 * height), | |
| int(x2 / 1000 * width), | |
| int(y2 / 1000 * height), | |
| ] | |
| print(f"Role: {sig.role} | Pixel Box: {pixel_box}") | |
| ``` | |
| --- | |
| ## Training Details | |
| Both model variants were fine-tuned with **Unsloth** (`gradient_checkpointing: unsloth`, `train_on_completions: true`) on `OpenTensorLab/signature-detection-sft` (12,000 training examples / 2,530 validation examples across orientation-corrected document scans), updating both vision and language layers (`q_proj`, `k_proj`, `v_proj`, `o_proj`, `gate_proj`, `up_proj`, `down_proj`): | |
| | Hyperparameter | Qwen3.5-9B Configuration | Qwen3.5-4B Configuration | | |
| | --- | --- | --- | | |
| | **Max Sequence Length** | `8192` | `8192` | | |
| | **Epochs** | `1` | `1` | | |
| | **Effective Batch Size** | `16` (`batch_size=4`, `grad_accum=4`) | `16` (`batch_size=2`, `grad_accum=8`) | | |
| | **Learning Rate** | `5e-5` (Cosine, `40` warmup steps) | `1e-4` (Cosine, `40` warmup steps) | | |
| | **Optimizer & Weight Decay** | `adamw_8bit`, `0.05` | `adamw_8bit`, `0.02` | | |
| | **LoRA Rank / Alpha** | `r=16`, `alpha=16` (`use_rslora=true`) | `r=16`, `alpha=32` (`use_rslora=true`) | | |
| | **LoRA Dropout** | `0.1` | `0.05` | | |
| | **Fine-Tuned Modules** | Vision + Language (Attention & MLP) | Vision + Language (Attention & MLP) | | |
| --- | |
| ### 🚀 Deploy on RunPod | |
| One-click launch environments pre-configured with PyTorch, CUDA, and dependencies for fine-tuning or quantization. | |
| > 🎁 **Need GPU compute?** Sign up via [RunPod](https://runpod.io?ref=iabrlp7z) and get **$5–$500 in free credits** when you add your first $10. | |
| #### PyTorch 2.15 | |
| | Template | CUDA Version | Docker Image | Template ID | Deploy | | |
| | :--- | :--- | :--- | :--- | :--- | | |
| | **PyTorch 2.15 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.15-runpod` | `0rsw686010` | [](https://runpod.io/console/deploy?template=0rsw686010&ref=iabrlp7z) | | |
| | **PyTorch 2.15 (CUDA 13.4)** | 13.4 | `vishva123/cuda-13.4-pytorch-2.15-runpod` | `0s0rhdfaqy` | [](https://runpod.io/console/deploy?template=0s0rhdfaqy&ref=iabrlp7z) | | |
| #### PyTorch 2.14 | |
| | Template | CUDA Version | Docker Image | Template ID | Deploy | | |
| | :--- | :--- | :--- | :--- | :--- | | |
| | **PyTorch 2.14 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.14-runpod` | `d7lxsa4w9m` | [](https://runpod.io/console/deploy?template=d7lxsa4w9m&ref=iabrlp7z) | | |
| | **PyTorch 2.14 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.14-runpod` | `yk0y6j6rpg` | [](https://runpod.io/console/deploy?template=yk0y6j6rpg&ref=iabrlp7z) | | |
| | **PyTorch 2.14 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.14-runpod` | `gsp4gwx0nw` | [](https://runpod.io/console/deploy?template=gsp4gwx0nw&ref=iabrlp7z) | | |
| #### PyTorch 2.13 | |
| | Template | CUDA Version | Docker Image | Template ID | Deploy | | |
| | :--- | :--- | :--- | :--- | :--- | | |
| | **PyTorch 2.13 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.13-runpod` | `gmlupxnxfk` | [](https://runpod.io/console/deploy?template=gmlupxnxfk&ref=iabrlp7z) | | |
| | **PyTorch 2.13 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.13-runpod` | `y3j8xvk4f4` | [](https://runpod.io/console/deploy?template=y3j8xvk4f4&ref=iabrlp7z) | | |
| | **PyTorch 2.13 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.13-runpod` | `vigpissn5w` | [](https://runpod.io/console/deploy?template=vigpissn5w&ref=iabrlp7z) | | |
| #### PyTorch 2.12 | |
| | Template | CUDA Version | Docker Image | Template ID | Deploy | | |
| | :--- | :--- | :--- | :--- | :--- | | |
| | **PyTorch 2.12 (CUDA 12.6)** | 12.6 | `vishva123/cuda-12.6-pytorch-2.12-runpod` | `ctmz86zmf0` | [](https://runpod.io/console/deploy?template=ctmz86zmf0&ref=iabrlp7z) | | |
| | **PyTorch 2.12 (CUDA 13.0)** | 13.0 | `vishva123/cuda-13.0-pytorch-2.12-runpod` | `qjko5yiwzi` | [](https://runpod.io/console/deploy?template=qjko5yiwzi&ref=iabrlp7z) | | |
| | **PyTorch 2.12 (CUDA 13.2)** | 13.2 | `vishva123/cuda-13.2-pytorch-2.12-runpod` | `ifg6xmye0f` | [](https://runpod.io/console/deploy?template=ifg6xmye0f&ref=iabrlp7z) | | |
| --- | |
| ## Limitations & Recommendations | |
| * **Page Orientation:** Bounding boxes are trained exclusively on upright (`0°`) images. For rotated or scanned PDFs, run an orientation classifier (e.g., PaddleOCR `PP-LCNet_x1_0_doc_ori`) prior to inference. | |
| * **Role Label Supervision:** Signer role annotations in the underlying training split were generated via VLM teacher distillation and may occasionally normalize rare institutional titles to standard role names. | |
| * **Model Selection:** Use **`Qwen3.5-9B-Signature`** (or **`Qwen3.5-9B-Signature-W4A16`**) for production banking/legal documents; use the **`4B`** variant only when strict edge-memory or latency budgets apply. | |