Instructions to use inclusionAI/LLaDA2.0-mini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use inclusionAI/LLaDA2.0-mini with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="inclusionAI/LLaDA2.0-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.0-mini", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use inclusionAI/LLaDA2.0-mini with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "inclusionAI/LLaDA2.0-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.0-mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/inclusionAI/LLaDA2.0-mini
- SGLang
How to use inclusionAI/LLaDA2.0-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.0-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.0-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.0-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.0-mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use inclusionAI/LLaDA2.0-mini with Docker Model Runner:
docker model run hf.co/inclusionAI/LLaDA2.0-mini
Fix: Align mask preparation logic for Eager attention to prevent corrupted outputs
This PR fixes a bug in the eager_attention_forward path where the attention mask was being incorrectly processed, leading to garbled model outputs (nonsense text).
Issue:
The model's generation logic defines the attention mask such that 0 represents "no mask" and -inf represents "mask". However, the eager implementation currently utilizes _prepare_4d_causal_attention_mask. This utility function is designed to convert binary masks (1 for keep, 0 for mask) into additive masks (0 for keep, -inf for mask).
Since the input mask is already in the additive format (0/-inf), passing it through this function results in a logic inversion or incorrect value mapping. Given that the subsequent eager_attention_forward uses additive logic (attn_weights + attention_mask), this mismatch causes the attention mechanism to fail.
Changes:
- Replaced
_prepare_4d_causal_attention_maskwith_prepare_4d_causal_attention_mask_for_sdpain the forward pass. - This ensures consistency across
eager,sdpa, andflexattention backends, as all of them expect additive mask logic.
Impact:
Restores correct text generation when using the eager attention backend.