Buckets:
| Name | Size | Uploaded | Xet hash |
|---|---|---|---|
| examples | 4 items | ||
| README.md | 1.87 kB xet | 1291198a | |
| config.json | 1.45 kB xet | ff2bf418 | |
| convert.py | 7.36 kB xet | e1b01ad7 | |
| generate.py | 8.81 kB xet | 4721f5b3 | |
| image_processor.py | 7.7 kB xet | f27e9934 | |
| kernel.py | 22.2 kB xet | 30e3d87a | |
| model.py | 49.5 kB xet | d9400a8a | |
| requirements.txt | 106 Bytes xet | 72ab67e5 | |
| run.sh | 382 Bytes xet | 4a8e3485 | |
| vision.py | 4.46 kB xet | 084421f1 |
Minimal inference
This directory contains a readable reference implementation rather than a
production serving engine. The model code includes Vision + Aligner, DFlash,
MoE, Hyper-Connections, and Transformer.forward_spec() for the DSpark forward
path. The generation loop remains straightforward autoregressive sampling.
Install
python -m pip install -r requirements.txt
Convert Hugging Face weights
The reference runtime uses one converted checkpoint file per tensor-parallel rank. From this directory:
export HF_CKPT_PATH=/path/to/DeepSeek-V4-Flash-Vision-Exp-HF
export SAVE_PATH=/path/to/DeepSeek-V4-Flash-Vision-Exp-TP4
export MP=4
python convert.py \
--hf-ckpt-path "${HF_CKPT_PATH}" \
--save-path "${SAVE_PATH}" \
--n-experts 256 \
--model-parallel "${MP}" \
--expert-dtype fp4
convert.py also copies tokenizer.json and tokenizer_config.json into the
converted checkpoint directory. --tokenizer-path can be used when tokenizer
files live outside the weight directory.
Run the equivalent TXT and JSON examples
export CKPT_PATH=/path/to/DeepSeek-V4-Flash-Vision-Exp-TP4
export MP=4
INPUT_FILE=examples/example_vl.txt ./run.sh
INPUT_FILE=examples/example_vl_harmony.json ./run.sh
The two files express the same interleaved two-image prompt and therefore produce identical encoded prompts and input token IDs.
For interactive chat:
torchrun --nproc-per-node "${MP}" generate.py \
--ckpt-path "${CKPT_PATH}" \
--config config.json \
--interactive \
--temperature 1.0
For multi-node execution, pass the usual torchrun --nnodes, --node-rank,
--master-addr, and --master-port arguments before generate.py.
Preprocessing tests
From the repository root:
python -m pytest -q \
encoding/test_encoding_dsv4.py \
inference/test_image_processor.py
- Total size
- 168 GB
- Files
- 84
- Last updated
- Sep 11
- Pre-warmed CDN
- US EU US EU