Image-Text-to-Text
Transformers
Safetensors
dsv4_vl
text-generation
deepseek-v4
multimodal
vision-language
siglip2
lora
custom_code
Instructions to use LoyalAI/dsv4-flash-0731-vision with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LoyalAI/dsv4-flash-0731-vision with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="LoyalAI/dsv4-flash-0731-vision", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("LoyalAI/dsv4-flash-0731-vision", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LoyalAI/dsv4-flash-0731-vision with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LoyalAI/dsv4-flash-0731-vision" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LoyalAI/dsv4-flash-0731-vision", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/LoyalAI/dsv4-flash-0731-vision
- SGLang
How to use LoyalAI/dsv4-flash-0731-vision 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 "LoyalAI/dsv4-flash-0731-vision" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LoyalAI/dsv4-flash-0731-vision", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "LoyalAI/dsv4-flash-0731-vision" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LoyalAI/dsv4-flash-0731-vision", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use LoyalAI/dsv4-flash-0731-vision with Docker Model Runner:
docker model run hf.co/LoyalAI/dsv4-flash-0731-vision
File size: 3,394 Bytes
1d7c7c4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | # Dataset plan (all on HuggingFace unless noted)
## What trains at each stage (context)
SigLIP2 is already pretrained — it stays **frozen for the entire project**; we
never improve the eyes, only the wiring and the brain's use of them:
- **Stage 1 (projector alignment):** only the 2-layer MLP learns, from
image-caption pairs. Teaches "translate SigLIP patch embeddings into V4's
token-embedding space." Data quality bar is low; volume + diversity matter.
- **Stage 2 (vision instruction tuning):** LoRA on V4 attention + projector.
Teaches the LLM to *use* vision: answer questions about images, read
documents, operate GUIs. This is where data mix quality dominates outcomes.
## Stage 1 — ~558K caption pairs
| Dataset | Notes |
|---|---|
| `liuhaotian/LLaVA-Pretrain` | The standard 558K BLIP-captioned subset. Sufficient alone. |
## Stage 2 — ~1M vision-instruct mix (80–85% multimodal / 15–20% text)
The pinned, count-balanced production candidate is
`data/stage2_mix_manifest.json`: 820K multimodal + 180K text records with exact
Hub revisions. It replaces provisional repository names below where they have
moved or become gated. Large image downloads must wait until Stage 1 stops so
they do not contend with its network-volume dataloader.
### Core multimodal instruct (~40% of total)
| Dataset | Notes |
|---|---|
| `lmms-lab/LLaVA-OneVision-Data` | ~3.7M curated single-image samples across ~90 sources; SAMPLE subsets, don't take all. Includes ChartQA/DocVQA/AI2D/TextVQA-style subsets — pull the doc/chart-heavy ones preferentially. |
### Document / chart / OCR bias (~20%)
| Dataset | Notes |
|---|---|
| `lmms-lab/DocVQA` (train) | Document QA |
| `HuggingFaceM4/ChartQA` | Chart reasoning |
| `lmms-lab/ai2d` | Diagram QA |
| `HuggingFaceM4/WebSight` | Screenshot→HTML (doubles as multimodal coding) |
### GUI-agent traces (~15%)
| Dataset | Notes |
|---|---|
| `osunlp/Multimodal-Mind2Web` | Web-agent action traces w/ screenshots |
| `OS-Copilot/OS-Atlas` data releases | GUI grounding at scale |
| `xlangai/aguvis-stage2` (check exact repo id) | GUI agent SFT traces |
Convert action traces to V4's tool-call format via `encoding_dsv4` — this is
the fraction that preserves/extends V4's agentic strength into the visual domain.
### Multimodal coding (~10%)
WebSight (above) + code-rich OneVision subsets.
### Text-only anti-forgetting (15–20%) — MANDATORY (handoff)
| Dataset | Notes |
|---|---|
| `Salesforce/xlam-function-calling-60k` | Tool-use / agentic |
| `glaiveai/glaive-function-calling-v2` | Tool-use, larger |
| `ise-uiuc/Magicoder-OSS-Instruct-75K` | Coding |
| `allenai/tulu-3-sft-mixture` (reasoning subsets) | Long-form reasoning |
Match V4's chat/thinking format exactly (`add_non_thinking_prefix`,
`ignore_empty_think` loss scale — same flags as official SFT recipe).
## Verification duties (Phase 0)
- Every dataset converted to swift messages-format jsonl (`data/validate_samples.py`).
- Dedup against eval sets (MMBench/TextVQA/MME + our text suite) before mixing.
- Exact repo ids/splits to be pinned on the pod at download time (some ids may
have moved; check HF before download — this list is from knowledge cutoff
Jan 2026, post-cutoff releases may offer better GUI-agent sets: search
"aguvis", "os-atlas", "gui" on HF datasets, sorted by downloads).
- Record final sampled counts per source in ENV.md.
|