Instructions to use inferencerlabs/DeepSeek-V4-Flash-MLX-2.8bit-INF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use inferencerlabs/DeepSeek-V4-Flash-MLX-2.8bit-INF with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("inferencerlabs/DeepSeek-V4-Flash-MLX-2.8bit-INF") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- LM Studio
- Pi new
How to use inferencerlabs/DeepSeek-V4-Flash-MLX-2.8bit-INF with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "inferencerlabs/DeepSeek-V4-Flash-MLX-2.8bit-INF"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "inferencerlabs/DeepSeek-V4-Flash-MLX-2.8bit-INF" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use inferencerlabs/DeepSeek-V4-Flash-MLX-2.8bit-INF with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "inferencerlabs/DeepSeek-V4-Flash-MLX-2.8bit-INF"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default inferencerlabs/DeepSeek-V4-Flash-MLX-2.8bit-INF
Run Hermes
hermes
- MLX LM
How to use inferencerlabs/DeepSeek-V4-Flash-MLX-2.8bit-INF with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "inferencerlabs/DeepSeek-V4-Flash-MLX-2.8bit-INF"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "inferencerlabs/DeepSeek-V4-Flash-MLX-2.8bit-INF" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "inferencerlabs/DeepSeek-V4-Flash-MLX-2.8bit-INF", "messages": [ {"role": "user", "content": "Hello"} ] }'
History Squash commited on
Commit ·
7296cd4
0
Parent(s):
Squash history to free storage
Browse files- .gitattributes +36 -0
- LICENSE +21 -0
- README.md +30 -0
- chat_template.jinja +24 -0
- config.json +103 -0
- generation_config.json +9 -0
- model-00008-of-00010.safetensors +3 -0
- model.inf +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +14 -0
.gitattributes
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz 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 |
+
model.inf filter=lfs diff=lfs merge=lfs -text
|
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
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language: en
|
| 3 |
+
tags:
|
| 4 |
+
- quantized
|
| 5 |
+
- mlx
|
| 6 |
+
base_model:
|
| 7 |
+
- deepseek-ai/DeepSeek-V4-Flash
|
| 8 |
+
base_model_relation: quantized
|
| 9 |
+
library_name: mlx
|
| 10 |
+
pipeline_tag: text-generation
|
| 11 |
+
---
|
| 12 |
+
**See DeepSeek-V4-Flash MLX in action - [demonstration videos](https://youtube.com/xcreate)**
|
| 13 |
+
|
| 14 |
+
#### Tested with an M3 Ultra 512 GiB and M4 Max 128 GiB RAM using [Inferencer app v1.11.1](https://inferencer.com) distributed compute
|
| 15 |
+
- Distributed inference: ~13 tokens/s @ 1000 tokens ~450.69 GiB / ~78.84 GiB (debug build)
|
| 16 |
+
|
| 17 |
+
<p style="margin-bottom:0px;">
|
| 18 |
+
<strong>Q2.8-EXP is an experimental build of DeepSeek-V4-Flash</strong>
|
| 19 |
+
|
| 20 |
+
This build compresses the model to operate within the memory constraints of a 128 GiB RAM system while maintaining response coherence. However, overall accuracy is degraded due to the level of compression. Stay tuned for updates.
|
| 21 |
+
</p>
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
|
| 25 |
+
##### Quantized with a modified version of [MLX](https://github.com/ml-explore/mlx)
|
| 26 |
+
##### For more details see our [demonstration videos](https://youtube.com/xcreate) or visit [DeepSeek-V4-Flash](https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro).
|
| 27 |
+
|
| 28 |
+
## Disclaimer
|
| 29 |
+
|
| 30 |
+
We are not the creator, originator, or owner of any model listed. Each model is created and provided by third parties. Models may not always be accurate or contextually appropriate. You are responsible for verifying the information before making important decisions. We are not liable for any damages, losses, or issues arising from its use, including data loss or inaccuracies in AI-generated content.
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- set mode = thinking_mode|default('chat') -%}
|
| 2 |
+
<|begin▁of▁sentence|>
|
| 3 |
+
{%- for message in messages -%}
|
| 4 |
+
{%- if message['role'] == 'system' -%}
|
| 5 |
+
{{- message['content'] -}}
|
| 6 |
+
{%- elif message['role'] == 'user' -%}
|
| 7 |
+
<|User|>{{- message['content'] -}}<|Assistant|>
|
| 8 |
+
{%- if loop.last and mode == 'thinking' -%}
|
| 9 |
+
<think>
|
| 10 |
+
{%- else -%}
|
| 11 |
+
</think>
|
| 12 |
+
{%- endif -%}
|
| 13 |
+
{%- elif message['role'] == 'assistant' -%}
|
| 14 |
+
{%- if mode == 'thinking' and message.get('reasoning_content') -%}
|
| 15 |
+
{{- message['reasoning_content'] -}}</think>
|
| 16 |
+
{%- else -%}
|
| 17 |
+
</think>
|
| 18 |
+
{%- endif -%}
|
| 19 |
+
{{- message['content'] -}}<|end▁of▁sentence|>
|
| 20 |
+
{%- endif -%}
|
| 21 |
+
{%- endfor -%}
|
| 22 |
+
{%- if add_generation_prompt and messages[-1]['role'] != 'user' -%}
|
| 23 |
+
<|Assistant|></think>
|
| 24 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"DeepseekV4ForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"compress_ratios": [
|
| 9 |
+
0,
|
| 10 |
+
0,
|
| 11 |
+
4,
|
| 12 |
+
128,
|
| 13 |
+
4,
|
| 14 |
+
128,
|
| 15 |
+
4,
|
| 16 |
+
128,
|
| 17 |
+
4,
|
| 18 |
+
128,
|
| 19 |
+
4,
|
| 20 |
+
128,
|
| 21 |
+
4,
|
| 22 |
+
128,
|
| 23 |
+
4,
|
| 24 |
+
128,
|
| 25 |
+
4,
|
| 26 |
+
128,
|
| 27 |
+
4,
|
| 28 |
+
128,
|
| 29 |
+
4,
|
| 30 |
+
128,
|
| 31 |
+
4,
|
| 32 |
+
128,
|
| 33 |
+
4,
|
| 34 |
+
128,
|
| 35 |
+
4,
|
| 36 |
+
128,
|
| 37 |
+
4,
|
| 38 |
+
128,
|
| 39 |
+
4,
|
| 40 |
+
128,
|
| 41 |
+
4,
|
| 42 |
+
128,
|
| 43 |
+
4,
|
| 44 |
+
128,
|
| 45 |
+
4,
|
| 46 |
+
128,
|
| 47 |
+
4,
|
| 48 |
+
128,
|
| 49 |
+
4,
|
| 50 |
+
128,
|
| 51 |
+
4,
|
| 52 |
+
0
|
| 53 |
+
],
|
| 54 |
+
"compress_rope_theta": 160000.0,
|
| 55 |
+
"eos_token_id": 1,
|
| 56 |
+
"hc_eps": 1e-06,
|
| 57 |
+
"hc_mult": 4,
|
| 58 |
+
"hc_sinkhorn_iters": 20,
|
| 59 |
+
"head_dim": 512,
|
| 60 |
+
"hidden_act": "silu",
|
| 61 |
+
"hidden_size": 4096,
|
| 62 |
+
"index_head_dim": 128,
|
| 63 |
+
"index_n_heads": 64,
|
| 64 |
+
"index_topk": 512,
|
| 65 |
+
"initializer_range": 0.02,
|
| 66 |
+
"max_position_embeddings": 1048576,
|
| 67 |
+
"mlx-sanitized": "0.30.7",
|
| 68 |
+
"model_type": "deepseek_v4",
|
| 69 |
+
"moe_intermediate_size": 2048,
|
| 70 |
+
"n_routed_experts": 256,
|
| 71 |
+
"n_shared_experts": 1,
|
| 72 |
+
"norm_topk_prob": true,
|
| 73 |
+
"num_attention_heads": 64,
|
| 74 |
+
"num_experts_per_tok": 6,
|
| 75 |
+
"num_hash_layers": 3,
|
| 76 |
+
"num_hidden_layers": 43,
|
| 77 |
+
"num_key_value_heads": 1,
|
| 78 |
+
"num_nextn_predict_layers": 1,
|
| 79 |
+
"o_groups": 8,
|
| 80 |
+
"o_lora_rank": 1024,
|
| 81 |
+
"q_lora_rank": 1024,
|
| 82 |
+
"qk_rope_head_dim": 64,
|
| 83 |
+
"quantization_config": {},
|
| 84 |
+
"rms_norm_eps": 1e-06,
|
| 85 |
+
"rope_scaling": {
|
| 86 |
+
"beta_fast": 32,
|
| 87 |
+
"beta_slow": 1,
|
| 88 |
+
"factor": 16,
|
| 89 |
+
"original_max_position_embeddings": 65536,
|
| 90 |
+
"type": "yarn"
|
| 91 |
+
},
|
| 92 |
+
"rope_theta": 10000.0,
|
| 93 |
+
"routed_scaling_factor": 1.5,
|
| 94 |
+
"scoring_func": "sqrtsoftplus",
|
| 95 |
+
"sliding_window": 128,
|
| 96 |
+
"swiglu_limit": 10.0,
|
| 97 |
+
"tie_word_embeddings": false,
|
| 98 |
+
"topk_method": "noaux_tc",
|
| 99 |
+
"torch_dtype": "bfloat16",
|
| 100 |
+
"transformers_version": "4.57.1",
|
| 101 |
+
"use_cache": true,
|
| 102 |
+
"vocab_size": 129280
|
| 103 |
+
}
|
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-00008-of-00010.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:313dca0fa348f9db7bf1b844d8652725d305e34a3a7f025a20c1d8b4280f7a5a
|
| 3 |
+
size 10661685301
|
model.inf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4468a869692f89b4d0d7d0b57c9c1e77a01f227861e34370ec905c5bf191e885
|
| 3 |
+
size 284790
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"backend": "tokenizers",
|
| 3 |
+
"bos_token": "<|begin▁of▁sentence|>",
|
| 4 |
+
"clean_up_tokenization_spaces": false,
|
| 5 |
+
"eos_token": "<|end▁of▁sentence|>",
|
| 6 |
+
"is_local": true,
|
| 7 |
+
"legacy": true,
|
| 8 |
+
"local_files_only": false,
|
| 9 |
+
"model_max_length": 1048576,
|
| 10 |
+
"pad_token": "<|end▁of▁sentence|>",
|
| 11 |
+
"sp_model_kwargs": {},
|
| 12 |
+
"tokenizer_class": "TokenizersBackend",
|
| 13 |
+
"unk_token": null
|
| 14 |
+
}
|