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
- 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
error report to run example
test_llada21.py", line 7, in
model = AutoModelForCausalLM.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.12/site-packages/transformers/models/auto/auto_factory.py", line 367, in from_pretrained
return model_class.from_pretrained(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.12/site-packages/transformers/modeling_utils.py", line 4021, in from_pretrained
model = cls(config, *model_args, **model_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/.cache/huggingface/modules/transformers_modules/LLaDA2_dot_1_hyphen_mini/modeling_llada2_moe.py", line 962, in init
self.model = LLaDA2MoeModel(config)
^^^^^^^^^^^^^^^^^^^^^^
File "/Users/.cache/huggingface/modules/transformers_modules/LLaDA2_dot_1_hyphen_mini/modeling_llada2_moe.py", line 783, in init
self.rotary_emb = LLaDA2MoeRotaryEmbedding(config=config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/.cache/huggingface/modules/transformers_modules/LLaDA2_dot_1_hyphen_mini/modeling_llada2_moe.py", line 108, in init
self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'default'
We recommend using transformers==4.57.1 for inference.
for transformers-5.1.0 how to run it?
it's not reasonable to use transformers==4.57.1 only.
Thank you for bringing this to our attention.
The error occurs because the default strategy was removed from ROPE_INIT_FUNCTIONS[self.rope_type] in transformers 5.1.0. We are aware of this breaking change and will update our modeling files shortly to ensure compatibility with the latest version.