Text Generation
Transformers
Safetensors
MLX
English
bailing_moe
Mixture of Experts
mlx-my-repo
conversational
custom_code
6-bit
Instructions to use TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit", trust_remote_code=True, device_map="auto") - MLX
How to use TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit
- SGLang
How to use TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit 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 "TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit" \ --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": "TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit", "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 "TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit" \ --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": "TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - MLX LM
How to use TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit with Docker Model Runner:
docker model run hf.co/TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit
- Atomic Chat
Download config.json from TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit: direct link, hf CLI and curl.
- Browser
- Download file 6.22 kB
-
https://huggingface.co/TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit/resolve/main/config.json
- Command line
-
hf download hf://TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit/config.json
-
curl -L -o config.json https://huggingface.co/TomLucidor/Ring-mini-sparse-2.0-exp-mlx-6Bit/resolve/main/config.json
6.22 kB
| { | |
| "architectures": [ | |
| "BailingMoeV2ForCausalLM" | |
| ], | |
| "attention_dropout": 0.0, | |
| "auto_map": { | |
| "AutoConfig": "configuration_bailing_moe_v2.BailingMoeV2Config", | |
| "AutoModel": "modeling_bailing_moe_v2.BailingMoeV2Model", | |
| "AutoModelForCausalLM": "modeling_bailing_moe_v2.BailingMoeV2ForCausalLM" | |
| }, | |
| "embedding_dropout": 0.0, | |
| "eos_token_id": 156892, | |
| "first_k_dense_replace": 1, | |
| "head_dim": 128, | |
| "hidden_act": "silu", | |
| "hidden_size": 2048, | |
| "intermediate_size": 5120, | |
| "max_position_embeddings": 32768, | |
| "moba_block_size": 1024, | |
| "moba_layer_freq": [ | |
| 0, | |
| 0, | |
| 0, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 1, | |
| 0 | |
| ], | |
| "moba_topk": 8, | |
| "model_type": "bailing_moe", | |
| "moe_intermediate_size": 512, | |
| "moe_router_enable_expert_bias": true, | |
| "moe_shared_expert_intermediate_size": 512, | |
| "n_group": 8, | |
| "norm_topk_prob": true, | |
| "num_attention_heads": 16, | |
| "num_experts": 256, | |
| "num_experts_per_tok": 8, | |
| "num_hidden_layers": 20, | |
| "num_key_value_heads": 4, | |
| "num_shared_experts": 1, | |
| "output_dropout": 0.0, | |
| "pad_token_id": 156892, | |
| "partial_rotary_factor": 0.5, | |
| "quantization": { | |
| "group_size": 64, | |
| "bits": 6, | |
| "mode": "affine", | |
| "model.layers.1.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.2.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.3.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.4.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.5.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.6.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.7.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.8.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.9.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.10.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.11.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.12.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.13.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.14.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.15.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.16.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.17.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.18.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.19.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| } | |
| }, | |
| "quantization_config": { | |
| "group_size": 64, | |
| "bits": 6, | |
| "mode": "affine", | |
| "model.layers.1.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.2.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.3.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.4.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.5.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.6.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.7.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.8.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.9.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.10.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.11.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.12.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.13.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.14.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.15.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.16.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.17.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.18.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| }, | |
| "model.layers.19.mlp.gate.gate_proj": { | |
| "group_size": 64, | |
| "bits": 8 | |
| } | |
| }, | |
| "rms_norm_eps": 1e-06, | |
| "rope_scaling": null, | |
| "rope_theta": 600000, | |
| "routed_scaling_factor": 2.5, | |
| "router_dtype": "fp32", | |
| "score_function": "sigmoid", | |
| "tie_word_embeddings": false, | |
| "topk_group": 4, | |
| "torch_dtype": "bfloat16", | |
| "transformers_version": "4.52.3", | |
| "use_bias": false, | |
| "use_cache": true, | |
| "use_moba_decode": true, | |
| "use_qk_norm": true, | |
| "use_qkv_bias": false, | |
| "use_rmsnorm": true, | |
| "vocab_size": 157184 | |
| } |