Instructions to use unsloth/grok-2-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/grok-2-GGUF with Transformers:
# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("unsloth/grok-2-GGUF", dtype="auto") - Grok
How to use unsloth/grok-2-GGUF with Grok:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- llama-cpp-python
How to use unsloth/grok-2-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="unsloth/grok-2-GGUF", filename="BF16/grok-2-BF16-00001-of-00011.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use unsloth/grok-2-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf unsloth/grok-2-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama-cli -hf unsloth/grok-2-GGUF:UD-Q4_K_XL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf unsloth/grok-2-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama-cli -hf unsloth/grok-2-GGUF:UD-Q4_K_XL
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 unsloth/grok-2-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./llama-cli -hf unsloth/grok-2-GGUF:UD-Q4_K_XL
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 unsloth/grok-2-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./build/bin/llama-cli -hf unsloth/grok-2-GGUF:UD-Q4_K_XL
Use Docker
docker model run hf.co/unsloth/grok-2-GGUF:UD-Q4_K_XL
- LM Studio
- Jan
- Ollama
How to use unsloth/grok-2-GGUF with Ollama:
ollama run hf.co/unsloth/grok-2-GGUF:UD-Q4_K_XL
- Unsloth Studio
How to use unsloth/grok-2-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 unsloth/grok-2-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 unsloth/grok-2-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for unsloth/grok-2-GGUF to start chatting
- Atomic Chat new
- Docker Model Runner
How to use unsloth/grok-2-GGUF with Docker Model Runner:
docker model run hf.co/unsloth/grok-2-GGUF:UD-Q4_K_XL
- Lemonade
How to use unsloth/grok-2-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull unsloth/grok-2-GGUF:UD-Q4_K_XL
Run and chat with the model
lemonade run user.grok-2-GGUF-UD-Q4_K_XL
List all available models
lemonade list
Decent performance with 96GB VRAM / 256GB DDR5
Just jotting down some performance numbers! I tested the IQ1_S and the IQ4_XS.
System Specs:
3x 3090
1x4090
Intel Sapphire Rapids ES QYFS + 256GB DDR5
IQ1_S
| model | size | params | backend | ngl | n_batch | n_ubatch | ot | test | t/s |
| ------------------------------ | ---------: | ---------: | ---------- | --: | ------: | -------: | --------------------- | --------------: | -------------------: |
| grok 314B IQ1_S - 1.5625 bpw | 82.82 GiB | 269.52 B | CUDA,RPC | 99 | 2056 | 2056 | blk\.([0-9]|1[0-2])\.ffn_.*=CUDA0 | pp512 | 263.35 ± 12.73 |
| grok 314B IQ1_S - 1.5625 bpw | 82.82 GiB | 269.52 B | CUDA,RPC | 99 | 2056 | 2056 | blk\.([0-9]|1[0-2])\.ffn_.*=CUDA0 | tg128 | 13.63 ± 0.12 |
IQ4_XS:
(Couldn't get it to run in llama-bench, but it's like 7t/s generation and 115t/s PP)
EDIT 1: Downloaded the TQ1_0 variant, allowing for full GPU offload. Very similar speeds to IQ1_S, but I just have to say, this might be the most solid model I've used at a quantization of 1~ bit. I believe it's due to the larger active parameters or something of the like, but the responses between IQ4_XS, IQ3_XXS, and even Q5_K_S all seem in line with each other, even TQ1_0's responses are very similar when comparing generations.
Normally with models that have smaller active parameters, the more quantized it becomes, I've noticed the responses become a lot more concise and generalized (not as specific)... Of course I'm not using this model for coding or anything too accurate like that, just general knowledge and stuff, but I'm enjoying it! Below is a comparison between IQ_1_S 's initial response, and Q5_K_S's response. Result is very similar.
Thanks for sharing that's really cool


