File size: 2,133 Bytes
ac7f9c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# OpenJev CPU runtime — baseline Space spec

The recommended zero-GPU Hugging Face Space configuration for
**broadfield/openjev-cpu-run** (the one-click Duplicate target).

| setting | value | why |
|---|---|---|
| SDK | **Docker** | we need llama.cpp binaries + a multi-process entrypoint (bash) |
| Hardware | **CPU basic (free)** | zero GPU, by design (note: Docker Spaces on cpu-basic require a PRO subscription) |
| Persistent storage | **30 GB** (≈ $0.50/mo) | `/data` holds the 16.2 GB GGUF + tokenizer |
| Auto-sleep | any (e.g. 15 min) | wake-up reloads model from `/data` → ~1–2 min, not 20+ |
| Visibility | public (default) | the API is meant to be called; flip private + `OPENJEV_TOKEN` to lock it |
| Secrets | none required | optional `OPENJEV_TOKEN` via Space settings → will appear as an env var |

## Approximate resource/memory math (Q4_K_M)

| item | size |
|---|---|
| `OpenJev-Q4_K_M.gguf` on disk | 16.2 GB |
| RAM to hold the model weights | ~16.2 GB |
| KV cache (llama.cpp fork, 8-bit, 8192 ctx, 1 stream) | ~1–2 GB |
| openjev-server + transformers tokenizer | ~1–2 GB |
| **peak RSS** | **~18–20 GB** (fits the 16 vCPU / 32 GB free tier) |

If the free tier's memory turns out tight (it runs 32 GB RAM / 16 vCPU per
current info), drop to `LLAMA_CTX=4096` or use quant `OpenJev-Q5_K_M.gguf`.

## Build-time budget

The image does, in order:
1. `apt` build tools — ~1 min
2. clone + checkout llama.cpp `b4630` — ~1 min
3. **CMake CPU build of llama-server** — **~15–35 min** on the build machine
4. `pip install openjev-server` (transformers etc.) — ~2–4 min
5. final image copy — ~1 min

First **boot** then downloads the GGUF (~16.2 GB) into persistent `/data` —
that's the long pole (20–50 min depending on HF Hub egress). Persisted
afterward, so subsequent boots are 1–2 min.

## Why entrypoint waits up to 15 min for llama-server

A cold boot loads 16.2 GB off disk into RAM and runs llama.cpp's warmup; on a
shared CPU that's minutes. The entrypoint polls `/v1/models` until ready, then
starts openjev-server, so HF's health check never sees a crash while loading.