Skip to content

armgit / kokon

Public Imported from GitHub
0

Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.

docs: using model files you already have (#14)

Gabriele Lozupone82201fc7d445
diff --git a/README.md b/README.md
index f194eff..09934b0 100644
--- a/README.md
+++ b/README.md
@@ -198,7 +198,12 @@ the other sources are
Files go to `%LOCALAPPDATA%\KokonData\sdcpp` (Mac: `~/Library/Application Support/KokonData/sdcpp`) by default. You can point the setup screen at an
existing stable-diffusion.cpp folder instead; files that are already there are kept.
-Other weights, such as fine-tunes, can be selected in Settings → Models.
+
+Already have Qwen-Image 2.1 files, for example in ComfyUI? Choose **Use models I already have** in
+the setup screen and pick the folder (such as `ComfyUI\models`): Kokon finds the image model, VAE,
+text encoder and vision projector by their contents, as GGUF or safetensors in any quantization,
+and downloads only the engine and any piece you don't have. Files stay where they are. Your own
+files are not tested by Kokon; you can switch to the official files at any time in Settings → Models.
</details>
diff --git a/docs/engineering-notes.md b/docs/engineering-notes.md
index afa11eb..00d812c 100644
--- a/docs/engineering-notes.md
+++ b/docs/engineering-notes.md
@@ -31,6 +31,8 @@ Kokon.exe (Tauri 2 + React) kokon-mcp.exe (MCP, stdio) scripts
| `store.rs` | SQLite gallery + content-addressed inputs |
| `paths.rs` | Path validation (no UNC/device/ADS/traversal, never overwrite) |
| `catalog.rs`, `installer.rs` | Pinned downloads (URLs, sizes, SHA-256), hardware presets, parallel resumable downloader |
+| `config.rs` | Settings and model profiles: the official files (derived from folder + preset) and the user's own files, each recording its model and source |
+| `modelfile.rs` | What a `.gguf` / `.safetensors` file is, read from its header only (role, Qwen-Image 2.1 or not, quantization, vision weights); folder scan for the user's own files |
| `crates/qls-service` | Headless service and stable HTTP API; single instance; lifecycle |
| `src-tauri`, `src/` | Desktop shell (Rust) and UI (React + TypeScript); in-app updates in `src/lib/updates.ts` |
| `mcp/` | MCP server (TypeScript, official SDK) |
@@ -170,6 +172,28 @@ Apple Silicon renders Fast at its full ~1 MP like a PC. Rendering 768² and enla
removed on 2026-10-10: on the M2 Pro 16 GB it took 5 min 25 s against 4 min 20 s for a direct
1376×768 render (the upscaler pass on Metal costs more than the smaller render saves).
+### Model profiles and the user's own files (#14, config schema 9)
+
+- A profile is a set of model files plus `model` (which model they are: `qwen-image-2.1`, the key
+ future model definitions will use) and `source`. The **official** profile always points at the
+ catalog files in `<install folder>/models/qwen21` for the chosen preset (`AppConfig::normalize`);
+ presets change only runtime settings and never the files of the **user** profile
+ (`qwen-image-2.1-user`). Model paths edited by hand on the official profile (≤ 0.9.2) move to the
+ user profile when their files exist.
+- Setup's "Use models I already have" scans a folder (e.g. `ComfyUI/models`) and classifies files the
+ way stable-diffusion.cpp does: `txt_in.text_norm.weight` = Qwen-Image 2.1 (older Qwen-Image models
+ are refused), VAE latent 64 channels, Qwen3-VL text encoder (QK-norm, hidden size 4096; vision
+ tensors inside it make the mmproj unnecessary), mmproj projecting to 4096. Any quantization sd.cpp
+ loads is accepted; pickle formats (`.ckpt`, `.pt`, `.bin`) and split files are not. Missing pieces
+ can be the official files, downloaded into any folder; existing files are never overwritten.
+- Larger own files lower the planning VRAM by their size above the official Q4_K
+ (`AppConfig::model_vram_extra_mib`), since the budgets were measured with it.
+- Missing files (drive not connected, moved, deleted) are checked when a job is submitted and when it
+ starts (sd-server reopens the files for every image), and sd-server's "cannot inspect model source"
+ maps to `missing_model`: the UI opens Setup, which looks for them again (also in the folder they were
+ found in) or offers to choose, download or switch files. Nothing is switched or downloaded on its own.
+- Manual test in an isolated environment: `scripts/dev/test-own-models.ps1`.
+
### Turbo (the only image model since 2026-10-09)
Every job runs Qwen's official 8-step distilled model