turboderp commited on
Commit
172f5f4
·
verified ·
1 Parent(s): c3da569

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ inference/examples/images/carrots.jpeg filter=lfs diff=lfs merge=lfs -text
37
+ model.safetensors.index.json filter=lfs diff=lfs merge=lfs -text
38
+ quantization_config.json filter=lfs diff=lfs merge=lfs -text
.gitignore ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ .cache/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ inference/*_output.txt
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2023 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.md CHANGED
@@ -1,18 +1,143 @@
1
  ---
2
  license: mit
3
- base_model: deepseek-ai/DeepSeek-V4-Flash-Vision-Exp
4
- base_model_relation: quantized
5
- quantized_by: turboderp
6
- tags:
7
- - exl3
8
  ---
9
 
10
- EXL3 quants of [deepseek-ai/DeepSeek-V4-Flash-Vision-Exp](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-Vision-Exp/tree/main)
11
 
12
- ⚠️ Needs ExLlamav3 v1.4.9 (or `dev` branch)
 
 
13
 
14
- [2.04 bits per weight](https://huggingface.co/turboderp/DeepSeek-V4-Flash-Vision-Exp-exl3/tree/2.04bpw)
15
- [2.27 bits per weight](https://huggingface.co/turboderp/DeepSeek-V4-Flash-Vision-Exp-exl3/tree/2.27bpw)
16
- [2.52 bits per weight](https://huggingface.co/turboderp/DeepSeek-V4-Flash-Vision-Exp-exl3/tree/2.52bpw)
17
- [2.77 bits per weight](https://huggingface.co/turboderp/DeepSeek-V4-Flash-Vision-Exp-exl3/tree/2.77bpw)
18
- [3.04 bits per weight](https://huggingface.co/turboderp/DeepSeek-V4-Flash-Vision-Exp-exl3/tree/3.04bpw)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ library_name: transformers
4
+ pipeline_tag: image-text-to-text
 
 
 
5
  ---
6
 
7
+ # DeepSeek-V4-Flash-Vision-Exp
8
 
9
+ <!-- markdownlint-disable first-line-h1 -->
10
+ <!-- markdownlint-disable html -->
11
+ <!-- markdownlint-disable no-duplicate-header -->
12
 
13
+ <div align="center">
14
+ <img src="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/logo.svg?raw=true" width="60%" alt="DeepSeek-V4" />
15
+ </div>
16
+ <hr>
17
+ <div align="center" style="line-height: 1;">
18
+ <a href="https://www.deepseek.com/" target="_blank" style="margin: 2px;">
19
+ <img alt="Homepage" src="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/badge.svg?raw=true" style="display: inline-block; vertical-align: middle;"/>
20
+ </a>
21
+ <a href="https://chat.deepseek.com/" target="_blank" style="margin: 2px;">
22
+ <img alt="Chat" src="https://img.shields.io/badge/🤖%20Chat-DeepSeek%20V4-536af5?color=536af5&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
23
+ </a>
24
+ </div>
25
+ <div align="center" style="line-height: 1;">
26
+ <a href="https://huggingface.co/deepseek-ai" target="_blank" style="margin: 2px;">
27
+ <img alt="Hugging Face" src="https://img.shields.io/badge/%F0%9F%A4%97%20Hugging%20Face-DeepSeek%20AI-ffc107?color=ffc107&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
28
+ </a>
29
+ <a href="https://twitter.com/deepseek_ai" target="_blank" style="margin: 2px;">
30
+ <img alt="Twitter Follow" src="https://img.shields.io/badge/Twitter-deepseek_ai-white?logo=x&logoColor=white" style="display: inline-block; vertical-align: middle;"/>
31
+ </a>
32
+ </div>
33
+ <div align="center" style="line-height: 1;">
34
+ <a href="LICENSE" style="margin: 2px;">
35
+ <img alt="License" src="https://img.shields.io/badge/License-MIT-f5de53?&color=f5de53" style="display: inline-block; vertical-align: middle;"/>
36
+ </a>
37
+ </div>
38
+
39
+ ## Introduction
40
+
41
+ We are excited to introduce **DeepSeek-V4-Flash-Vision-Exp**, our first experimental multimodal model in the DeepSeek-V4 family. It builds on the DeepSeek-V4-Flash architecture by incorporating visual modules and undergoing continued training to unlock visual understanding capabilities.
42
+
43
+ Compared to DeepSeek-V4-Flash-0731, DeepSeek-V4-Flash-Vision-Exp achieves substantial improvements on its multimodal agent capabilities, while maintaining comparable performance on text-only agent tasks.
44
+
45
+ <div align="center">
46
+
47
+ | Benchmark | DeepSeek-V4-Flash-Vision-Exp | DeepSeek-V4-Flash-0731 | Opus-4.8 |
48
+ | :--- | :---: | :---: | :---: |
49
+ | **Text Agent Capabilities** | | | |
50
+ | Terminal Bench 2.1 | 83.9 | 82.7 | 85.0 |
51
+ | NL2Repo | 57.7 | 54.2 | 69.7 |
52
+ | Cybergym | 75.3 | 76.7 | 78.3 |
53
+ | DeepSWE | 59.3 | 54.4 | 58.0 |
54
+ | Toolathlon-Verified | 75.9 | 70.3 | 76.2 |
55
+ | DSBench-Hard | 63.6 | 59.6 | 71.7 |
56
+ | AutomationBench (Public) | 25.7 | 25.1 | 27.2 |
57
+ | **Multimodal Agent Capabilities** | | | |
58
+ | ApexBench (Pass@1) | 36.5 | 26.2† | 39.4 |
59
+ | Agents' Last Exam | 27.3 | 25.2† | 25.7 |
60
+ | Chartography | 64.3 | - | 65.0 |
61
+ | ZeroBench (Pass@5) | 35.0 | - | 34.0 |
62
+
63
+ </div>
64
+
65
+ Notes:
66
+
67
+ 1. For the text agent benchmarks above, DeepSeek models are evaluated with the minimal mode of DeepSeek Harness as the agent framework, using the `max` reasoning effort level with `temperature = 1.0, top_p = 0.95`.
68
+ 2. † For ApexBench and Agents' Last Exam, DeepSeek-V4-Flash-0731 ignores the multimodal elements in the input.
69
+
70
+
71
+ ## Repository layout
72
+
73
+ This repository contains the tokenizer, prompt encoding reference, and a
74
+ minimal PyTorch inference implementation for DeepSeek-V4 Flash Vision. The
75
+ reference inference covers the vision encoder and aligner, DFlash attention,
76
+ MoE, Hyper-Connections, and the DSpark forward path.
77
+
78
+ ```text
79
+ .
80
+ ├── encoding/ # OpenAI-style messages -> model prompt
81
+ ├── inference/ # weight conversion and minimal inference
82
+ │ └── examples/ # equivalent TXT and JSON vision prompts
83
+ ├── config.json # Hugging Face model metadata
84
+ ├── generation_config.json
85
+ ├── model.safetensors.index.json
86
+ ├── tokenizer.json
87
+ └── tokenizer_config.json
88
+ ```
89
+
90
+ `encoding/` and `inference/` deliberately remain separate: prompt formatting
91
+ does not depend on PyTorch, while inference imports the sibling encoding module
92
+ with an explicit Python path. No symlinks are required.
93
+
94
+ The tokenizer files are regular files so that the repository can be uploaded
95
+ to Hugging Face without relying on local filesystem symlinks. The large model
96
+ shards are described by `model.safetensors.index.json` and are not duplicated
97
+ inside the source checkout used to assemble this repository.
98
+
99
+ ## Prompt encoding
100
+
101
+ See [`encoding/README.md`](encoding/README.md). Both OpenAI-style JSON content
102
+ blocks and the compact `<image>path</image>` TXT notation are supported. The two
103
+ examples under `inference/examples/` encode to identical prompts and token IDs.
104
+
105
+ ## Minimal inference
106
+
107
+ See [`inference/README.md`](inference/README.md) for dependency installation,
108
+ checkpoint conversion, and TXT/JSON inference commands.
109
+
110
+ ## How to Run with vLLM
111
+
112
+ For example, the command below serves the model with vLLM on a single 4×GB300 node.
113
+ See the [vLLM recipe](https://recipes.vllm.ai/deepseek-ai/DeepSeek-V4-Flash-Vision-Exp) for detailed instructions and other hardware configurations.
114
+
115
+ ```bash
116
+ docker run --gpus all \
117
+ vllm/vllm-openai:deepseekv4-flash-vision deepseek-ai/DeepSeek-V4-Flash-Vision-Exp \
118
+ --kv-cache-dtype fp8 \
119
+ --block-size 256 \
120
+ --tensor-parallel-size 4 \
121
+ --tool-call-parser deepseek_v4 \
122
+ --enable-auto-tool-choice \
123
+ --reasoning-parser deepseek_v4 \
124
+ --reasoning-config '{"reasoning_parser":"deepseek_v4","reasoning_start_str":"","reasoning_end_str":""}' \
125
+ --speculative-config '{"method":"dspark","model":"deepseek-ai/DeepSeek-V4-Flash-Vision-Exp","num_speculative_tokens":3,"draft_sample_method":"probabilistic","enable_adaptive_verification":true}'
126
+ ```
127
+
128
+ ## How to Run with SGLang
129
+ Enable DSpark with --speculative-algorithm DSPARK and do not set a separate --speculative-draft-model-path as the target and draft weights therefore come from the same checkpoint. See the [SGLang cookbook](https://docs.sglang.io/cookbook/autoregressive/DeepSeek/DeepSeek-V4#hw=b200&variant=flash-vision&quant=fp4&strategy=low-latency&nodes=single) for detailed instructions, benchmarks and other hardwares configurations.
130
+
131
+ ```
132
+ sglang serve \
133
+ --model-path deepseek-ai/DeepSeek-V4-Flash-Vision-Exp \
134
+ --tp 4 \
135
+ --speculative-algorithm DSPARK \
136
+ --mem-fraction-static 0.85 \
137
+ --host 0.0.0.0 \
138
+ --port 30000
139
+ ```
140
+
141
+ ## License
142
+
143
+ This repository is licensed under the [MIT License](LICENSE).
config.json ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "DeepseekV4ForCausalLM"
4
+ ],
5
+ "attention_bias": false,
6
+ "attention_dropout": 0.0,
7
+ "bos_token_id": 0,
8
+ "eos_token_id": 1,
9
+ "expert_dtype": "fp4",
10
+ "hc_eps": 1e-06,
11
+ "hc_mult": 4,
12
+ "hc_sinkhorn_iters": 20,
13
+ "head_dim": 512,
14
+ "hidden_act": "silu",
15
+ "hidden_size": 4096,
16
+ "index_head_dim": 128,
17
+ "index_n_heads": 64,
18
+ "index_topk": 512,
19
+ "initializer_range": 0.02,
20
+ "max_position_embeddings": 1048576,
21
+ "model_type": "deepseek_v4",
22
+ "moe_intermediate_size": 2048,
23
+ "n_routed_experts": 256,
24
+ "n_shared_experts": 1,
25
+ "norm_topk_prob": true,
26
+ "num_attention_heads": 64,
27
+ "num_experts_per_tok": 6,
28
+ "num_hidden_layers": 43,
29
+ "num_hash_layers": 3,
30
+ "num_key_value_heads": 1,
31
+ "num_nextn_predict_layers": 3,
32
+ "o_groups": 8,
33
+ "o_lora_rank": 1024,
34
+ "q_lora_rank": 1024,
35
+ "qk_rope_head_dim": 64,
36
+ "quantization_config": {
37
+ "quant_method": "exl3",
38
+ "version": "1.4.8",
39
+ "bits": 2.27,
40
+ "head_bits": 4,
41
+ "calibration": {
42
+ "rows": 250,
43
+ "cols": 2048
44
+ },
45
+ "out_scales": "always",
46
+ "codebook": "mul1",
47
+ "original_quantization_config": {
48
+ "activation_scheme": "dynamic",
49
+ "fmt": "e4m3",
50
+ "quant_method": "fp8",
51
+ "scale_fmt": "ue8m0",
52
+ "weight_block_size": [
53
+ 128,
54
+ 128
55
+ ]
56
+ },
57
+ "vision_bits": 5,
58
+ "mtp_bits": 2
59
+ },
60
+ "rms_norm_eps": 1e-20,
61
+ "rope_scaling": {
62
+ "beta_fast": 32,
63
+ "beta_slow": 1,
64
+ "factor": 16,
65
+ "original_max_position_embeddings": 65536,
66
+ "type": "yarn"
67
+ },
68
+ "rope_theta": 10000,
69
+ "routed_scaling_factor": 1.5,
70
+ "scoring_func": "sqrtsoftplus",
71
+ "sliding_window": 128,
72
+ "swiglu_limit": 10.0,
73
+ "tie_word_embeddings": false,
74
+ "topk_method": "noaux_tc",
75
+ "torch_dtype": "bfloat16",
76
+ "transformers_version": "5.0.0",
77
+ "use_cache": true,
78
+ "vocab_size": 129280,
79
+ "compress_rope_theta": 160000,
80
+ "compress_ratios": [
81
+ 0,
82
+ 0,
83
+ 4,
84
+ 128,
85
+ 4,
86
+ 128,
87
+ 4,
88
+ 128,
89
+ 4,
90
+ 128,
91
+ 4,
92
+ 128,
93
+ 4,
94
+ 128,
95
+ 4,
96
+ 128,
97
+ 4,
98
+ 128,
99
+ 4,
100
+ 128,
101
+ 4,
102
+ 128,
103
+ 4,
104
+ 128,
105
+ 4,
106
+ 128,
107
+ 4,
108
+ 128,
109
+ 4,
110
+ 128,
111
+ 4,
112
+ 128,
113
+ 4,
114
+ 128,
115
+ 4,
116
+ 128,
117
+ 4,
118
+ 128,
119
+ 4,
120
+ 128,
121
+ 4,
122
+ 128,
123
+ 4,
124
+ 0,
125
+ 0,
126
+ 0
127
+ ],
128
+ "dspark_block_size": 5,
129
+ "dspark_noise_token_id": 128799,
130
+ "dspark_target_layer_ids": [
131
+ 40,
132
+ 41,
133
+ 42
134
+ ],
135
+ "dspark_markov_rank": 256,
136
+ "vision_n_layers": 32,
137
+ "vision_dim": 1024,
138
+ "vision_n_heads": 16,
139
+ "vision_inter_dim": 2816,
140
+ "vision_patch_size": 14,
141
+ "vision_rope_theta": 10000.0,
142
+ "vision_downsample_ratio": 3,
143
+ "vision_max_n_token": 384,
144
+ "vision_min_pixels": 147456,
145
+ "vision_max_wh_ratio": 8
146
+ }
generation_config.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 1,
5
+ "do_sample": true,
6
+ "temperature": 1.0,
7
+ "top_p": 1.0,
8
+ "transformers_version": "4.46.3"
9
+ }
model-00001-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8a6ac64f34d25edfff4139e68445dfa9abbc6108295fc1a63346a7ff2217471
3
+ size 8579457394
model-00002-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:636aaf9418514569dba42c8a61c17c6a6136a82d611bca8e5af3eb1d02bc97d7
3
+ size 8403210866
model-00003-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:352a5372e327ef029a6b3f16b9c50e77cb2b3e0d9214f9038884fc15ce12c0b7
3
+ size 8486922049
model-00004-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:68465dd43c34cd77fd9e2adf8fb906eebcbcc00ff42240b0f143155805d01260
3
+ size 8494594044
model-00005-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:038a797c1f2a4749e8428eb2fbedc15714be0b2134981b83c97f7380e4233b42
3
+ size 8486931532
model-00006-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19192701bbeec1429c196ce6257586d0676f7e85b55a8f910c878e6879b8c152
3
+ size 8494594044
model-00007-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2ba86b8bb358acc75dac1f53dd4b397e22e0f03a5ed068bf2da25d5c62840805
3
+ size 8486931532
model-00008-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5bc6a0de36a183b2177064c61ce67d1bc2359370be92181902ed045dcc7cc7be
3
+ size 8494594044
model-00009-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bbf07895b337807c1123c3f681c0ece836a3109a64160a0af50cfc1d90a13f64
3
+ size 6701237460
model-00010-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fed80b28198893bb5634b19fd91770d8e6907a798824782386690a3d80c464fe
3
+ size 7779510962
model-00011-of-00011.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:942c283e80b084fcb3e8adbd899b7e11e95f0cf3b612f93dd4943f58a15cf4d3
3
+ size 6085752384
model.safetensors.index.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5d4c7884b72a31ef582224abcae4f156f39e8a16f55e2fc3946cee73b913c9d7
3
+ size 11773908
quantization_config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a9368695b8e5e6b797c64dba672d5998636503f60e9fee114d70caae5194385
3
+ size 39576557
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_bos_token": false,
3
+ "add_eos_token": false,
4
+ "bos_token": {
5
+ "__type": "AddedToken",
6
+ "content": "<|begin▁of▁sentence|>",
7
+ "lstrip": false,
8
+ "normalized": true,
9
+ "rstrip": false,
10
+ "single_word": false
11
+ },
12
+ "clean_up_tokenization_spaces": false,
13
+ "eos_token": {
14
+ "__type": "AddedToken",
15
+ "content": "<|end▁of▁sentence|>",
16
+ "lstrip": false,
17
+ "normalized": true,
18
+ "rstrip": false,
19
+ "single_word": false
20
+ },
21
+ "legacy": true,
22
+ "model_max_length": 1048576,
23
+ "pad_token": {
24
+ "__type": "AddedToken",
25
+ "content": "<|end▁of▁sentence|>",
26
+ "lstrip": false,
27
+ "normalized": true,
28
+ "rstrip": false,
29
+ "single_word": false
30
+ },
31
+ "sp_model_kwargs": {},
32
+ "unk_token": null,
33
+ "tokenizer_class": "PreTrainedTokenizerFast"
34
+ }