Instructions to use inclusionAI/Ring-mini-sparse-2.0-exp with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use inclusionAI/Ring-mini-sparse-2.0-exp with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="inclusionAI/Ring-mini-sparse-2.0-exp", 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/Ring-mini-sparse-2.0-exp", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use inclusionAI/Ring-mini-sparse-2.0-exp with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "inclusionAI/Ring-mini-sparse-2.0-exp" # 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/Ring-mini-sparse-2.0-exp", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/inclusionAI/Ring-mini-sparse-2.0-exp
- SGLang
How to use inclusionAI/Ring-mini-sparse-2.0-exp 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/Ring-mini-sparse-2.0-exp" \ --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/Ring-mini-sparse-2.0-exp", "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/Ring-mini-sparse-2.0-exp" \ --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/Ring-mini-sparse-2.0-exp", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use inclusionAI/Ring-mini-sparse-2.0-exp with Docker Model Runner:
docker model run hf.co/inclusionAI/Ring-mini-sparse-2.0-exp
Config issue
When i tried to run the new Ring-mini-sparse-2.0-exp i got this error "AttributeError: 'BailingMoeV2Config' object has no attribute 'moe_router_topk_scaling_factor'"
If i just set that to 1.0 i get "AttributeError: 'BailingMoeV2Config' object has no attribute 'use_expert_bias'" next so the config seems to be broken?
Also even when i set dummy values i get the message that some tensors are missing in the model?
So if im not mistaken that seems to be a config.json issue right?
We have fixed both configuration_bailing_moe_v2.py and modeling_bailing_moe_v2.py. The model can now be properly loaded and used for inference via Hugging Face.
However, please note that sparse attention is not supported during the decoding phase in the current HF Transformers implementation.
To fully leverage the sparse attention mechanism—especially during decoding—we recommend using SGLang, as detailed in our README.
thank you very much (;