ggk
One package for working with GGUF models locally: an OpenAI-compatible LLM server, a diffusion image/video/audio generator and a GGUF metadata/tensor editor with a built-in quantizer — three panels on one GUI, powered by one unified engine compiled in a single build on top of gk, an independent tensor library. There is no ggml anywhere in the tree.
Install
pip install ggk
The build compiles the bundled engine (CPU by default, Metal on macOS). GPU backends are opt-in at install time:
GGK_CUDA=1 pip install ggk # NVIDIA
GGK_HIP=1 pip install ggk # AMD ROCm
GGK_VULKAN=1 pip install ggk # Vulkan
Each switch drives the whole engine — the server, the diffusion runtime and the multimodal projectors all evaluate their graphs on the one gk build.
Building a wheel
On Windows (CUDA) use the script; it is the whole recipe in one place:
build-wheel.bat :: CUDA wheel -> dist\, log -> build-wheel-<timestamp>.log
build-wheel.bat mytag sdist :: named log, plus the sdist
build-wheel.bat check :: preflight only
It runs from a vcvars64 shell with Ninja, builds with --wheel so the
CMake tree stays at build/{wheel_tag} and reruns are incremental, redirects
TEMP/TMP into .buildtmp\ inside the tree, checks the toolchain, free
disk, macOS ._* sidecars and a stale generator cache before starting, and
retries once (incrementally) if the first pass fails. GGK_CUDA=0 turns CUDA
off, CMAKE_ARGS passes extra defines, GGK_BUILD_NO_ISOLATION=1 passes -n
to build (needs pip install scikit-build-core ninja) so a build never
waits on PyPI.
Elsewhere, or by hand:
python -m build --wheel
Why the temp redirect, and why --wheel is not optional for a GPU build:
plain python -m build builds an sdist first and compiles the wheel from
it, unpacked into the OS temp directory; scikit-build-core also stages the
wheel tree there, and nvcc keeps its intermediates there. scikit-build-core
stamps every sdist member with a fixed 2022 date for reproducibility, so to
Windows' daily idle-time temp cleanup (Storage Sense "temporary files", the
DiskCleanup\SilentCleanup task — "delete files older than 7 days") the
unpacked sources are four years old, and an unattended multi-hour CUDA build
is exactly when the machine counts as idle. The sweep lands as missing source
files mid-compile, or at the very end as
FileNotFoundError: ...\wheel\scripts from the packaging step. Nothing in
the tree is at fault, and the retry succeeds because the sweep runs once a day.
With --wheel the build directory is in the tree; with TEMP in the tree
nothing the build owns is in the swept directory at all.
Use Ninja rather than -G "Visual Studio 17 2022": scikit-build-core passes
no -j on the pyproject path and CMake's Visual Studio generator does not set
/MP, so an MSBuild-driven build compiles one file at a time. nvcc needs MSVC
as its host compiler on Windows, hence the vcvars64 shell.
The build works its own architecture list out from nvcc and the installed
GPUs. A wheel built on one machine for another should say what it targets:
-DGK_CUDA_ARCHITECTURES="75;86;89;120".
Run
ggk # unified GUI — Server / Diffuser / Editor panels
python -m ggk # same thing
Each panel also runs on its own, exactly like the standalone gguf-server / gguf-diffusion / gguf-editor packages did:
ggk server # LLM server GUI
ggk diffuser # image generation GUI
ggk editor # GGUF editor GUI
And the engines are directly scriptable from the CLI:
ggk server engine -- --model model.gguf --port 8888
ggk diffuser engine -- -m sd.gguf -p "a lighthouse at dusk" -o out.png
ggk editor quantize -m in.gguf -o out-q4_k.gguf --type q4_k
ggk editor devices
Any other leading option is a diffusion engine command line as is:
ggk --diffusion-model flux3-image-klein-nvfp4.gguf --vae pig_flux2_vae_fp32-f16.gguf \
--llm qwen3vl-4b-it-q4_k_m.gguf -r sheep.png -p "a sheep in sunglasses" \
--cfg-scale 1 --steps 4 --sampling-method euler --diffusion-fa -o out.png
FLUX.3 prompt upsampler
FLUX.3 Image Klein is trained on the captions its prompt upsampler writes (a
Qwen3.5-9B VLM); the text encoder is Qwen3-VL-4B. The upsampler runs on the
bundled LLM server engine before the diffusion engine starts, with Black Forest
Labs' external-VLM system prompts (src/ggk/diffuser/pup_prompts_external_vlm.json):
ggk --diffusion-model flux3-image-klein-nvfp4.gguf --vae pig_flux2_vae_fp32-f16.gguf \
--llm qwen3vl-4b-it-q4_k_m.gguf --prompt-upsampler qwen3.5-9b-q4_k_m.gguf \
-r sheep.png -p "a sheep in sunglasses" --cfg-scale 1 --steps 4 -o out.png
--llm qwen3.5-9b-q4_k_m.gguf on a FLUX.3 run means the same (the Qwen3-VL-4B
GGUF next to the diffusion model is used as the text encoder). Reference images
go to the upsampler through its mmproj-*.gguf, found by name next to the model
or given with --prompt-upsampler-vision. --prompt-upsampler-out caption.txt
keeps the caption, --no-prompt-upsampler sends the prompt as typed, and
python -m ggk.diffuser.pup --model qwen3.5-9b-q4_k_m.gguf -p "..." upsamples alone.
A gguf_trainer qwen35_bridge adapter replaces the 9B upsampler with the
pig_clip student (the mmproj stays Qwen3.5's): the pair goes in the same slots
and conditions the DiT directly through the adapter's FLUX.3 bank head, so no
caption is written and the Qwen3-VL-4B --llm is not loaded. An adapter
trained with klein_target = prompt (gguf_trainer 0.0.14+) carries a
token-aligned bank: the engine rebuilds FLUX.3's template over the student's
own tokens, hands each bank row the student state of its token, and passes
the real rows padded to the next multiple of 80 to the DiT (ggk 0.9.4+ —
an older engine ignores the alignment and renders noise). An adapter trained
on the upsampler caption (0.0.13) follows the prompt only loosely and the
engine warns about it:
ggk --diffusion-model flux3-image-klein-nvfp4.gguf --vae pig_flux2_vae_fp32-f16.gguf \
--llm qwen3vl-4b-it-q4_k_m.gguf --prompt-upsampler pig_clip-f16.gguf \
--prompt-upsampler-adapter pig_qwen3.5_9b_adapter-f16.gguf \
--prompt-upsampler-vision mmproj-qwen3.5-9b-f16.gguf \
-r sheep.png -p "a sheep in sunglasses" --cfg-scale 1 --steps 4 -o out.png
A gguf_trainer qwen3vl_flux3 adapter replaces the Qwen3-VL-4B text
encoder instead (ggk 0.9.5+): --llm pig_clip-*.gguf --llm-adapter pig_qwen3vl_4b_it_adapter-f16.gguf. The student runs FLUX.3's template with
the pads at rope position 1 exactly like the 4B, and the adapter emits the
8-layer stack (layers 4..32) per row; the prompt upsampler stays an
independent front end, so --prompt-upsampler qwen3.5-9b-q4_k_m.gguf [--prompt-upsampler-vision mmproj-qwen3.5-9b-f16.gguf] combines with it:
ggk --diffusion-model flux3-image-klein-nvfp4.gguf --vae pig_flux2_vae_fp32-f16.gguf \
--llm pig_clip-f16.gguf --llm-adapter pig_qwen3vl_4b_it_adapter-f16.gguf \
--prompt-upsampler qwen3.5-9b-q4_k_m.gguf --prompt-upsampler-vision mmproj-qwen3.5-9b-f16.gguf \
-r sheep.png -p "a sheep in sunglasses" --cfg-scale 1 --steps 4 -o out.png
MOSS-Image (Base / SFT)
MOSS-Image is a 5B single-stream DiT on the FLUX.2 VAE whose text encoder is
Qwen3.5-9B itself (last hidden state, chat template with an open <think>
block). Pass the stock llama.cpp Qwen3.5 GGUF as --llm; its 248k-token
tokenizer is read from the GGUF's metadata, no tokenizer file needed. The
upstream schedule is a flow shift of 5 (--flow-shift overrides), 1024 px is
native and dimensions must be multiples of 16; a CFG run skips DiT layer 22 on
the negative branch like the reference pipeline.
ggk --diffusion-model moss-image-sft-q4_k_s.gguf --vae pig_flux2_vae_fp32-f16.gguf \
--llm qwen3.5-9b-q4_k_m.gguf -p "a lovely cat holding a sign that says moss" \
--cfg-scale 3 --steps 30 -o out.png
The DiT has no reference-latent path. With --llm_vision mmproj-qwen3.5-9b-f16.gguf
a -r reference image goes through Qwen3.5's vision tower into the user turn
(before the prompt, with Qwen3-VL M-RoPE positions), so the text features are
image-conditioned; it never enters the VAE or the DiT:
ggk --diffusion-model moss-image-sft-q4_k_s.gguf --vae pig_flux2_vae_fp32-f16.gguf \
--llm qwen3.5-9b-q4_k_m.gguf --llm_vision mmproj-qwen3.5-9b-f16.gguf \
-r sheep.png -p "a sheep in sunglasses" --cfg-scale 1 --steps 4 --diffusion-fa -o out.png
The same gguf_trainer qwen35_bridge adapter (pack "MOSS-Image + FLUX.3
Klein") stands in for the 9B text encoder: --llm pig_clip-*.gguf --llm-adapter pig_qwen3.5_9b_adapter-f16.gguf, with the stock --llm_vision mmproj-qwen3.5-9b-f16.gguf for references. The adapter GGUF carries the Qwen3.5
vocabulary, so no Qwen3.5 GGUF is needed at all:
ggk --diffusion-model moss-image-sft-nvfp4.gguf --vae pig_flux2_vae_fp32-f16.gguf \
--llm pig_clip-f16.gguf --llm-adapter pig_qwen3.5_9b_adapter-f16.gguf \
--llm_vision mmproj-qwen3.5-9b-f16.gguf --ref-image sheep.png \
-p "a sheep in sunglasses" --sampling-method euler --diffusion-fa -o out.png
Reference images are resized (Qwen3-VL smart_resize, multiples of 32) to at most 1024x1024 pixels, i.e. 1024 vision tokens.
Fibo 2.0 Dev / Edit Turbo
Fibo 2.0 (briaai) is a Lumina-style 8B DiT on the FLUX.2 VAE whose text
encoder is Qwen3-VL-4B: fifteen hidden layers ({5,7,...,35}) are RMS-normalized
per token and gathered into six 7680-wide bundles, one for the DiT's text
Perceiver and one per injection block. Prompts are plain text or Bria's
structured JSON caption; an empty negative is the null caption the model was
trained with. The schedule is FLUX-style (dynamic shift from the token count,
--flow-shift and --scheduler discrete give ComfyUI's fixed 1.15 instead).
Dimensions are multiples of 16. Edit Turbo is distilled for 4 steps at CFG 1:
ggk --diffusion-model fibo2-edit-turbo-q3_k_m.gguf --vae pig_flux2_vae_fp32-f16.gguf \
--llm qwen3vl-4b-it-q4_k_m.gguf --llm_vision mmproj-qwen3vl-4b-it-f16.gguf \
--ref-image sheep.png -p "a sheep in sunglasses" --cfg-scale 1 --steps 4 \
--sampling-method euler --diffusion-fa -o out.png
A reference image goes both ways: through the VAE to the DiT as reference
tokens (fibo2 preset: a single reference is scaled to cover the output and
center cropped, several each to their ~1 MP bucket) and, as the same crop, into
Qwen3-VL's prompt through the vision tower (--llm_vision is required for
editing; the mmproj's deepstack mergers and M-RoPE image positions are used,
like the reference). With several references the instruction can say
<image_1>, <image_2>. Dev does text-to-image as well (--cfg-scale 5 --steps 20, no reference).
--llm pig_clip-*.gguf --llm-adapter <adapter>.gguf needs an adapter trained
for this family: a 15-tap layerwise vision-ext Qwen3-VL-4B adapter. A
final-norm adapter such as the Mage-Flow pig_qwen3vl_4b_adapter cannot supply
the fifteen intermediate layers and is refused with that message;
SD_FIBO2_TILE_ADAPTER=1 tiles its single output into every slot regardless
(out of distribution, for experiments only).
MiniMax-H3-Image
MiniMax-H3-Image is the MiniMax-H3 DiT (50 blocks, width 5376) without the
audio stream: one latent frame, six PDD output heads distilled on a fixed
sigma grid, and its own VAE (the H3 encoder with a 24-layer 2-D ViT decoder).
It reuses the MiniMax-H3 text encoder (Qwen3-VL-32B, layer 50). Six Euler
steps at CFG 1 on the PDD grid; the default discrete scheduler with --steps 6
produces that grid, and --sigmas can spell it out:
ggk --diffusion-model minimax_h3_image_pruned_int8_convrot.safetensors \
--llm qwen3vl_32b_minimax_h3-q2_k_m.gguf --vae minimax_h3_image_vae_fp16-f16.gguf \
-p "a lovely pig holding a sign says GGUF" --steps 6 --cfg-scale 1 \
--offload-to-cpu --diffusion-fa -o out.png
The ComfyUI INT8 ConvRot checkpoint loads directly: each int8 weight and
its per-row weight_scale are packed into q8_0 blocks without re-quantizing,
and the layer's input goes through the ConvRot block rotation (group 256) first.
Width and height are multiples of 32, 1024x1024 by default (the model is tuned
for 2048x2048 of area; far below 512 it falls apart). The DiT is 21 GB and the
text encoder 13 GB: with --offload-to-cpu the weights stay in RAM and a model
that does not fit the card runs segment by segment within the free VRAM
(--max-vram <GiB> sets the budget by hand). While one segment computes, the next
one's weights are already on their way to the card. On a 6 GB RTX 4050 laptop
GPU the command above takes about 38 s at 1024x1024 (2.9 s a step once the
weights have been read; the first step loads them), and a one-picture edit
about 90 s. The nvfp4 GGUF of the DiT (minimax_h3_image_pruned-nvfp4.gguf,
11 GB) runs the same commands: about 31 s and 2.7 s a step for text-to-image,
87 s and 8.4-8.7 s a step for a one-picture edit. Its matmuls are slower than
the int8 file's on this card - an nvfp4 scale changes every 16 elements, so
the tensor-core kernel leaves integers that often, where an int8 row has one
scale - and the edit's 3099 tokens are where that shows.
Reference-image editing uses the same three files; add -r (repeatable, up to
16 pictures, named Picture 1, Picture 2, ... in the prompt in argument
order):
ggk --diffusion-model minimax_h3_image_pruned_int8_convrot.safetensors \
--llm qwen3vl_32b_minimax_h3-q2_k_m.gguf --vae minimax_h3_image_vae_fp16-f16.gguf \
-r sheep.png -p "Edit Picture 1. Put a pair of black sunglasses on the sheep, keep everything else unchanged." \
--steps 6 --cfg-scale 1 --offload-to-cpu --diffusion-fa -o out.png
Each picture goes two ways. The text encoder sees it at a 1024-pixel short
edge through its own Qwen3-VL vision tower (the visual.* tensors of the
--llm file, with the DeepStack mergers and M-RoPE image positions) as
Picture <n>: <vision block> ahead of the prompt, the vision block's tokens
carrying the DiT's visual modality tag. The DiT gets it as a reference latent:
VAE-encoded at a short edge within 1024..2048 (multiples of 32), lightly noised
(0.999 x + 0.001 n). Without -W/-H the output takes the first picture's
reference size. Prompts are passed through as written, no editing prefix is
added.
Qwen3-VL-4B instead of the 32B text encoder (--llm-adapter, ggk 1.0.11+)
The P-H3-Image text connector
(PrunaAI/P-H3-Image, text_connector)
is one linear layer that rebuilds the Qwen3-VL-32B states the DiT conditions on
from five Qwen3-VL-4B hidden states (layers 13/19/25/31 and the final norm,
standardized, projected 12800 -> 5120, first token replaced by a learned sink).
Pass it as --llm-adapter with the plain Qwen3-VL-4B as --llm; it is told
apart from the pig_clip bridge adapters by its sink_embedding tensor.
ggk --diffusion-model minimax_h3_image_pruned-nvfp4.gguf --llm qwen3vl-4b-it-q4_k_m.gguf \
--llm-adapter qwen3vl_4b_adapter-f16.gguf --vae minimax_h3_image_vae_fp16-f16.gguf \
-p "a lovely pig holding a sign says GGUF" --steps 6 --cfg-scale 1 --offload-to-cpu \
--diffusion-fa -o out.png
The text encoder drops from 13 GB to 2.6 GB and fits a 6 GB card whole
(conditioning 1.5 s instead of ~6 s; sampling is unchanged). The connector was
trained for Pruna's P-H3 DiT, not MiniMax's, but its output lands in the same
space: against the real 32B encoder the prompt tokens agree at cosine
0.85-0.94 (q4_K_M student, q2_K teacher). Reference pictures (-r) take the
P-H3 prompt layout (<Picture n>: , Edit <Picture 1>. prefix) and need the
4B tower via --llm_vision; that path is built but has not been run.
P-H3-Image (ggk 1.0.12+)
P-H3-Image is PrunaAI's distillation of the same family: the full MiniMax-H3 audio+video DiT run as an image model (one latent frame, two dummy audio latents it still attends to, one output head), the same single-frame VAE, and Qwen3-VL-4B with the text connector above as its text encoder.
ggk --diffusion-model p-h3-image_w4a8.safetensors --llm qwen3vl-4b-it-q4_k_m.gguf \
--llm-adapter qwen3vl_4b_adapter-f16.gguf --vae minimax_h3_image_vae_fp16-f16.gguf \
-p "a lovely pig holding a sign says GGUF" --steps 6 --cfg-scale 1 --offload-to-cpu \
--diffusion-fa \
--sigmas "1.0,0.9675236940383911,0.8875485062599182,0.75,0.5327739119529724,0.23200887441635132,0.0" \
-o out.png
- The model is picked by what comes with the A/V DiT: the image VAE or the
connector. It samples on the plain flow schedule (shift 1), not on
MiniMax-H3-Image's PDD grid; upstream's own 8-step schedule is
--sigmas "1.0,0.984753,0.967905,0.951688,0.925372,0.881923,0.810083,0.528718,0.0". p-h3-image_w4a8.safetensorsis ComfyUI'sasym_w4a8_int8layout: 4-bit codes into a 16-entry codebook, a scale per output row and an FP8 scale per 16 inputs, ConvRot input rotation. ggk decodes it into q8_0 blocks while loading (20.7 GB in RAM for a 13.4 GB file; activations stay float), so--offload-to-cpustreams it through a small card like the INT8 file.- On an RTX 4050 (6 GB), 1024x1024, 6 steps: conditioning 1.5 s, sampling about 56 s, decode 1.3 s.
- A black picture with the log line
the DiT returned ... non-finite valuesmeans the weights file is damaged (a GGUF with NaN block scales does this). - Reference pictures (
-r) follow the P-H3 layout but have not been run.
Prompt expansion (--prompt-upsampler)
MiniMax-H3-Image is trained on long, structured captions; MiniMax publishes the
request that writes them
(MiniMaxAI/MiniMax-H3-Image-PE).
--prompt-upsampler runs that request on the LLM server engine with a VLM of
your choice (a stock Qwen3.5-9B works) before the diffusion run, and the
expanded caption replaces -p:
ggk --diffusion-model minimax_h3_image_pruned-nvfp4.gguf --llm qwen3vl_32b_minimax_h3-q2_k_m.gguf \
--vae minimax_h3_image_vae_fp16-f16.gguf --prompt-upsampler qwen3.5-9b-q4_k_m.gguf \
-p "a lovely pig holding a sign says GGUF" --steps 6 --cfg-scale 1 --offload-to-cpu --diffusion-fa -o out.png
ggk ... --prompt-upsampler qwen3.5-9b-q4_k_m.gguf --prompt-upsampler-vision mmproj-qwen3.5-9b-f16.gguf \
-r sheep.png -p "Edit Picture 1. Put a pair of black sunglasses on the sheep, keep everything else unchanged." ...
- Text-to-image uses the release's system + task prompt and JSON schema; the
expander also picks one of ten aspect ratios, used (at about 1024x1024
pixels) when neither
-Wnor-His given. - Editing (
-r) uses the release's editing task prompt with the reference images attached, so it needs the upsampler's mmproj. The target ratio is only applied when it differs from Picture 1's;-W/-Hare passed on as an explicit selection. - The prompt files are under the MiniMax-H3-Image Community License and are
not part of this package: they are downloaded once from huggingface.co into
the user cache (
%LOCALAPPDATA%\ggk\minimax-h3-image-pe,~/.cache/ggk/...). Offline:--prompt-upsampler-prompts DIR(orGGK_H3_PE_DIR) points at a local copy of that repository. --prompt-upsampler-thinking onlets the model reason first, as the release does with its own 27B expander. It is off by default: a stock Qwen3.5-9B reasons for ~3500 tokens (2.5 min on an RTX 4050) to reach an equivalent caption, against ~12 s without (editing: ~30 s, the task prompt is 7.7k tokens).--prompt-upsampler-out FILEsaves the caption,--no-prompt-upsamplersends the prompt as typed,-s/--seedalso seeds the expansion.
MiniMax-H3 (video with sound)
The Ref2VA checkpoint is the same 50-block DiT with the audio stream; it takes the video VAE, the audio VAE and the same Qwen3-VL-32B text encoder:
ggk -M vid_gen --diffusion-model minimax_h3_ref2va_pruned-nvfp4.gguf \
--vae minimax_h3_video_vae_fp16-f16.gguf --audio-vae minimax_h3_audio_vae_fp32-f16.gguf \
--llm qwen3vl_32b_minimax_h3-q2_k_m.gguf --cfg-scale 1.0 -W 480 -H 480 \
--diffusion-fa -p "a running pig" --video-frames 124 -o out.mp4
No --offload-to-cpu is needed: a text encoder, DiT or VAE whose weights do
not fit the card is kept in host memory on its own and run in segments, exactly
as --offload-to-cpu does for MiniMax-H3-Image (SD_NO_AUTO_OFFLOAD=1 turns
that choice off; --params-backend or --offload-to-cpu still decide when
given). On a 6 GB RTX 4050 laptop GPU the command above (20 steps, 124 frames
at 24 fps with 32 kHz stereo sound) takes about 11.5 minutes: 30 s a step,
85 s for the video decode. It needs about 26 GB of RAM.
Video results are written by extension: -o out.avi is MJPEG with PCM sound,
-o out.mp4 is H.264 (Baseline, constant quality, a key frame every two
seconds) with the generated sound as an MP3 track (--mp3-bitrate sets its
bitrate), moov in front so it streams. The H.264 encoder is
minih264 (CC0), the MP3 encoder and the
MP4 container are ggk's own. Sound at a rate MP3-in-MP4 cannot carry (below
16 kHz) is written next to the video as a .wav.
Qwen3-TTS (text to speech)
Qwen3-TTS-12Hz (0.6B / 1.7B, Base and CustomVoice) in the GGUF layout of
qwen3-tts.cpp's converters: the talker GGUF (convert_tts_to_gguf.py:
28-layer Qwen3 talker, 5-layer code predictor, the Qwen2 text tokenizer
and the speaker map in its metadata) is the model, the tokenizer GGUF
(convert_tokenizer_to_gguf.py) is the 12 Hz speech codec whose decoder
turns the 16-codebook frames into 24 kHz audio. -t <text> is accepted
as in that CLI (the engine's -t <threads> still works with a number);
-p / --text say the same:
ggk qwen3-tts-0.6b-base-q8_0.gguf --codec-model qwen-tokenizer-12hz-q8_0.gguf \
-t "Welcome to GGUF! The selected TTS model is now running." -o out.wav
The output container follows the extension of -o: out.wav is 16-bit PCM,
out.mp3 is MP3 (the engine's own MPEG Layer III encoder, no ffmpeg or lame
involved; constant bitrate, 64 kbps for 24 kHz mono speech and 256 kbps for
44.1/48 kHz stereo music unless --mp3-bitrate <kbps> says otherwise). This
holds for every audio model (Qwen3-TTS, ACE-Step, YuE2, MiniMax Music).
--speaker picks a CustomVoice model's named voice (the load log lists them;
the first one is used when none is given), --language fixes the language
(auto by default), --audio-duration caps the length (60 s by default; the
model stops at its end-of-speech token long before that for a sentence). The
sampling defaults are the model's own (generation.*: temperature 0.9, top-k
50, top-p 1.0, repetition penalty 1.05, seeded like qwen3-tts.cpp), overridable
with SD_QWEN3_TTS_{TEMPERATURE,TOP_K,TOP_P,REP_PENALTY}.
Voice cloning works with the Base talkers, which carry the ECAPA speaker
encoder (spk_enc.*; CustomVoice fine-tunes without it are refused with that
message). --reference voice.wav (or -r voice.wav, as in qwen3-tts.cpp;
PCM WAV at any rate, resampled to 24 kHz) conditions the talker on the
recording's speaker embedding. Adding --reference-text "what the recording says" runs the full in-context clone: the codec GGUF's encoder (tok_enc.*)
tokenizes the recording, the prompt carries its transcript and speech codes
ahead of the target text, and the vocoder is seeded with the last 2 s of the
reference (SD_QWEN3_TTS_VOCODER_CONTEXT_SEC) so the output starts in the
cloned voice:
ggk -m qwen3-tts-0.6b-base-q8_0.gguf --codec-model qwen-tokenizer-12hz-q8_0.gguf \
-r voice.wav --reference-text "Hello from the cloned voice, this is a test." \
-t "The quick brown fox jumps over the lazy dog." -o cloned.wav
The voice can be saved once and reused, in qwen3-tts.cpp's file formats:
--extract-speaker-embedding voice.json (or .bin, raw f32) writes the
recording's speaker embedding and exits; --extract-icl-prompt voice_icl.json
(with --reference-text) writes the full in-context prompt (embedding,
reference codes, transcript tokens). Later runs take --speaker-embedding voice.json or --icl-prompt voice_icl.json instead of the recording;
--dump-speaker-embedding file saves the embedding while synthesizing. The
pieces can also come separately: --reference-text-file transcript.txt,
--reference-codes codes.json (qwen3-tts.cpp's --dump-generated-codes
JSON, an ICL prompt's reference_codes, or a plain int list; skips the codec
encoder) and --reference-token-ids ids.txt (the tokenized transcript).
Reference codes need the transcript and a voice (-r, --speaker-embedding
or --speaker). --dump-generated-codes gen.json writes a run's speech codes
in that same JSON (--dump-decoder-codes adds the reference context frames
the vocoder was seeded with), so a generated voice can serve as the next
reference.
VoiceDesign talkers describe the voice in words: --instruction "a warm, low female voice, speaking slowly" (also --instruct) is prepended to the prompt
as a user turn, like qwen3-tts.cpp. Base models are not trained for it and
get a warning; the 1.7B CustomVoice accepts it alongside --speaker:
ggk -m qwen3-tts-1.7b-voicedesign-q8_0.gguf --codec-model qwen-tokenizer-12hz-q8_0.gguf \
--instruction "A warm, low female voice, speaking slowly." -t "Hello, this is a voice design test." -o designed.wav
The Cantonese TTS talkers (GGUF metadata under cantonese.* instead of
qwen3-tts.*) run on the same path and are named Cantonese in the log.
They are trained for both VoiceDesign and CustomVoice, so --instruction
applies without the Base-model warning:
ggk -m cantonese-1.2-0.6b-q8_0.gguf --codec-model tts-tokenizer-12hz-q8_0.gguf \
--instruction "A warm, low female voice, speaking slowly." -t "今日天氣好好,我哋出去行下街啦。" -o out.mp3
Serving speech: /v1/audio/speech
--serve keeps the talker loaded and speaks over HTTP, behind the OpenAI
speech endpoint, instead of writing one file and exiting. ggk server engine
starts it for you: when --model is a talker (told apart by the GGUF
metadata) the command is handed to the diffusion engine rather than to the
LLM server, so the launch line looks the same for both kinds of model.
ggk server engine -- --model cantonese-1.2-0.6b-q8_0.gguf \
--adapter pig_cantonese_0.6b_adapter-test-f16.gguf \
--codec-model tts-tokenizer-12hz-q8_0.gguf --api-key sk-my-secret-key
# the same thing, spelled out
ggk -m cantonese-1.2-0.6b-q8_0.gguf --adapter pig_cantonese_0.6b_adapter-test-f16.gguf \
--codec-model tts-tokenizer-12hz-q8_0.gguf --serve --port 8888 --api-key sk-my-secret-key
curl http://127.0.0.1:8888/v1/audio/speech \
-H "Authorization: Bearer sk-my-secret-key" -H "Content-Type: application/json" \
-d '{"model": "tts-model", "input": "我覺得自己講到一嚿嚿,但佢應該明我意思啩。", "voice": "A warm, low female voice, speaking slowly."}' \
--output speech.mp3
--host (127.0.0.1), --port (8888), --api-key and --alias configure the
server. Every other option is the default of each request, exactly as a
one-shot run would take it: --instruction, --speaker, --language,
--seed, --audio-duration, --adapter, and the voice of a --reference
recording (so a cloned voice is served by launching with it). Through ggk server engine, --threads and --n-gpu-layers 0 (CPU only, --backend cpu)
are translated and the LLM-only flags are dropped.
| field | meaning |
|---|---|
input |
the text to speak (required) |
voice |
a named speaker of a CustomVoice talker, or - for the talkers that take instructions - a description of the voice, as above. The stock OpenAI names (alloy, nova, ...) are accepted and ignored |
instructions |
style / voice instruction (--instruction); appended to a voice description |
response_format |
mp3 (default), wav, or pcm (raw 24 kHz 16-bit mono, as OpenAI's) |
stream |
true sends the audio in chunks while the talker is still generating (stream_chunk_sec, stream_left_context_sec as below) |
reference_audio, reference_text |
voice cloning: a recording of the voice - WAV, MP3 or FLAC (base64 or a data: URI) - and what it says; see below |
language, seed, max_duration, mp3_bitrate |
--language, --seed (42 unless the server was started with another, so the same request gives the same audio as ggk -m ... -t ...; -1 = a new take every time), the cap in seconds (60), --mp3-bitrate |
model is not checked. One utterance is generated at a time; concurrent
requests queue. GET /v1/models lists the talker with its speakers and
languages, GET /health answers once the model is loaded, and the LLM
endpoints answer 501.
Voice cloning. A Base talker imitates the voice of a recording, as
--reference / --reference-text do on the command line (same recording,
transcript and seed: the same audio). The recording is a WAV, MP3 or FLAC
file (--reference / -r take the same formats), 5 to 15 seconds of clean
speech (60 s at most). With its transcript in
reference_text the clone is in-context - the recording's own speech codes
lead the generation - and follows the voice closely; without it only the
speaker embedding is used. Send it with the request, as base64 in the JSON or
as a file of a multipart form (every other field keeps its name):
curl http://127.0.0.1:8888/v1/audio/speech -H "Authorization: Bearer sk-my-secret-key" \
-F "input=我覺得自己講到一嚿嚿,但佢應該明我意思啩。" \
-F "reference_audio=@voice.wav" -F "reference_text=what the recording says" \
--output cloned.mp3
A recording sent again is not encoded again (the last 16 are kept). Or
register it once under a name and say "voice": "<name>" from then on:
curl http://127.0.0.1:8888/v1/audio/voices -H "Authorization: Bearer sk-my-secret-key" \
-F "name=uncle" -F "reference_audio=@voice.wav" -F "reference_text=what the recording says"
curl http://127.0.0.1:8888/v1/audio/speech -H "Authorization: Bearer sk-my-secret-key" \
-H "Content-Type: application/json" -d '{"input": "Hello.", "voice": "uncle"}' --output cloned.mp3
POST /v1/audio/voices takes the same JSON or form (name: letters, digits,
_, -), GET /v1/audio/voices lists the voices and DELETE /v1/audio/voices/<name> removes one. They live in memory unless the server is
started with --voice-dir <dir>: then each is saved as <dir>/<name>.json
and loaded again at the next start. The files are qwen3-tts.cpp's
(--extract-icl-prompt / --extract-speaker-embedding write them, and
--icl-prompt / --speaker-embedding read them), so voices saved by the CLI
can be dropped into the directory. A cloned voice takes precedence over
--speaker and a --reference given at launch.
On Windows, send non-ASCII text from a UTF-8 file (-d @request.json): cmd,
PowerShell and Git Bash pass arguments to curl.exe in the ANSI code page,
which replaces Chinese text with ? before it leaves the machine. The server
answers 400 when the input is question marks only, and logs the text it got.
--stream decodes the speech in chunks while the talker is still generating
and appends each chunk to the output .wav as it lands (the header is kept
valid, so a player can follow the file); with -o out.mp3 the chunks land as
MP3 frames instead. --stream-chunk-sec sets the chunk
length (1.0 s) and --stream-left-context-sec how much earlier speech is
re-decoded ahead of each chunk and dropped again for continuity (2.0 s, as in
qwen3-tts.cpp). The codec attends over 72 frames, so a context of 6 s makes
the streamed audio identical to the one-shot decode, at about seven times the
decode work per chunk; 2 s keeps the chunks cheap with small differences at
chunk starts. Library users get the chunks through
sd_vid_gen_params_t.stream_audio_cb.
TRELLIS.2 (image to 3D)
TRELLIS.2-4B turns one image into a
textured 3D model. Its GGUF is the whole pipeline in one file — the DINOv3
image encoder, three flow transformers and three decoders, under the stage
prefixes image_cond, ss_flow, ss_dec, shape_dit_512/1024,
tex_dit_512/1024, shape_dec, tex_dec (the single-file layout) — so the model
is the only file to name, and the result is a mesh:
ggk -m trellis2-q4_k.gguf --ref-image sheep.png -o out.glb
-r / --ref-image (or -i) is the picture; there is no prompt. The stages
run one after another and each gives its memory back before the next loads, so
the peak is one stage, not 4B parameters: on a 6 GB RTX 4050 Laptop the command
above takes about 75 s and writes a 964k-vertex, 1.95M-triangle mesh.
| Option | |
|---|---|
--mesh-pipeline |
512 (one shape pass, 512³ grid), 1024, 1024_cascade (the model's own default: a 512 pass, then a second shape pass on the refined 64³ scaffold, 1024³ grid) or 1536_cascade. Default: 1024_cascade on a device with 11 GB or more, 512 otherwise |
--mesh-background |
auto (default) or keep, see below |
--mask <image> |
the subject mask, white = subject |
--mesh-no-texture |
skip the material stages, write the bare shape |
--seed, --steps, --cfg-scale |
as everywhere; the model's own values are 12 steps per stage and a guidance of 7.5 for structure and shape (materials are sampled unguided). The noise is torch's for the same seed |
--backend, --threads |
as everywhere |
The subject. The model wants the object alone on nothing. An image whose
alpha channel says where the object is (an RGBA cut-out) is used as it is, and
so is a --mask. For an image without one, the reference pipeline runs
RMBG-2.0, which is not part of a TRELLIS.2 GGUF; ggk removes a plain backdrop
itself instead (the colour that owns the image border, flooded inwards with a
soft edge — a subject on a studio backdrop, graded or not), and says so when
there is no such backdrop to remove, in which case the whole frame is taken as
the object and a cut-out or mask is the way to a clean result.
--mesh-background keep turns the removal off.
The result follows the extension of -o; anything else becomes .glb:
.glb— binary glTF 2.0, y-up, in the unit cube:POSITION,NORMAL,COLOR_0(the base colour, linear, 16 bit) and the per-vertex metallic and roughness in the application attribute_METALLIC_ROUGHNESS; the material carries their means and is double sided..ply— binary, z-up as generated, withred green blue alphaandmetallic roughnessvertex properties..obj— text, z-up, with thev x y z r g bcolour extension.
The mesh is the decoder's flexible dual grid at full density (one vertex per surface voxel), wound and shaded outwards, with the material volume sampled at every vertex. That is as much detail as the model produced; it is not the reference exporter's decimated, UV-unwrapped mesh with baked 4K textures, so the files are large — 58 MB at 512, around 240 MB for the 1024 cascade.
Memory. A stage that does not fit the device — in practice the two decoders at 1024³, which hold millions of voxels — moves to the CPU on its own and the run carries on, so the cascade does complete on a 6 GB card (about 11 minutes there, most of it those decoder levels on the CPU). Without a GPU the 512 pipeline runs on the CPU alone; allow the better part of an hour.
TripoSR (image to 3D, feed-forward)
TripoSR is the small, fast image-to-3D model: one pass through a DINO ViT-B/16 image encoder and a triplane transformer gives a radiance field, and the mesh is the isosurface of its density. Nothing is sampled, the GGUF is half a gigabyte, and it is again the only file to name:
ggk -m triposr-q8_0.gguf --ref-image sheep.png -o out.glb
-r / --ref-image (or -i) is the picture; there is no prompt. On a 6 GB
RTX 4050 Laptop the command above takes about 5 s, most of it decoding the
256³ density lattice, and writes a 67k-vertex, 134k-triangle mesh (4 MB);
without a GPU it is a matter of a minute or two (about 50 s on 8 threads under
Linux). The q4_k and nvfp4 files run the same way.
| Option | |
|---|---|
--mesh-pipeline <n> |
the marching cubes resolution, 32 to 1024 (default 256, as upstream's --mc-resolution). The lattice is n³ points through the decoder: 512 gives a 274k-vertex mesh and takes about 80 s on that card |
--mesh-background, --mask <image> |
the subject, as for TRELLIS.2: an RGBA cut-out or a mask is used as it is, a plain backdrop is removed otherwise, keep feeds the whole picture |
--mesh-no-texture |
no vertex colours, the bare shape |
--backend, --threads |
as everywhere |
--seed, --steps and --cfg-scale are accepted and change nothing: the same
image always gives the same mesh.
The pipeline is upstream's run.py: the subject is cropped to its alpha
bounding box, padded to a square with the subject at 85% of it, composited
over mid grey and resized to 512; the density is decoded on the lattice and
the surface taken at density 25; the colour field is read at the vertices.
Checked against the PyTorch model, the triplane and the density agree to 3e-4
relative with the weights expanded to f32; a quantized file adds the engine's
usual quantized arithmetic on top (about 1% for q8_0, a sub-voxel shift of the
surface). Two things differ on purpose: components with less than 0.5% of the
triangles (the field's stray specks and sealed bubbles) are dropped, and the
marching cubes is ggk's own, whose surface is closed, manifold and wound
outwards wherever the subject stays inside the scene cube.
The result is written as for TRELLIS.2 (.glb, .ply, .obj), facing the
same way, at TripoSR's own scale (the scene cube is 0.87 either way; a subject
is about one unit across). The colours are the model's radiance — the picture's
lighting baked in — stored as base colour with metallic 0 and roughness 1.
--serve and ggk server engine serve it like TRELLIS.2 (below), with
"pipeline" being the resolution.
TripoSG (image to 3D, shape only)
TripoSG generates the shape
itself: a rectified-flow transformer samples a set of latent tokens, and a VAE
decodes them into a signed distance field whose zero surface is the mesh.
There are no materials. The GGUF is the whole pipeline (DINOv2 image encoder,
transformer, VAE; image_encoder, transformer, vae), and two checkpoints
are recognised by their tensors:
- TripoSG-scribble (also has a
text_encoder, CLIP): a sketch and a prompt in, 512 tokens, 16 steps, guidance distilled away. Fast shape prototyping. - TripoSG: a picture of the subject in, 2048 tokens, 50 steps at a guidance of 7.
ggk -m triposg-nvfp4.gguf --ref-image sheep.png -o out.glb
# TripoSG-scribble: say what the sketch is, and how far to trust the sketch
ggk -m triposg-nvfp4.gguf --ref-image sketch.png -p "a cat with wings" --scribble-conf 0.3 -o out.glb
On a 6 GB RTX 4050 Laptop the first command (a TripoSG-scribble file) takes about 8 s - 2 s of sampling, 4 s of decoding - and writes a watertight 177k-vertex mesh; without a GPU the same run takes five to six minutes (8 threads under Linux). The q4_k file runs the same way.
| Option | |
|---|---|
-p, --prompt |
TripoSG-scribble: what the sketch shows. Without one the image alone decides, and a photo is read as loosely as a sketch would be: name the subject |
--scribble-conf |
TripoSG-scribble: how much the sketch steers the shape (0.4; upstream suggests 0.3 to 0.5 for hand-drawn sketches) |
--prompt-conf |
TripoSG-scribble: how much the prompt does (1.0) |
--seed, --steps, --cfg-scale |
as everywhere; the model's own are 16 steps unguided (scribble) or 50 steps at 7 (TripoSG). The noise is torch's for the same seed |
--mesh-pipeline <n> |
the marching cubes resolution, 32 to 1024 (default 256, upstream's octree depth 8) |
--mesh-background, --mask <image> |
TripoSG: the subject, as for TRELLIS.2, cut out and put on white. TripoSG-scribble takes the picture whole; what a mask or an alpha channel hides is painted white |
--backend, --threads |
as everywhere |
The surface. Upstream decodes the field at all 256³ lattice points - a
transformer block per point, a minute on that card - and runs marching cubes
over it. ggk decodes a coarse 64³ lattice, then follows the surface from cell
to cell and decodes only what it passes through: 4 to 7% of the lattice, a few
seconds, and the same mesh (checked against the full decode,
GGK_TRIPOSG_DENSE=1: what differs is specks smaller than a coarse cell,
which are dropped anyway along with every component under 0.5% of the
triangles; GGK_TRIPOSG_KEEP_SPECKS=1 keeps those).
Checked against the PyTorch pipeline with the same weights as f16, the transformer's prediction agrees to 9e-5 relative and the decoded field to 2e-6; the quantized files add the engine's quantized arithmetic (about 1% on one prediction), which sixteen sampling steps turn into a slightly different take on the same shape.
The result is written as for TRELLIS.2 (.glb, .ply, .obj, no colours),
facing the same way, in the model's own cube of -1 to 1. --serve and ggk server engine serve it too, with "prompt", "scribble_confidence" and
"prompt_confidence" among the request fields.
A TripoSG (photo) file runs its 50 guided steps over 2048 tokens in about 70 s on the same card.
Hunyuan3D-2.1 (image to 3D, shape only)
Hunyuan3D-2.1 is the
largest of the shape models here: a 3B-parameter flow-matching transformer
samples 4096 latent tokens, conditioned on a DINOv2 encoding of the picture at
518 pixels, and a shape VAE decodes them into an occupancy field whose surface
is the mesh. The GGUF is the shape pipeline of the checkpoint (conditioner,
model, vae); there are no materials (upstream's texture stage, hy3dpaint,
is a separate set of models).
ggk -m hunyuan-3d-2.1-nvfp4.gguf --ref-image sheep.png -o out.glb
# more pictures of the same subject
ggk -m hunyuan-3d-2.1-nvfp4.gguf --ref-image front.png --ref-image back.png -o out.glb
On a 6 GB RTX 4050 Laptop the first command takes about 160 s - 138 s for the
50 guided steps, 22 s of decoding - and writes a watertight 565k-vertex,
1.13M-triangle mesh (27 MB). --steps 20 --mesh-pipeline 256 does it in
about 65 s. The nvfp4 file keeps 1.6 GB of transformer weights on the card;
the f16 file's 5.8 GB need a larger one (a stage that does not fit its device
runs on the CPU, which for this transformer is slow).
| Option | |
|---|---|
--ref-image |
the picture; repeat it for more pictures of the subject (up to 8) |
--seed, --steps, --cfg-scale |
as everywhere; the model's own are 50 steps at a guidance of 5. The noise is torch's for the same seed |
--mesh-pipeline <n> |
the marching cubes resolution, 32 to 1024 (default 384, upstream's octree resolution) |
--mesh-background, --mask <image> |
the subject, as for TRELLIS.2: cut out, scaled to 85% of a white square (upstream's ImageProcessorV2). The mask belongs to the first image |
--backend, --threads |
as everywhere |
Several images. The checkpoint is trained on one picture. With more, each is prepared and encoded the same way and the transformer cross-attends to the tokens of all of them - the layout of the family's multi-view models, without their view embeddings, which this checkpoint does not have. It runs and costs little (the image tokens are a small part of a step), but it is outside what the model was trained on: treat it as an experiment, and compare with the front view alone.
The mixture of experts. The transformer's last six blocks replace the MLP with eight experts, of which a gate picks two per token. Which tokens an expert gets is only known once the gate has run, so ggk cuts the pass at each gate: the scores come back to the host, are turned into index lists, and the next piece of the graph gathers each expert's tokens with them, the hidden state staying on the device in between. Every token goes through three MLPs (its two experts and the shared one) as upstream, not through all nine under a mask.
The surface is extracted as for TripoSG: a coarse lattice is decoded,
then the surface is followed cell by cell (7% of the 384³ lattice in the run
above). Against the full decode (GGK_HUNYUAN3D_DENSE=1) a 192³ test gave
the same mesh, vertex for vertex. Components under 0.5% of the triangles are
dropped (GGK_HUNYUAN3D_KEEP_SPECKS=1 keeps them).
Checked against the upstream PyTorch modules with the same weights as f16, the image tokens agree to 1.3e-3 relative (f16 arithmetic over 24 layers), the transformer's guided prediction to 1e-5 given the same tokens (the experts' routing included) and the decoded field to 1e-7. Two things differ from upstream by design: the last of the 50 steps, which upstream's schedule gives no length (its prediction is multiplied by zero), is not computed; and vertices are placed on the lattice they were extracted from, where upstream scales them by 384/385.
The result is written as for TRELLIS.2 (.glb, .ply, .obj, no colours),
facing the same way, in the model's own cube of -1.01 to 1.01. --serve and
ggk server engine serve it too; further pictures go in as more image
parts of the form, or as an array in JSON.
Stable Fast 3D (image to 3D, feed-forward, with materials)
Stable Fast 3D is TripoSR's successor: one pass through a camera-conditioned DINOv2 encoder and a two-stream triplane transformer, then small decoder heads for density, albedo, shading normals and vertex offsets, and a CLIP-based estimator for the object's roughness and metallic value. The colours are delit albedo rather than the picture's baked lighting. The GGUF is the only file to name:
ggk -m stable-fast-3d-f16.gguf --ref-image sheep.png -o out.glb
On a 6 GB RTX 4050 Laptop this takes about 5 s and writes a watertight 71k-vertex, 141k-triangle mesh (4 MB); about two minutes on the CPU alone (8 threads under Linux).
| Option | |
|---|---|
--mesh-pipeline <n> |
the marching cubes resolution, 32 to 512 (default 160, the resolution the model's vertex offsets were trained at) |
--mesh-background, --mask <image> |
the subject, as for TRELLIS.2 |
--mesh-no-texture |
the bare shape: no albedo, materials or shading normals |
--backend, --threads |
as everywhere |
--seed, --steps and --cfg-scale change nothing: the same image always
gives the same mesh.
Every network was checked against the upstream PyTorch modules with the same weights (image tokens, triplane, density, offsets, albedo and normals agree to about 1e-3 relative; roughness and metallic to three decimals). Two things are done differently from upstream, and are worth knowing:
- Surface. Upstream runs marching tetrahedra over a tetrahedral grid that ships beside its code, not in the checkpoint. ggk runs its marching cubes over a regular lattice of the same resolution, moved by the same vertex-offset head; components under 0.5% of the triangles are dropped.
- Materials. Upstream unwraps the mesh and bakes albedo and normal textures. ggk's meshes carry materials per vertex, so the surface is subdivided once (same shape, four times the vertices - about the triplane's own resolution) and each vertex gets the albedo, the model's shading normal, and the object's estimated roughness and metallic value. There is no UV map or texture image in the file.
The checkpoint's GGUF carries no config; the settings the tensors do not give
(camera distance 1.6 and field of view 40 degrees, density threshold 10, the
head activations) are upstream's defaults. The result is written as for
TRELLIS.2 (.glb, .ply, .obj), facing the same way, in the model's own
scene cube (0.87 either way). --serve and ggk server engine serve it too.
Serving 3D: /v1/images/edits
--serve answers over HTTP instead of writing one mesh and exiting: an image
comes in with each request and the 3D model goes back as the response.
OpenAI has no 3D endpoint, so the server borrows the one whose request has the
same shape - the image edit, an image in and an asset out - and ggk server engine starts it too (a TRELLIS.2, TripoSR, TripoSG, Stable Fast 3D or Hunyuan3D GGUF is
told apart by its metadata or its tensor names):
ggk -m trellis2-4b-nvfp4.gguf --serve --port 8888 --api-key sk-my-secret-key
# the same thing through the server launcher
ggk server engine -- --model trellis2-4b-nvfp4.gguf --port 8888 --api-key sk-my-secret-key
# the image as a file part of a multipart form (what OpenAI's SDKs send)
curl http://127.0.0.1:8888/v1/images/edits \
-H "Authorization: Bearer sk-my-secret-key" \
-F image=@sheep.png --output out.glb
# or as base64 in JSON
curl http://127.0.0.1:8888/v1/images/edits \
-H "Authorization: Bearer sk-my-secret-key" -H "Content-Type: application/json" \
-d "{\"image\": \"$(base64 -w0 sheep.png)\", \"seed\": 7}" --output out.glb
A base64 image is too long for a Windows command line (cmd stops at 8191
characters): there, use the form, or put the JSON in a file and send it with
-d @request.json. curl -f (or --fail-with-body) keeps an error out of
out.glb; without it a failed request leaves the JSON error message in the
file.
--host (127.0.0.1), --port (8888), --api-key and --alias configure the
server, as for speech. Every other option is the default of each request:
--mesh-pipeline, --mesh-background, --mesh-no-texture, --seed,
--steps, --cfg-scale, --backend, --threads.
| field | meaning |
|---|---|
image |
the picture (required): a file part, or in JSON its base64 / data: URI. OpenAI's JSON spelling "images": [{"image_url": "data:..."}] is read too. URLs are not fetched. Hunyuan3D takes more than one (several image / image[] parts, or an array); the others use the first |
mask |
the subject mask, white = subject, the size of the image (--mask) |
pipeline |
512, 1024, 1024_cascade, 1536_cascade or auto (--mesh-pipeline); for TripoSR, TripoSG and Hunyuan3D the marching cubes resolution, 32 to 1024; for Stable Fast 3D, 32 to 512 |
background |
auto or keep (--mesh-background) |
texture |
false skips the material stages / the vertex colours (--mesh-no-texture) |
seed, steps, guidance |
--seed (42 unless the server was started with another, so the same image gives the same mesh as ggk -m ... --ref-image ...; -1 = a new take every time), --steps, --cfg-scale |
prompt, scribble_confidence, prompt_confidence |
TripoSG-scribble: -p, --scribble-conf, --prompt-conf |
output_format |
glb (default), ply or obj |
response_format |
leave it out for the mesh file itself; b64_json wraps it in OpenAI's images object, {"created", "data": [{"b64_json"}], "output_format", "mesh": {"vertices", "triangles", "resolution", "textured", "seed"}} |
model and size are accepted and ignored, and so is prompt by every model
but TripoSG-scribble; n must be 1. The file
response carries X-Mesh-Vertices, X-Mesh-Triangles, X-Mesh-Resolution
and X-Seed headers. With b64_json the endpoint also works from an OpenAI
client:
import base64
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:8888/v1", api_key="sk-my-secret-key")
result = client.images.edit(model="trellis2", image=open("sheep.png", "rb"), prompt="",
response_format="b64_json")
open("out.glb", "wb").write(base64.b64decode(result.data[0].b64_json))
The response arrives when the mesh is done - there is nothing to stream - so
give the client a timeout to match (about 80 s for the 512 pipeline on a 6 GB
RTX 4050 Laptop, some 50 s without materials, minutes for a cascade). One
model is generated at a time; concurrent requests queue. Nothing stays on the device between requests: the stages load one
after another for each request, as in a one-shot run, which is what lets 4B
parameters work on a 6 GB card; the weights come from the operating system's
file cache from the second request on. GET /v1/models lists the model,
GET /health answers as soon as the port is open, and the LLM and speech
endpoints answer 501.
StarVector (image to SVG)
StarVector writes a picture as SVG
source: a vision tower turns the image into tokens, and a StarCoder language
model continues them with <svg ... until </svg>. The GGUF is the whole
model and the only file to name; the image is the whole prompt:
ggk -m starvector-1b-nvfp4.gguf --ref-image icon.png -o out.svg
ggk -m starvector-8b-nvfp4.gguf --ref-image icon.png -o out.svg
| StarVector-1B | StarVector-8B | |
|---|---|---|
| vision tower | CLIP ViT-L/14 at 224, 257 image tokens | SigLIP-L/16 at 384, 576 image tokens |
| language model | StarCoderBase-1B | StarCoder2-7B |
| most SVG tokens after the image | about 7900 | about 15400 |
| NVFP4 file | 0.8 GB | 4.2 GB |
On a 6 GB RTX 4050 Laptop the 1B writes 55 to 100 tokens a second and the 8B 18 to 27 (4.2 GB of the card); a flat icon is a few hundred tokens - 3 s with the 1B, under 20 s with the 8B. On the CPU alone (8 threads under Linux) they write about 6 and 2.5 tokens a second.
What it is for. The checkpoints are trained on icons, logos, emoji, fonts
and diagrams: flat pictures on a plain background, which is what they redraw
well. A photograph is outside that; the models answer one with shapes (or an
empty frame), not a likeness. Shown a photograph they in fact try to embed
it - an <image> element holding base64 they can only make up, and never
finish making up - so ggk refuses the token that would open one and the model
goes on with vector shapes instead (GGK_STARVECTOR_ALLOW_RASTER=1 turns that
off).
| Option | |
|---|---|
--ref-image (-r), -i |
the picture. Transparency is drawn over white and a picture that is not square is padded with white, as the training pictures are |
--seed |
which sample is drawn; another seed is another drawing |
--svg-temperature |
sampling temperature (default 0.2 for the 1B, 0.7 for the 8B, the settings the checkpoints are evaluated with; 0 always takes the most likely token) |
--svg-top-p |
nucleus sampling (default 0.95) |
--svg-repeat-penalty |
penalty on tokens already written (default 1, none; a little above 1 helps a drawing that repeats itself) |
--svg-max-tokens |
the most tokens to write (default: what the model's context holds after the image) |
--backend, --threads |
as everywhere |
The result is finished off as a document: it ends at </svg>; a drawing
that runs out of tokens (or, on a small card, of memory for a longer one) is
cut at its last whole element and its open elements are closed, with a
warning; and the root gets the SVG namespace if the model left it out. What
is in between is the model's own text and is not validated - a drawing that
went wrong (a photograph, usually) can contain a malformed attribute. -o
gets the .svg extension if it has another.
A GGUF that kept the checkpoint's tokenizer.json in its metadata is decoded
with it; one that kept only the tensors (a quantized copy often does) is
decoded with the built-in StarCoder / StarCoder2 vocabulary. Text-to-SVG
checkpoints (no image modules) and --serve are not supported.
Both models were checked against the upstream PyTorch modules with the same (dequantized) weights: greedy decoding gives the same tokens (3000 of 3000 compared for the 1B on CUDA, 60 of 60 for the 8B on the CPU).
Integer weight types (i8 / i16 / i32 / i64)
The plain integer tensor types carry no scale of their own, so a weight cast
straight to i8 would be all zeros. When the quantizer converts a tensor to an
integer type (--type i8, or a rule like embed_tokens.weight=i8) it stores a
symmetric per-row scale in the file's metadata,
int_scale.<tensor name> = [f32; rows] # value = int * scale[row]
and the diffusion engine folds the scale back in at load time (i8 computes as q8_0, i16 as f16, i32/i64 as f32 on every backend). The LLM server does the same conversion while it loads (which turns mmap off for that model, since the converted weights need their own buffers). Converting the tensor to any other type drops the key again. An integer tensor without the key is what it always was in GGUF: raw integers (token tables, indices).
The editor marks such tensors with a ×scale badge, and every tensor row has
a Values button that decodes a slice of one row through the quantizer
library (scales applied, with a "raw integers" toggle for scaled weights).
Renaming, deleting or merging a scaled tensor keeps its int_scale.* entry in
step on save.
Which hardware it picked
Every engine prints the device list to stderr before it does anything else:
gk: found 2 devices
CUDA0: NVIDIA GeForce RTX 4050 Laptop GPU, 6140 MiB | compute capability = 8.9 | SMs = 20 | shared memory = 99 KiB | built for = 89
CPU: gk CPU backend, 32014 MiB | SIMD = AVX2 | AVX2 = 1 | FMA = 1 | F16C = 1 | F16_VEC = 1
If a GPU you expected is missing, the install was a CPU-only one (the GPU
switches above are opt-in at install time) or its driver was not found — either
way the run works, on the CPU, at CPU speed, which is otherwise indistinguishable
from a slow GPU. GK_QUIET=1 suppresses the banner.
Layout
vendor/engine/ the unified ggk engine (one CMake build)
gk/ the gk compute kernels (CPU + optional GPU backends)
gk/compat/ the historical ggml C API, implemented on gk
src/ common/ mtmd/ GGUF LLM runtime
app/ the gguf-server HTTP server
diffusion/ diffusion runtime + CLI
quantizer/ quantizer shared library (its own quant kernels)
src/ggk/ the Python package
server/ diffuser/ editor/ the three panels (backend + web frontend each)
gui.py static/ the unified 3-panel GUI shell
Nothing above gk/compat/ knows gk exists: the runtimes include the same
ggml.h / ggml-backend.h / gguf.h headers and call the same functions
they always did, while graph building, allocation, scheduling and the kernels
themselves are gk's. See vendor/engine/README.md for the engine's own build
options.
The editor's quantizer stays independent — its qz_* codec is compiled both
into the quantizer library the editor drives and into gk itself, so the
encoder and the runtimes' decoder can never disagree about a GGUF block.
Metadata
Release files for ggk 1.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ggk-1.1.6.tar.gz | 37.4 MB | Without provenance | Details for ggk-1.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ggk-1.1.6-py3-none-win_amd64.whl | Python 3 | none | Windows x86-64 | Details for ggk-1.1.6-py3-none-win_amd64.whl |
Total release size: 126.7 MB
Release files / ggk-1.1.6.tar.gz
| Download URL | ggk-1.1.6.tar.gz |
|---|---|
| Size | 37.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7dadd16a47481582c9a9638ded80ce69b8a176a81d09258958e390de7040e692
|
|
BLAKE2b-256 checksum How to use checksums |
e75cb11b23db8cf5b0f4a0c7cb06ada2625a7d638bd40371b19d43e069a861d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / ggk-1.1.6-py3-none-win_amd64.whl
| Download URL | ggk-1.1.6-py3-none-win_amd64.whl |
|---|---|
| Size | 89.3 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b0eab0cd673ecabd6540648e224e06e8e0567a7608f56342d2fba6e02c6b16ab
|
|
BLAKE2b-256 checksum How to use checksums |
3348520253516e450f251dffdc88fca9081536e7846d1a037ac69828d1757a67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for ggk 1.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.