Text Generation
Transformers
Safetensors
llada2_moe
dllm
diffusion
llm
text_generation
conversational
custom_code
Instructions to use inclusionAI/LLaDA2.1-mini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use inclusionAI/LLaDA2.1-mini with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="inclusionAI/LLaDA2.1-mini", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("inclusionAI/LLaDA2.1-mini", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use inclusionAI/LLaDA2.1-mini with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "inclusionAI/LLaDA2.1-mini" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "inclusionAI/LLaDA2.1-mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/inclusionAI/LLaDA2.1-mini
- SGLang
How to use inclusionAI/LLaDA2.1-mini 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 "inclusionAI/LLaDA2.1-mini" \ --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": "inclusionAI/LLaDA2.1-mini", "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 "inclusionAI/LLaDA2.1-mini" \ --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": "inclusionAI/LLaDA2.1-mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use inclusionAI/LLaDA2.1-mini with Docker Model Runner:
docker model run hf.co/inclusionAI/LLaDA2.1-mini
Update configuration_llada2_moe.py
Browse files
configuration_llada2_moe.py
CHANGED
|
@@ -16,7 +16,7 @@ class LLaDA2MoeConfig(PretrainedConfig):
|
|
| 16 |
num_key_value_heads=0,
|
| 17 |
hidden_act="silu",
|
| 18 |
use_qkv_bias=False, # llada2 only
|
| 19 |
-
use_qk_norm=
|
| 20 |
use_bias=True, # llada2 only
|
| 21 |
rms_norm_eps=1e-05,
|
| 22 |
norm_head=False, # llada2 only
|
|
@@ -54,6 +54,7 @@ class LLaDA2MoeConfig(PretrainedConfig):
|
|
| 54 |
self.num_key_value_heads = num_key_value_heads
|
| 55 |
self.hidden_act = hidden_act
|
| 56 |
self.use_qkv_bias = use_qkv_bias
|
|
|
|
| 57 |
self.use_bias = use_bias
|
| 58 |
self.norm_head = norm_head
|
| 59 |
self.rms_norm_eps = rms_norm_eps
|
|
@@ -82,4 +83,6 @@ class LLaDA2MoeConfig(PretrainedConfig):
|
|
| 82 |
self.routed_scaling_factor = routed_scaling_factor
|
| 83 |
self.partial_rotary_factor = partial_rotary_factor
|
| 84 |
|
| 85 |
-
super().__init__(
|
|
|
|
|
|
|
|
|
| 16 |
num_key_value_heads=0,
|
| 17 |
hidden_act="silu",
|
| 18 |
use_qkv_bias=False, # llada2 only
|
| 19 |
+
use_qk_norm=True,
|
| 20 |
use_bias=True, # llada2 only
|
| 21 |
rms_norm_eps=1e-05,
|
| 22 |
norm_head=False, # llada2 only
|
|
|
|
| 54 |
self.num_key_value_heads = num_key_value_heads
|
| 55 |
self.hidden_act = hidden_act
|
| 56 |
self.use_qkv_bias = use_qkv_bias
|
| 57 |
+
self.use_qk_norm = use_qk_norm
|
| 58 |
self.use_bias = use_bias
|
| 59 |
self.norm_head = norm_head
|
| 60 |
self.rms_norm_eps = rms_norm_eps
|
|
|
|
| 83 |
self.routed_scaling_factor = routed_scaling_factor
|
| 84 |
self.partial_rotary_factor = partial_rotary_factor
|
| 85 |
|
| 86 |
+
super().__init__(
|
| 87 |
+
pad_token_id=pad_token_id, tie_word_embeddings=tie_word_embeddings, **kwargs
|
| 88 |
+
)
|