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
Download source/repository/vision/tests/test_phase6_source_inputs.py from LoyalAI/dsv4-flash-0731-vision: direct link, hf CLI and curl.
- Browser
- Download file 2.19 kB
-
https://huggingface.co/LoyalAI/dsv4-flash-0731-vision/resolve/main/source/repository/vision/tests/test_phase6_source_inputs.py
- Command line
-
hf download hf://LoyalAI/dsv4-flash-0731-vision/source/repository/vision/tests/test_phase6_source_inputs.py
-
curl -L -o test_phase6_source_inputs.py https://huggingface.co/LoyalAI/dsv4-flash-0731-vision/resolve/main/source/repository/vision/tests/test_phase6_source_inputs.py
2.19 kB
| #!/usr/bin/env python3 | |
| """Lightweight contracts for the exact Phase-6 source-input verifier.""" | |
| from __future__ import annotations | |
| import importlib.util | |
| import tempfile | |
| from pathlib import Path | |
| from types import SimpleNamespace | |
| ROOT = Path(__file__).resolve().parents[2] | |
| SPEC = importlib.util.spec_from_file_location( | |
| "phase6_source_inputs", ROOT / "scripts/verify_phase6_source_inputs.py" | |
| ) | |
| assert SPEC is not None and SPEC.loader is not None | |
| MODULE = importlib.util.module_from_spec(SPEC) | |
| SPEC.loader.exec_module(MODULE) | |
| def main() -> None: | |
| with tempfile.TemporaryDirectory() as directory: | |
| root = Path(directory) | |
| (root / "one").write_bytes(b"123") | |
| (root / "two").write_bytes(b"45") | |
| MODULE.exact_file_layout(root, {"one": 3, "two": 2}) | |
| try: | |
| MODULE.exact_file_layout(root, {"one": 3}) | |
| except ValueError as error: | |
| assert "unexpected=['two']" in str(error) | |
| else: | |
| raise AssertionError("unexpected source file was accepted") | |
| hf_init = root / "hf-init" | |
| hf_init.mkdir() | |
| selected = SimpleNamespace( | |
| model=str(hf_init), | |
| model_type="dsv4_vl", | |
| torch_dtype="bfloat16", | |
| expert_model_parallel_size=8, | |
| tensor_model_parallel_size=1, | |
| pipeline_model_parallel_size=1, | |
| mtp_num_layers=0, | |
| bf16=True, | |
| fp16=False, | |
| ) | |
| MODULE.require_selected_args(selected, hf_init) | |
| selected.expert_model_parallel_size = 1 | |
| try: | |
| MODULE.require_selected_args(selected, hf_init) | |
| except ValueError as error: | |
| assert "expert_model_parallel_size" in str(error) | |
| else: | |
| raise AssertionError("wrong MCore EP topology was accepted") | |
| launcher = (ROOT / "scripts/phase6_merge_export.sh").read_text() | |
| followup = (ROOT / "scripts/phase6_post_stage2_followup.sh").read_text() | |
| for source in (launcher, followup): | |
| assert "verify_phase6_source_inputs.py" in source | |
| assert "PHASE6_SOURCE_INPUTS.json" in source | |
| print("DSV4VL_PHASE6_SOURCE_INPUTS_UNIT=PASS") | |
| if __name__ == "__main__": | |
| main() | |