Image-Text-to-Text
Transformers
Safetensors
deepseek_v41
text-generation
nvfp4
fp4
deepseek
Mixture of Experts
multimodal
libertai
8-bit precision
fp8
Instructions to use LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4")# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4
- SGLang
How to use LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4 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 "LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4" \ --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": "LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4", "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 "LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4" \ --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": "LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4 with Docker Model Runner:
docker model run hf.co/LibertAIDAI/DeepSeek-V4.1-Flash-NVFP4
| { | |
| "architectures": [ | |
| "DeepseekV41ForCausalLM" | |
| ], | |
| "model_type": "deepseek_v41", | |
| "dtype": "bfloat16", | |
| "transformers_version": "5.6.0", | |
| "bos_token_id": 0, | |
| "eos_token_id": 1, | |
| "pad_token_id": 2, | |
| "image_token_id": 129264, | |
| "quantization_config": { | |
| "quant_method": "fp8", | |
| "activation_scheme": "dynamic", | |
| "weight_block_size": [ | |
| 32, | |
| 32 | |
| ], | |
| "scale_fmt": "ue8m0", | |
| "expert_dtype": "nvfp4", | |
| "expert_block_size": 16, | |
| "expert_scale_fmt": "e4m3", | |
| "expert_global_scale": true, | |
| "engram_dtype": "fp4", | |
| "engram_block_size": 32, | |
| "engram_scale_fmt": "ue8m0", | |
| "repacked_by": "LibertAI/dsv41_fp4_stream.py" | |
| }, | |
| "text_config": { | |
| "model_type": "deepseek_v41_text", | |
| "vocab_size": 129280, | |
| "hidden_size": 5120, | |
| "moe_intermediate_size": 2304, | |
| "num_hidden_layers": 40, | |
| "num_attention_heads": 64, | |
| "num_key_value_heads": 1, | |
| "head_dim": 512, | |
| "qk_rope_head_dim": 64, | |
| "q_lora_rank": 1280, | |
| "o_lora_rank": 1024, | |
| "o_groups": 8, | |
| "hidden_act": "silu", | |
| "swiglu_limit": 10.0, | |
| "rms_norm_eps": 1e-20, | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "initializer_range": 0.02, | |
| "use_cache": true, | |
| "tie_word_embeddings": false, | |
| "max_position_embeddings": 1048576, | |
| "rope_theta": 10000, | |
| "rope_scaling": { | |
| "rope_type": "yarn", | |
| "factor": 16, | |
| "beta_fast": 32, | |
| "beta_slow": 1, | |
| "original_max_position_embeddings": 65536 | |
| }, | |
| "n_routed_experts": 384, | |
| "n_shared_experts": 1, | |
| "num_experts_per_tok": 6, | |
| "scoring_func": "sqrtsoftplus", | |
| "topk_method": "noaux_tc", | |
| "norm_topk_prob": true, | |
| "routed_scaling_factor": 1.5, | |
| "sliding_window": 128, | |
| "compress_ratios": [ | |
| 0, | |
| 0, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 2, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 0, | |
| 0, | |
| 0 | |
| ], | |
| "compress_rope_theta": 160000, | |
| "kv_source_layer_ids": [ | |
| 2, | |
| 8, | |
| 14, | |
| 20 | |
| ], | |
| "index_source_layer_ids": [ | |
| 2, | |
| 8, | |
| 14, | |
| 20, | |
| 24, | |
| 28, | |
| 32, | |
| 36 | |
| ], | |
| "index_n_heads": 32, | |
| "index_head_dim": 128, | |
| "index_topk": 512, | |
| "candidate_source_layer_id": 20, | |
| "candidate_topk_blocks": 2048, | |
| "candidate_block_size": 8, | |
| "hc_mult": 4, | |
| "hc_sinkhorn_iters": 20, | |
| "hc_eps": 1e-06, | |
| "engram_layer_ids": [ | |
| 1, | |
| 14 | |
| ], | |
| "engram_num_embeddings": [ | |
| 384006168, | |
| 384016682 | |
| ], | |
| "engram_max_ngram_size": 4, | |
| "engram_vocab_size": 16000000, | |
| "engram_n_heads": 8, | |
| "engram_head_dim": 256, | |
| "engram_pad_token_id": 2, | |
| "engram_compressed_vocab_size": 99092, | |
| "num_nextn_predict_layers": 3, | |
| "dspark_block_size": 5, | |
| "dspark_noise_token_id": 128799, | |
| "dspark_target_layer_ids": [ | |
| 37, | |
| 38, | |
| 39 | |
| ], | |
| "dspark_markov_rank": 256, | |
| "dspark_n_routed_experts": 128, | |
| "dspark_num_experts_per_tok": 3 | |
| }, | |
| "vision_config": { | |
| "model_type": "deepseek_v41_vision", | |
| "num_hidden_layers": 32, | |
| "hidden_size": 1024, | |
| "num_attention_heads": 16, | |
| "intermediate_size": 2816, | |
| "patch_size": 14, | |
| "rope_theta": 10000, | |
| "downsample_ratio": 3, | |
| "max_image_tokens": 1024, | |
| "min_pixels": 295936, | |
| "max_wh_ratio": null | |
| } | |
| } |