Instructions to use GSAI-ML/LLaDA-8B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use GSAI-ML/LLaDA-8B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="GSAI-ML/LLaDA-8B-Instruct", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("GSAI-ML/LLaDA-8B-Instruct", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use GSAI-ML/LLaDA-8B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "GSAI-ML/LLaDA-8B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "GSAI-ML/LLaDA-8B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/GSAI-ML/LLaDA-8B-Instruct
- SGLang
How to use GSAI-ML/LLaDA-8B-Instruct 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 "GSAI-ML/LLaDA-8B-Instruct" \ --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": "GSAI-ML/LLaDA-8B-Instruct", "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 "GSAI-ML/LLaDA-8B-Instruct" \ --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": "GSAI-ML/LLaDA-8B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use GSAI-ML/LLaDA-8B-Instruct with Docker Model Runner:
docker model run hf.co/GSAI-ML/LLaDA-8B-Instruct
Segfault loading LLaDA-8B-Instruct under transformers >= 5 (new core_model_loading path) β works with <5 pin
Symptom: AutoModel.from_pretrained("GSAI-ML/LLaDA-8B-Instruct", trust_remote_code=True, ...) hard-segfaults (no Python exception) during weight loading under transformers 5.x. Verified checkpoint integrity first (all six safetensors shards full-size, re-downloaded once to rule out corruption).
Environment: transformers 5.12.1, torch 2.11.0+cu128, Python 3.10, Windows 11, RTX 5060 Ti 16 GB (loading 4-bit via bitsandbytes 0.49.2, but the crash occurs with and without quantization).
Faulthandler stack at the crash (transformers' new weight-loading path):
Current thread (most recent call first):
...\torch\storage.py", line 471 in getitem
...\transformers\core_model_loading.py", line 989 in _materialize_copy
...\transformers\core_model_loading.py", line 1005 in _job
...\transformers\core_model_loading.py", line 797 in materialize_tensors
...\transformers\core_model_loading.py", line 830 in convert
...\transformers\core_model_loading.py", line 1466 in convert_and_load_state_dict_in_model
...\transformers\modeling_utils.py", line 4457 in _load_pretrained_model
...\transformers\modeling_utils.py", line 4327 in from_pretrained
Notes: standard architectures (e.g. gemma-2 family) load fine in the same environment under 5.12, so it appears specific to the interaction between LLaDA's trust_remote_code modeling files and the transformers β₯5 loader rewrite, not a general setup problem. Reproduces 3/3 attempts.
Workaround that fully resolves it: pin transformers>=4.46,<5 β same environment then loads and generates normally (verified end-to-end).
Might be worth a note in the model card until the remote code is updated for the v5 loader. Happy to provide more details or test a fix. (Context: we use LLaDA for a public research episode on text-diffusion emergence β write-up here β the pin is documented there for users.)