Instructions to use trl-internal-testing/tiny-DeepseekV4ForCausalLM with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trl-internal-testing/tiny-DeepseekV4ForCausalLM with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="trl-internal-testing/tiny-DeepseekV4ForCausalLM") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("trl-internal-testing/tiny-DeepseekV4ForCausalLM") model = AutoModelForCausalLM.from_pretrained("trl-internal-testing/tiny-DeepseekV4ForCausalLM") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use trl-internal-testing/tiny-DeepseekV4ForCausalLM with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "trl-internal-testing/tiny-DeepseekV4ForCausalLM" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-DeepseekV4ForCausalLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/trl-internal-testing/tiny-DeepseekV4ForCausalLM
- SGLang
How to use trl-internal-testing/tiny-DeepseekV4ForCausalLM 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 "trl-internal-testing/tiny-DeepseekV4ForCausalLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-DeepseekV4ForCausalLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "trl-internal-testing/tiny-DeepseekV4ForCausalLM" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-DeepseekV4ForCausalLM", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use trl-internal-testing/tiny-DeepseekV4ForCausalLM with Docker Model Runner:
docker model run hf.co/trl-internal-testing/tiny-DeepseekV4ForCausalLM
Upload DeepseekV4ForCausalLM
Browse files- config.json +7 -6
- model.safetensors +2 -2
config.json
CHANGED
|
@@ -7,7 +7,8 @@
|
|
| 7 |
"bos_token_id": 0,
|
| 8 |
"compress_ratios": [
|
| 9 |
0,
|
| 10 |
-
|
|
|
|
| 11 |
],
|
| 12 |
"compress_rope_parameters": {
|
| 13 |
"partial_rotary_factor": 0.125,
|
|
@@ -17,7 +18,7 @@
|
|
| 17 |
"compress_rope_theta": 160000.0,
|
| 18 |
"dtype": "bfloat16",
|
| 19 |
"eos_token_id": 1,
|
| 20 |
-
"first_k_dense_replace":
|
| 21 |
"hc_eps": 1e-06,
|
| 22 |
"hc_mult": 4,
|
| 23 |
"hc_sinkhorn_iters": 20,
|
|
@@ -34,13 +35,13 @@
|
|
| 34 |
"model_type": "deepseek_v4",
|
| 35 |
"moe_intermediate_size": 2048,
|
| 36 |
"n_group": null,
|
| 37 |
-
"n_routed_experts":
|
| 38 |
"n_shared_experts": 1,
|
| 39 |
"norm_topk_prob": true,
|
| 40 |
"num_attention_heads": 4,
|
| 41 |
-
"num_experts_per_tok":
|
| 42 |
-
"num_hash_layers":
|
| 43 |
-
"num_hidden_layers":
|
| 44 |
"num_key_value_heads": 2,
|
| 45 |
"num_nextn_predict_layers": 1,
|
| 46 |
"o_groups": 8,
|
|
|
|
| 7 |
"bos_token_id": 0,
|
| 8 |
"compress_ratios": [
|
| 9 |
0,
|
| 10 |
+
4,
|
| 11 |
+
128
|
| 12 |
],
|
| 13 |
"compress_rope_parameters": {
|
| 14 |
"partial_rotary_factor": 0.125,
|
|
|
|
| 18 |
"compress_rope_theta": 160000.0,
|
| 19 |
"dtype": "bfloat16",
|
| 20 |
"eos_token_id": 1,
|
| 21 |
+
"first_k_dense_replace": 1,
|
| 22 |
"hc_eps": 1e-06,
|
| 23 |
"hc_mult": 4,
|
| 24 |
"hc_sinkhorn_iters": 20,
|
|
|
|
| 35 |
"model_type": "deepseek_v4",
|
| 36 |
"moe_intermediate_size": 2048,
|
| 37 |
"n_group": null,
|
| 38 |
+
"n_routed_experts": 4,
|
| 39 |
"n_shared_experts": 1,
|
| 40 |
"norm_topk_prob": true,
|
| 41 |
"num_attention_heads": 4,
|
| 42 |
+
"num_experts_per_tok": 2,
|
| 43 |
+
"num_hash_layers": 2,
|
| 44 |
+
"num_hidden_layers": 3,
|
| 45 |
"num_key_value_heads": 2,
|
| 46 |
"num_nextn_predict_layers": 1,
|
| 47 |
"o_groups": 8,
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e5c0682e334f5e114dc223c4196864ef67442228dcfe4eec24c953d386ecd5e6
|
| 3 |
+
size 52073390
|