Text Generation
Transformers
Safetensors
English
mellum
mixture-of-experts
compressed-tensors
awq
int4
w4a16
experimental
conversational
Instructions to use blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32") model = AutoModelForCausalLM.from_pretrained("blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32
- SGLang
How to use blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32 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 "blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32" \ --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": "blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32", "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 "blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32" \ --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": "blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32 with Docker Model Runner:
docker model run hf.co/blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32
Download quantization-recipe.yaml from blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32/resolve/main/quantization-recipe.yaml
- Command line
-
hf download hf://blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32/quantization-recipe.yaml
-
curl -L -o quantization-recipe.yaml https://huggingface.co/blake-lucas/Mellum2.1-12B-A2.5B-Thinking-AWQ-W4A16-G32/resolve/main/quantization-recipe.yaml
1.51 kB
| # W4A16 metadata is deliberate. Explicit W4A8 metadata enters the fork's | |
| # CPU-only W4A8 MoE adapter; Marlin's INT8 activation override is a runtime choice. | |
| default_stage: | |
| default_modifiers: | |
| AWQModifier: | |
| mappings: | |
| - smooth_layer: re:model.*input_layernorm$ | |
| balance_layers: | |
| - re:model.*self_attn[.]q_proj$ | |
| - re:model.*self_attn[.]k_proj$ | |
| - re:model.*self_attn[.]v_proj$ | |
| - smooth_layer: re:model.*post_attention_layernorm$ | |
| balance_layers: | |
| # The BF16 router must be balanced too, preserving its logits when | |
| # the shared input normalization is smoothed. | |
| - re:model.*mlp[.]gate$ | |
| - re:model.*mlp[.]experts.*gate_proj$ | |
| - re:model.*mlp[.]experts.*up_proj$ | |
| - smooth_layer: re:model.*mlp[.]experts.*up_proj$ | |
| balance_layers: | |
| - re:model.*mlp[.]experts.*down_proj$ | |
| duo_scaling: both | |
| n_grid: 20 | |
| offload_device: cpu | |
| QuantizationModifier: | |
| config_groups: | |
| group_0: | |
| targets: [Linear] | |
| weights: | |
| num_bits: 4 | |
| type: int | |
| symmetric: true | |
| group_size: 32 | |
| strategy: group | |
| dynamic: false | |
| observer: mse | |
| input_activations: null | |
| output_activations: null | |
| ignore: | |
| - lm_head | |
| - re:.*embed_tokens.* | |
| - re:.*mlp[.]gate$ | |
| - re:.*mtp.* | |
| bypass_divisibility_checks: false | |