From a5a6c6b79c58ebee0c0cda6103ee773a97ecddfb Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Sun, 18 Oct 2026 17:51:36 +0000 Subject: [PATCH] feat(gallery): add MOSS-Image and wire tokenizer option stable-diffusion.cpp PR #2148 added MOSS-Image support, which needs an external tokenizer file passed via the --tokenizer CLI arg. The C++ binding (gosd.cpp) never parsed a tokenizer option nor set ctx_params.tokenizer, so MOSS-Image could not load through LocalAI. - Wire the "tokenizer" option in gosd.cpp (parse + assign to ctx_params) - Resolve "tokenizer:..." paths against the model directory in gosd.go, the same way *_path options are resolved - Bump the vendored stable-diffusion.cpp to 68285df (moss-image merge) - Add moss-image-base and moss-image-sft gallery entries (int8_convrot) FLUX.3 Image Klein is already in the gallery (added in #12736). --- backend/go/stablediffusion-ggml/Makefile | 2 +- backend/go/stablediffusion-ggml/cpp/gosd.cpp | 3 + backend/go/stablediffusion-ggml/gosd.go | 2 +- gallery/index.yaml | 91 ++++++++++++++++++++ 4 files changed, 96 insertions(+), 2 deletions(-) diff --git a/backend/go/stablediffusion-ggml/Makefile b/backend/go/stablediffusion-ggml/Makefile index 12e8060a36d2..f569fbcf5d16 100644 --- a/backend/go/stablediffusion-ggml/Makefile +++ b/backend/go/stablediffusion-ggml/Makefile @@ -8,7 +8,7 @@ JOBS?=$(shell nproc --ignore=1) # stablediffusion.cpp (ggml) STABLEDIFFUSION_GGML_REPO?=https://github.com/leejet/stable-diffusion.cpp -STABLEDIFFUSION_GGML_VERSION?=8cd731e7b4667eb8f40a153315b9a7125d09a58d +STABLEDIFFUSION_GGML_VERSION?=68285df319457e2d79310b48513e4ba1bf8ebe9a CMAKE_ARGS+=-DGGML_MAX_NAME=128 diff --git a/backend/go/stablediffusion-ggml/cpp/gosd.cpp b/backend/go/stablediffusion-ggml/cpp/gosd.cpp index 5d2bae55518e..d2fd95e1b51c 100644 --- a/backend/go/stablediffusion-ggml/cpp/gosd.cpp +++ b/backend/go/stablediffusion-ggml/cpp/gosd.cpp @@ -395,6 +395,7 @@ int load_model(const char *model, char *model_path, char* options[], int threads const char *photo_maker_path = ""; const char *pulid_weights_path = ""; const char *tensor_type_rules = ""; + const char *tokenizer_path = ""; char *lora_dir = model_path; // Upstream backend/parameter placement specs (see docs/.../stablediffusion). @@ -503,6 +504,7 @@ int load_model(const char *model, char *model_path, char* options[], int threads if (!strcmp(optname, "photo_maker_path")) photo_maker_path = strdup(optval); if (!strcmp(optname, "pulid_weights_path")) pulid_weights_path = strdup(optval); if (!strcmp(optname, "tensor_type_rules")) tensor_type_rules = strdup(optval); + if (!strcmp(optname, "tokenizer")) tokenizer_path = strdup(optval); // Backend / parameter placement specs (see prepare_backend_assignments // in the upstream CLI). These compose with the legacy keep_*_on_cpu / @@ -619,6 +621,7 @@ int load_model(const char *model, char *model_path, char* options[], int threads ctx_params.photo_maker_path = photo_maker_path; if (strlen(pulid_weights_path) > 0) ctx_params.pulid_weights_path = pulid_weights_path; ctx_params.tensor_type_rules = tensor_type_rules; + if (strlen(tokenizer_path) > 0) ctx_params.tokenizer = tokenizer_path; ctx_params.n_threads = n_threads; ctx_params.rng_type = rng_type; if (wtype != SD_TYPE_COUNT) ctx_params.wtype = wtype; diff --git a/backend/go/stablediffusion-ggml/gosd.go b/backend/go/stablediffusion-ggml/gosd.go index de5609c23f8c..31859ad141ec 100644 --- a/backend/go/stablediffusion-ggml/gosd.go +++ b/backend/go/stablediffusion-ggml/gosd.go @@ -359,7 +359,7 @@ func (sd *SDGGML) Load(opts *pb.ModelOptions) error { } // If it's an option path, we resolve absolute path from the model path - if strings.Contains(op, ":") && strings.Contains(op, "path") { + if strings.Contains(op, ":") && (strings.Contains(op, "path") || strings.Contains(op, "tokenizer")) { data := strings.Split(op, ":") if err := utils.VerifyPath(data[1], opts.ModelPath); err == nil { data[1] = filepath.Join(opts.ModelPath, data[1]) diff --git a/gallery/index.yaml b/gallery/index.yaml index de892ef6d2f5..d4c12008fe16 100644 --- a/gallery/index.yaml +++ b/gallery/index.yaml @@ -52091,6 +52091,97 @@ - filename: stablediffusion-cpp/models/Qwen3VL-4B-Instruct-Q4_K_M.gguf sha256: 66358cb18bb6b3b1b6675aa412c7a88ef01d228f481184d13668e5201c730a0a uri: https://huggingface.co/Qwen/Qwen3-VL-4B-Instruct-GGUF/resolve/main/Qwen3VL-4B-Instruct-Q4_K_M.gguf +- name: moss-image-base + url: github:mudler/LocalAI/gallery/flux-ggml.yaml@master + urls: + - https://huggingface.co/Comfy-Org/MOSS-Image + - https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base + description: | + MOSS-Image-Base is a 5B diffusion transformer image generation model from OpenMOSS-Team. It uses Qwen3.5 9B as the LLM text encoder, the FLUX.2 VAE, and an external tokenizer. The Base variant supports text-to-image generation with classifier-free guidance (default: CFG 3.0, 1024x1024). + + This entry uses the int8_convrot quantization of the diffusion model (~5.4 GB). + license: apache-2.0 + icon: https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base/resolve/main/assets/teaser.webp + tags: + - moss-image + - text-to-image + - image-generation + - diffusion + - 5b + - quantized + - safetensors + last_checked: "2026-10-18" + overrides: + cfg_scale: 3 + options: + - diffusion_model + - vae_path:stablediffusion-cpp/models/flux2-vae.safetensors + - sampler:euler + - llm_path:stablediffusion-cpp/models/Qwen3.5-9B-Q4_K_M.gguf + - tokenizer:stablediffusion-cpp/models/moss-image-tokenizer.json + - offload_params_to_cpu:true + - vae_decode_only:false + parameters: + model: stablediffusion-cpp/models/moss_image_base_int8_convrot.safetensors + step: 20 + files: + - filename: stablediffusion-cpp/models/moss_image_base_int8_convrot.safetensors + uri: https://huggingface.co/Comfy-Org/MOSS-Image/resolve/main/diffusion_models/moss_image_base_int8_convrot.safetensors + - filename: stablediffusion-cpp/models/flux2-vae.safetensors + sha256: d64f3a68e1cc4f9f4e29b6e0da38a0204fe9a49f2d4053f0ec1fa1ca02f9c4b5 + uri: https://huggingface.co/Comfy-Org/flux2-dev/resolve/main/split_files/vae/flux2-vae.safetensors + - filename: stablediffusion-cpp/models/Qwen3.5-9B-Q4_K_M.gguf + sha256: 03b74727a860a56338e042c4420bb3f04b2fec5734175f4cb9fa853daf52b7e8 + uri: https://huggingface.co/unsloth/Qwen3.5-9B-GGUF/resolve/main/Qwen3.5-9B-Q4_K_M.gguf + - filename: stablediffusion-cpp/models/moss-image-tokenizer.json + sha256: 06b9509352d2af50381ab2247e083b80d32d5c0aba91c272ca9ff729b6a0e523 + uri: https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base/resolve/main/tokenizer/tokenizer.json +- name: moss-image-sft + url: github:mudler/LocalAI/gallery/flux-ggml.yaml@master + urls: + - https://huggingface.co/Comfy-Org/MOSS-Image + - https://huggingface.co/OpenMOSS-Team/MOSS-Image-SFT + description: | + MOSS-Image-SFT is the supervised fine-tuned variant of MOSS-Image, a 5B diffusion transformer image generation model from OpenMOSS-Team. It uses Qwen3.5 9B as the LLM text encoder, the FLUX.2 VAE, and an external tokenizer. The SFT variant produces higher-quality outputs with classifier-free guidance (default: CFG 3.0, 1024x1024). + + This entry uses the int8_convrot quantization of the diffusion model (~5.4 GB). + license: apache-2.0 + icon: https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base/resolve/main/assets/teaser.webp + tags: + - moss-image + - moss-image-sft + - text-to-image + - image-generation + - diffusion + - 5b + - quantized + - safetensors + last_checked: "2026-10-18" + overrides: + cfg_scale: 3 + options: + - diffusion_model + - vae_path:stablediffusion-cpp/models/flux2-vae.safetensors + - sampler:euler + - llm_path:stablediffusion-cpp/models/Qwen3.5-9B-Q4_K_M.gguf + - tokenizer:stablediffusion-cpp/models/moss-image-tokenizer.json + - offload_params_to_cpu:true + - vae_decode_only:false + parameters: + model: stablediffusion-cpp/models/moss_image_sft_int8_convrot.safetensors + step: 20 + files: + - filename: stablediffusion-cpp/models/moss_image_sft_int8_convrot.safetensors + uri: https://huggingface.co/Comfy-Org/MOSS-Image/resolve/main/diffusion_models/moss_image_sft_int8_convrot.safetensors + - filename: stablediffusion-cpp/models/flux2-vae.safetensors + sha256: d64f3a68e1cc4f9f4e29b6e0da38a0204fe9a49f2d4053f0ec1fa1ca02f9c4b5 + uri: https://huggingface.co/Comfy-Org/flux2-dev/resolve/main/split_files/vae/flux2-vae.safetensors + - filename: stablediffusion-cpp/models/Qwen3.5-9B-Q4_K_M.gguf + sha256: 03b74727a860a56338e042c4420bb3f04b2fec5734175f4cb9fa853daf52b7e8 + uri: https://huggingface.co/unsloth/Qwen3.5-9B-GGUF/resolve/main/Qwen3.5-9B-Q4_K_M.gguf + - filename: stablediffusion-cpp/models/moss-image-tokenizer.json + sha256: 06b9509352d2af50381ab2247e083b80d32d5c0aba91c272ca9ff729b6a0e523 + uri: https://huggingface.co/OpenMOSS-Team/MOSS-Image-Base/resolve/main/tokenizer/tokenizer.json - name: Z-Image-Turbo url: github:mudler/LocalAI/gallery/z-image-ggml.yaml@master urls: