Instructions to use Lucebox/gemma-4-31B-it-DFlash-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Lucebox/gemma-4-31B-it-DFlash-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Lucebox/gemma-4-31B-it-DFlash-GGUF", filename="gemma-4-31B-it-DFlash-q8_0.gguf", )
output = llm( "Once upon a time,", max_tokens=512, echo=True ) print(output)
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use Lucebox/gemma-4-31B-it-DFlash-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Lucebox/gemma-4-31B-it-DFlash-GGUF:Q8_0 # Run inference directly in the terminal: llama-cli -hf Lucebox/gemma-4-31B-it-DFlash-GGUF:Q8_0
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf Lucebox/gemma-4-31B-it-DFlash-GGUF:Q8_0 # Run inference directly in the terminal: llama-cli -hf Lucebox/gemma-4-31B-it-DFlash-GGUF:Q8_0
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 Lucebox/gemma-4-31B-it-DFlash-GGUF:Q8_0 # Run inference directly in the terminal: ./llama-cli -hf Lucebox/gemma-4-31B-it-DFlash-GGUF:Q8_0
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 Lucebox/gemma-4-31B-it-DFlash-GGUF:Q8_0 # Run inference directly in the terminal: ./build/bin/llama-cli -hf Lucebox/gemma-4-31B-it-DFlash-GGUF:Q8_0
Use Docker
docker model run hf.co/Lucebox/gemma-4-31B-it-DFlash-GGUF:Q8_0
- LM Studio
- Jan
- Ollama
How to use Lucebox/gemma-4-31B-it-DFlash-GGUF with Ollama:
ollama run hf.co/Lucebox/gemma-4-31B-it-DFlash-GGUF:Q8_0
- Unsloth Studio new
How to use Lucebox/gemma-4-31B-it-DFlash-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 Lucebox/gemma-4-31B-it-DFlash-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 Lucebox/gemma-4-31B-it-DFlash-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Lucebox/gemma-4-31B-it-DFlash-GGUF to start chatting
- Docker Model Runner
How to use Lucebox/gemma-4-31B-it-DFlash-GGUF with Docker Model Runner:
docker model run hf.co/Lucebox/gemma-4-31B-it-DFlash-GGUF:Q8_0
- Lemonade
How to use Lucebox/gemma-4-31B-it-DFlash-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Lucebox/gemma-4-31B-it-DFlash-GGUF:Q8_0
Run and chat with the model
lemonade run user.gemma-4-31B-it-DFlash-GGUF-Q8_0
List all available models
lemonade list
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: gguf
|
| 4 |
+
base_model: z-lab/gemma-4-31B-it-DFlash
|
| 5 |
+
tags:
|
| 6 |
+
- gemma
|
| 7 |
+
- gemma-4
|
| 8 |
+
- dflash
|
| 9 |
+
- speculative-decoding
|
| 10 |
+
- block-diffusion
|
| 11 |
+
- draft-model
|
| 12 |
+
- gguf
|
| 13 |
+
- q8_0
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# gemma-4-31B-it DFlash Draft — Q8_0 GGUF
|
| 17 |
+
|
| 18 |
+
Q8_0 GGUF quantization of the [z-lab/gemma-4-31B-it-DFlash](https://huggingface.co/z-lab/gemma-4-31B-it-DFlash) draft model, produced for the [Lucebox dflash engine](https://github.com/Luce-Org/lucebox-hub) (speculative decoding for `google/gemma-4-31B-it`).
|
| 19 |
+
|
| 20 |
+
- **Source**: [z-lab/gemma-4-31B-it-DFlash](https://huggingface.co/z-lab/gemma-4-31B-it-DFlash) (BF16 safetensors)
|
| 21 |
+
- **Tool**: `quantize_gemma_dflash_q8.py` (parameterized variant of `dflash/scripts/quantize_draft_q8.py`)
|
| 22 |
+
- **Size**: 1.63 GB (53% of BF16)
|
| 23 |
+
- **Arch**: `gemma4-dflash-draft`
|
| 24 |
+
- **Layers**: 5
|
| 25 |
+
- **Hidden**: 5376
|
| 26 |
+
- **n_head / n_head_kv**: 64 / 8
|
| 27 |
+
- **head_dim**: 128
|
| 28 |
+
- **intermediate_size**: 10752
|
| 29 |
+
- **vocab_size**: 262144
|
| 30 |
+
- **rope_theta**: 1e6, **rms_eps**: 1e-6
|
| 31 |
+
- **sliding_window**: 2048, **final_logit_softcapping**: 30.0
|
| 32 |
+
- **DFlash**: `n_target_layers=60`, `target_layer_ids=[1,12,23,35,46,57]`, `block_size=16`, `mask_token_id=4`
|
| 33 |
+
- **Tensors**: projection weights → Q8_0, norm weights → F32 (precision-critical, tiny)
|
| 34 |
+
|
| 35 |
+
## Pairs with
|
| 36 |
+
|
| 37 |
+
- Target: [google/gemma-4-31B-it](https://huggingface.co/google/gemma-4-31B-it) (run as Q4_K_M GGUF via `unsloth/gemma-4-31B-it-GGUF` or `bartowski/google_gemma-4-31B-it-GGUF`)
|
| 38 |
+
|
| 39 |
+
## Notes
|
| 40 |
+
|
| 41 |
+
- The dflash-specific singletons `dflash.fc.weight` and `dflash.hidden_norm.weight` bridge target hidden states into the draft. Do **not** re-quantize with stock `llama-quantize` — it strips these tensors. Use the script above.
|
| 42 |
+
- Loader support for `gemma4-dflash-draft` in `lucebox-hub` is the next step after PR #232 (gemma4 target adapter).
|
| 43 |
+
|
| 44 |
+
## Usage
|
| 45 |
+
|
| 46 |
+
```bash
|
| 47 |
+
# With dflash_server (once gemma4-dflash-draft arch is wired in the loader)
|
| 48 |
+
dflash_server gemma-4-31B-it-Q4_K_M.gguf --draft gemma-4-31B-it-DFlash-q8_0.gguf
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
## Conversion command
|
| 52 |
+
|
| 53 |
+
```bash
|
| 54 |
+
PYTHONPATH=lucebox-hub/dflash/deps/llama.cpp/gguf-py \
|
| 55 |
+
python3 quantize_gemma_dflash_q8.py \
|
| 56 |
+
gemma-4-31B-it-DFlash/ \
|
| 57 |
+
gemma-4-31B-it-DFlash-q8_0.gguf \
|
| 58 |
+
--name gemma-4-31B-it-DFlash-Q8_0
|
| 59 |
+
```
|