Text Generation
Transformers
Safetensors
English
Chinese
qwen3
llm
nanbeige
custom_code
text-generation-inference
Instructions to use Nanbeige/Nanbeige4.2-3B-DSpark with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Nanbeige/Nanbeige4.2-3B-DSpark with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Nanbeige/Nanbeige4.2-3B-DSpark", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("Nanbeige/Nanbeige4.2-3B-DSpark", trust_remote_code=True) model = AutoModel.from_pretrained("Nanbeige/Nanbeige4.2-3B-DSpark", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Nanbeige/Nanbeige4.2-3B-DSpark with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Nanbeige/Nanbeige4.2-3B-DSpark" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Nanbeige/Nanbeige4.2-3B-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Nanbeige/Nanbeige4.2-3B-DSpark
- SGLang
How to use Nanbeige/Nanbeige4.2-3B-DSpark 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 "Nanbeige/Nanbeige4.2-3B-DSpark" \ --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": "Nanbeige/Nanbeige4.2-3B-DSpark", "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 "Nanbeige/Nanbeige4.2-3B-DSpark" \ --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": "Nanbeige/Nanbeige4.2-3B-DSpark", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Nanbeige/Nanbeige4.2-3B-DSpark with Docker Model Runner:
docker model run hf.co/Nanbeige/Nanbeige4.2-3B-DSpark
Download config.json from Nanbeige/Nanbeige4.2-3B-DSpark: direct link, hf CLI and curl.
- Browser
- Download file 1.37 kB
-
https://huggingface.co/Nanbeige/Nanbeige4.2-3B-DSpark/resolve/main/config.json
- Command line
-
hf download hf://Nanbeige/Nanbeige4.2-3B-DSpark/config.json
-
curl -L -o config.json https://huggingface.co/Nanbeige/Nanbeige4.2-3B-DSpark/resolve/main/config.json
1.37 kB
| { | |
| "architectures": [ | |
| "Qwen3DSparkModel" | |
| ], | |
| "attention_bias": false, | |
| "attention_dropout": 0.0, | |
| "auto_map": { | |
| "AutoModel": "dspark.DSparkDraftModel" | |
| }, | |
| "block_size": 7, | |
| "bos_token_id": 166100, | |
| "dflash_config": { | |
| "attention_mode": "gqa", | |
| "confidence_head_alpha": 1.0, | |
| "confidence_head_with_markov": true, | |
| "enable_confidence_head": true, | |
| "markov_head_type": "vanilla", | |
| "markov_rank": 256, | |
| "mask_token_id": 166143, | |
| "projector_type": "dspark", | |
| "target_layer_ids": [ | |
| 1, | |
| 10, | |
| 21, | |
| 32, | |
| 40 | |
| ] | |
| }, | |
| "dtype": "bfloat16", | |
| "eos_token_id": 166101, | |
| "head_dim": 128, | |
| "hidden_act": "silu", | |
| "hidden_size": 3072, | |
| "initializer_range": 0.02, | |
| "intermediate_size": 10752, | |
| "layer_types": [ | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention", | |
| "full_attention" | |
| ], | |
| "max_position_embeddings": 262144, | |
| "max_window_layers": 5, | |
| "model_type": "qwen3", | |
| "num_attention_heads": 48, | |
| "num_hidden_layers": 5, | |
| "num_key_value_heads": 8, | |
| "num_target_layers": 44, | |
| "pad_token_id": 0, | |
| "rms_norm_eps": 1e-05, | |
| "rope_scaling": null, | |
| "rope_theta": 70000000, | |
| "sliding_window": null, | |
| "tie_word_embeddings": false, | |
| "use_cache": true, | |
| "use_sliding_window": false, | |
| "vocab_size": 166144, | |
| "markov_rank": 256, | |
| "markov_head_type": "vanilla" | |
| } | |