|
| 1 | +# Adding GGUF Models from HuggingFace to the Gallery |
| 2 | + |
| 3 | +When adding a GGUF model from HuggingFace to the LocalAI model gallery, follow this guide. |
| 4 | + |
| 5 | +## Gallery file |
| 6 | + |
| 7 | +All models are defined in `gallery/index.yaml`. Find the appropriate section (embedding models near other embeddings, chat models near similar chat models) and add a new entry. |
| 8 | + |
| 9 | +## Getting the SHA256 |
| 10 | + |
| 11 | +GGUF files on HuggingFace expose their SHA256 via the `x-linked-etag` HTTP header. Fetch it with: |
| 12 | + |
| 13 | +```bash |
| 14 | +curl -sI "https://huggingface.co/<org>/<repo>/resolve/main/<filename>.gguf" | grep -i x-linked-etag |
| 15 | +``` |
| 16 | + |
| 17 | +The value (without quotes) is the SHA256 hash. Example: |
| 18 | + |
| 19 | +```bash |
| 20 | +curl -sI "https://huggingface.co/ggml-org/embeddinggemma-300m-qat-q8_0-GGUF/resolve/main/embeddinggemma-300m-qat-Q8_0.gguf" | grep -i x-linked-etag |
| 21 | +# x-linked-etag: "6fa0c02a9c302be6f977521d399b4de3a46310a4f2621ee0063747881b673f67" |
| 22 | +``` |
| 23 | + |
| 24 | +**Important**: Pay attention to exact filename casing — HuggingFace filenames are case-sensitive (e.g., `Q8_0` vs `q8_0`). Check the repo's file listing to get the exact name. |
| 25 | + |
| 26 | +## Entry format — Embedding models |
| 27 | + |
| 28 | +Embedding models use `gallery/virtual.yaml` as the base config and set `embeddings: true`: |
| 29 | + |
| 30 | +```yaml |
| 31 | +- name: "model-name" |
| 32 | + url: github:mudler/LocalAI/gallery/virtual.yaml@master |
| 33 | + urls: |
| 34 | + - https://huggingface.co/<original-model-org>/<original-model-name> |
| 35 | + - https://huggingface.co/<gguf-org>/<gguf-repo-name> |
| 36 | + description: | |
| 37 | + Short description of the model, its size, and capabilities. |
| 38 | + tags: |
| 39 | + - embeddings |
| 40 | + overrides: |
| 41 | + backend: llama-cpp |
| 42 | + embeddings: true |
| 43 | + parameters: |
| 44 | + model: <filename>.gguf |
| 45 | + files: |
| 46 | + - filename: <filename>.gguf |
| 47 | + uri: huggingface://<gguf-org>/<gguf-repo-name>/<filename>.gguf |
| 48 | + sha256: <sha256-hash> |
| 49 | +``` |
| 50 | +
|
| 51 | +## Entry format — Chat/LLM models |
| 52 | +
|
| 53 | +Chat models typically reference a template config (e.g., `gallery/gemma.yaml`, `gallery/chatml.yaml`) that defines the prompt format. Use YAML anchors (`&name` / `*name`) if adding multiple quantization variants of the same model: |
| 54 | + |
| 55 | +```yaml |
| 56 | +- &model-anchor |
| 57 | + url: "github:mudler/LocalAI/gallery/<template>.yaml@master" |
| 58 | + name: "model-name" |
| 59 | + icon: https://example.com/icon.png |
| 60 | + license: <license> |
| 61 | + urls: |
| 62 | + - https://huggingface.co/<org>/<model> |
| 63 | + - https://huggingface.co/<gguf-org>/<gguf-repo> |
| 64 | + description: | |
| 65 | + Model description. |
| 66 | + tags: |
| 67 | + - llm |
| 68 | + - gguf |
| 69 | + - gpu |
| 70 | + - cpu |
| 71 | + overrides: |
| 72 | + parameters: |
| 73 | + model: <filename>-Q4_K_M.gguf |
| 74 | + files: |
| 75 | + - filename: <filename>-Q4_K_M.gguf |
| 76 | + sha256: <sha256> |
| 77 | + uri: huggingface://<gguf-org>/<gguf-repo>/<filename>-Q4_K_M.gguf |
| 78 | +``` |
| 79 | + |
| 80 | +To add a variant (e.g., different quantization), use YAML merge: |
| 81 | + |
| 82 | +```yaml |
| 83 | +- !!merge <<: *model-anchor |
| 84 | + name: "model-name-q8" |
| 85 | + overrides: |
| 86 | + parameters: |
| 87 | + model: <filename>-Q8_0.gguf |
| 88 | + files: |
| 89 | + - filename: <filename>-Q8_0.gguf |
| 90 | + sha256: <sha256> |
| 91 | + uri: huggingface://<gguf-org>/<gguf-repo>/<filename>-Q8_0.gguf |
| 92 | +``` |
| 93 | + |
| 94 | +## Available template configs |
| 95 | + |
| 96 | +Look at existing `.yaml` files in `gallery/` to find the right prompt template for your model architecture: |
| 97 | + |
| 98 | +- `gemma.yaml` — Gemma-family models (gemma, embeddinggemma, etc.) |
| 99 | +- `chatml.yaml` — ChatML format (many Mistral/OpenHermes models) |
| 100 | +- `deepseek.yaml` — DeepSeek models |
| 101 | +- `virtual.yaml` — Minimal base (good for embedding models that don't need chat templates) |
| 102 | + |
| 103 | +## Checklist |
| 104 | + |
| 105 | +1. **Find the GGUF file** on HuggingFace — note exact filename (case-sensitive) |
| 106 | +2. **Get the SHA256** using the `curl -sI` + `x-linked-etag` method above |
| 107 | +3. **Choose the right template** config from `gallery/` based on model architecture |
| 108 | +4. **Add the entry** to `gallery/index.yaml` near similar models |
| 109 | +5. **Set `embeddings: true`** if it's an embedding model |
| 110 | +6. **Include both URLs** — the original model page and the GGUF repo |
| 111 | +7. **Write a description** — mention model size, capabilities, and quantization type |
0 commit comments