Kolibri-1-GGUF / tutorial /README.md
Prompt48's picture
Share complete portable RunPod conversion tutorial, code and receipts
19844ee verified
|
Raw History Blame Contribute Delete
8.21 kB
# Kolibri → GGUF on RunPod: complete viewer code
This is the code behind Prompt48's Kolibri conversion video. The original model is Aleph Alpha's; the Kolibri architecture implementation is the community patch by Hob-forge / Seraphiel102. Prompt48 independently converted the original checkpoint, generated Q4_K_M / Q6_K / Q8_0, tested them and published the files.
## What to download
- The `steps/` directory is the portable, ordered tutorial.
- `historical/` contains the original scripts from the actual conversion session. They preserve fixed paths and publication markers, so use them as evidence rather than blindly executing them.
- `evidence/` contains the original conversion results and the three fresh Q4 responses, including executed Python checks.
- `video-production/` contains the original video authoring and capture code. The editable video project is provided separately.
- `kolibri1-llama.cpp.patch` is the credited community architecture patch. `LLAMA-CPP-LICENSE` and `ATTRIBUTION.md` preserve attribution.
## Resources and scope
Our original RunPod conversion used an A100 host with about 250GB assigned system RAM, 450GB container disk and 12 conversion/inference threads. CPU inference was tested. A100 VRAM was not used by these CPU commands. Select enough RAM and disk for the FP8 source (~79GB), BF16 intermediate (~156GB) and requested quantizations. Keeping every source, intermediate, quant and split copy simultaneously can exceed 450GB: stage the work carefully or provision more disk. Never delete your only verified output.
The tested build is llama.cpp `836d571` plus the included Kolibri patch. Stock apps without this architecture support may not load the GGUFs. Model file sizes are Q4 47.45GB, Q6 64.23GB and Q8 83.14GB; runtime memory is larger than file size. Our examples use context 4096. GPU operation and long contexts are not demonstrated. These are limited functional checks, not quality benchmarks or an original-versus-quantized comparison.
## 1. Create a pod
You can use the RunPod console, or this helper on your own computer:
```bash
python -m pip install -r requirements.txt
export RUNPOD_API_KEY='YOUR_OWN_KEY'
ssh-keygen -t ed25519 -f ~/.ssh/kolibri_runpod
python runpod.py create --public-key ~/.ssh/kolibri_runpod.pub --max-hourly 2.00
python runpod.py show --id YOUR_POD_ID
```
PowerShell environment assignment is `$env:RUNPOD_API_KEY='YOUR_OWN_KEY'`. The helper prints the actual compute rate and terminates the new pod if that rate exceeds your ceiling. Container disk/storage charges are additional; verify the current price in RunPod. The historical $1.59/hour rate in our video is the rate we actually received, not a guaranteed quote for your run.
Copy this tutorial to `/workspace/kolibri` on the pod using the SSH host/port shown in RunPod. SSH mapping can take a moment to appear. Only supply your public key to the pod. Keep your API and Hugging Face tokens outside files you share or record.
```bash
ssh -i ~/.ssh/kolibri_runpod -p YOUR_PORT root@YOUR_IP
mkdir -p /workspace/kolibri
# From your computer: scp -r -i ~/.ssh/kolibri_runpod -P YOUR_PORT viewer-code/. root@YOUR_IP:/workspace/kolibri/
```
## 2. Build and download the pinned original source
Run on the pod:
```bash
cd /workspace/kolibri
bash steps/00-setup.sh
source venv/bin/activate
python steps/10-download-source.py
```
The setup installs CMake (which was missing in our first attempt), builds the CPU runtime and checks that the patch applies. The source downloader pins the exact Aleph Alpha revision from our session and records it in `logs/source.json`.
## 3. Convert and quantize
```bash
THREADS=12 bash steps/20-convert-bf16.sh
THREADS=12 bash steps/30-quantize.sh
python steps/40-inspect.py output/Kolibri-1-Q4_K_M.gguf > logs/metadata.json
```
The two environment thread limits prevent the thread oversubscription we encountered. BF16 is an intermediate; dequantizing FP8 does not restore lost precision. Every final preset is generated from the same BF16 file, never from Q4. No importance matrix or additional training is used. The `set -euo pipefail` setting stops the shell when conversion fails, including when output is piped to `tee`.
For Q4 only, use:
```bash
llama.cpp/build/bin/llama-quantize output/Kolibri-1-BF16.gguf output/Kolibri-1-Q4_K_M.gguf Q4_K_M 12
```
## 4. Inspect and smoke-test each unsplit quant
```bash
python steps/60-smoke-test.py --variant Q4_K_M
python steps/60-smoke-test.py --variant Q6_K
python steps/60-smoke-test.py --variant Q8_0
```
This starts and stops its own local CPU server. It checks metadata, saves exact English/German/arithmetic/tool-call responses and checks the arithmetic output. Read the saved outputs yourself; the script does not establish model quality. Keep port 8080 free before running it.
## 5. Split large files and publish under your account
```bash
python steps/70-split.py Q6_K
python steps/70-split.py Q8_0
hf auth login
# Write output/README.md. MODEL-CARD-EXAMPLE.md shows the required attribution and details.
python steps/80-publish.py --repo YOUR_HF_USERNAME/Kolibri-1-GGUF
```
The upload allow-list excludes the huge BF16 intermediate and unsplit Q6/Q8 scratch files. It includes the model license, patch, model card, validation JSON and SHA256SUMS. The publisher compares remote LFS SHA-256 hashes with your locally generated files. Review the outputs before executing the publication command; it makes a public model repository.
The split step retains its input for verification. If disk becomes tight, preserve checksums/metadata and verify the split files first, then remove only redundant scratch copies you explicitly intend to delete. Our historical scripts performed this cleanup, but the portable tutorial leaves that choice explicit.
## 6. Download the published Q4 and run the three video exercises
On a machine with sufficient RAM and the patched runtime:
```bash
source venv/bin/activate
python steps/90-download-q4.py --repo Prompt48/Kolibri-1-GGUF
bash steps/50-serve.sh downloaded/Kolibri-1-Q4_K_M.gguf
# In a second SSH session:
cd /workspace/kolibri
source venv/bin/activate
python steps/100-exercises.py
```
The exercise runner sends the same three prompts from the video, saves every raw response, checks the extracted fields and the EUR59.88 calculation, and executes the generated Python against assertions. In our recorded run, all checks passed. Your run may differ with different settings, revisions or runtimes. The coding runner executes model-generated code: inspect it and use an isolated temporary environment for your own experiments.
A direct API request looks like this:
```bash
curl http://127.0.0.1:8080/v1/chat/completions -H 'Content-Type: application/json' -d '{"messages":[{"role":"user","content":"What is 17 multiplied by 23?"}],"temperature":0,"max_tokens":192,"chat_template_kwargs":{"reasoning_effort":"none"}}'
```
For Q6/Q8, download every split part into the same directory and point the server at part one. Do not concatenate split GGUFs manually.
## 7. Save your results and terminate the pod
Download your output files, code, logs and checksums before terminating ephemeral storage. Confirm that your public uploads are complete. Then, on your computer:
```bash
python runpod.py terminate --id YOUR_POD_ID
```
The helper verifies absence from the pod list. Any separately created persistent volume is a separate resource with its own storage billing; manage it deliberately. We did not create a new persistent volume for our conversion or test/render pods.
## Reproducibility status
The actual model conversion and inference were performed in the recorded session. The portable scripts are cleaned-up adaptations of that working code. Syntax, shell parsing, credential exclusions and local assertions are checked before publication; a second full 79GB download/conversion is not rerun just to publish this tutorial. Treat the saved receipts as the evidence of the original successful run.
Model: https://huggingface.co/Aleph-Alpha/Kolibri-1
Our GGUFs: https://huggingface.co/Prompt48/Kolibri-1-GGUF
Community patch: https://huggingface.co/Hob-forge/Kolibri-1-GGUF
RunPod: https://www.runpod.io/