Instructions to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF", filename="Moonlight-16B-A3B-Instruct-APEX-handroll.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF # Run inference directly in the terminal: llama cli -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF # Run inference directly in the terminal: llama cli -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF # Run inference directly in the terminal: ./llama-cli -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF # Run inference directly in the terminal: ./build/bin/llama-cli -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
Use Docker
docker model run hf.co/Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
- LM Studio
- Jan
- vLLM
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
- Ollama
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with Ollama:
ollama run hf.co/Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
- Unsloth Studio
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF to start chatting
- Atomic Chat new
- Docker Model Runner
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with Docker Model Runner:
docker model run hf.co/Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
- Lemonade
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
Run and chat with the model
lemonade run user.Moonlight-16B-A3B-Instruct-APEX-GGUF-{{QUANT_TAG}}List all available models
lemonade list
Reproducing these APEX quants
End-to-end recipe to rebuild both tiers from scratch. Everything is MIT-licensed
(see NOTICE).
Pinned versions
- llama.cpp — commit
bbf4a8a(buildb8833) or any newer build that supports thedeepseek2architecture, thekimi-k2pre-tokenizer, andllama-quantize --tensor-type-file. Binaries used:llama-imatrix,llama-quantize,llama-perplexity. - apex-quant — commit
a445a12(https://github.com/localai-org/apex-quant), forscripts/generate_config.sh. A copy of that script is bundled here asgenerate_config.shfor convenience.
Inputs
- Baseline (F16 GGUF):
gabriellarson/Moonlight-16B-A3B-Instruct-GGUF→Moonlight-16B-A3B-Instruct-F16.gguf. (We quantize from a correctly-converted community F16 rather than converting the HF safetensors ourselves — Moonlight's Moonshot tiktoken tokenizer needs BPE merges that some llama.cpp converters drop. Verify any baseline withtokenizer.ggml.mergespresent and a coherent generation.) - Calibration data (for the imatrix): Bartowski
calibration_datav3— https://gist.github.com/bartowski1182/eb213dccb3571f863da82e99418f81e8
hf download gabriellarson/Moonlight-16B-A3B-Instruct-GGUF \
Moonlight-16B-A3B-Instruct-F16.gguf --local-dir .
# save the gist as calibration_datav3.txt
1. Importance matrix (imatrix)
llama-imatrix -m Moonlight-16B-A3B-Instruct-F16.gguf \
-f calibration_datav3.txt \
-o Moonlight-16B-A3B-Instruct-F16.imatrix -ngl 999
2. Tensor-type configs
The final configs are included (configs/moonlight_i-quality.txt,
configs/moonlight_handroll.txt). To regenerate them:
# Base map: 27 layers, layer 0 is dense (first_k_dense_replace=1)
bash generate_config.sh --profile i-quality --layers 27 --dense-layers 1 \
-o moonlight_i-quality.base.txt
# i-quality: patch in the real MLA attention tensors, drop non-existent ones
python patch_moonlight_config.py moonlight_i-quality.base.txt moonlight_i-quality.txt
# hand-roll: same, plus pin routed down projections to IQ4_NL (1408 dim isn't
# 256-divisible, so K-quants fall back to Q8_0; IQ4_NL is block-32)
python patch_moonlight_config.py moonlight_i-quality.base.txt moonlight_handroll.txt \
--down-exps iq4_nl
3. Quantize (base type Q6_K for unlisted tensors: token_embd, output)
llama-quantize --tensor-type-file configs/moonlight_i-quality.txt \
--imatrix Moonlight-16B-A3B-Instruct-F16.imatrix \
Moonlight-16B-A3B-Instruct-F16.gguf \
Moonlight-16B-A3B-Instruct-APEX-i-quality.gguf Q6_K
llama-quantize --tensor-type-file configs/moonlight_handroll.txt \
--imatrix Moonlight-16B-A3B-Instruct-F16.imatrix \
Moonlight-16B-A3B-Instruct-F16.gguf \
Moonlight-16B-A3B-Instruct-APEX-handroll.gguf Q6_K
4. Evaluate (perplexity)
# NOTE: llama-perplexity prints the final estimate to STDERR — capture 2>&1.
for f in F16 APEX-i-quality APEX-handroll; do
ppl=$(llama-perplexity -m Moonlight-16B-A3B-Instruct-$f.gguf \
-f wiki.test.raw -ngl 999 --chunks 200 2>&1 \
| grep -oP 'Final estimate: PPL = \K[0-9.]+')
echo "$f PPL=$ppl"
done
Expected (wikitext-2 test, 200×512 windows): F16 8.836 · i-quality 8.916 (+0.90%) · hand-roll 8.959 (+1.38%).