Skip to content

[Bug] model convert #1821

Description

@alexdsh

Git commit

Hello! I used the safetensors to gguf conversion function, but although the resulting files don't always work. In particular, when trying to use the https://github.com/leejet/stable-diffusion.cpp/blob/master/docs/minit2i.md model, I get an error when converting to 4/8-bit gguf and then running it. It turns out the built-in converter doesn't convert layers correctly. Then I also tried using sdxs.safetensors without conversion, ran it on sd-cli compiled in ndk 27, but I still get an error. Regular models work without problems. (I ran it on an 855 Snapdragon with 6 GB of RAM, sdk28). I also tried compiling the GPU version, replaced the default Vulkan with TurnIP in Termux, but in the end I couldn't use Vulkan acceleration. Is this even possible on Android? 6xx series?

Operating System & Version

android 9,855 snapdragon,6 gb

GGML backends

Vulkan

Command-line arguments used

python3 scripts/convert.py --models_path /путь/к/minit2.safetensors --out_path ~/Загрузки/minit2-q8_0.gguf --out_type q8_0

Steps to reproduce

I'm not an expert, I did everything with the help of Gemini's AI assistant. That's why I asked her to formulate the problem as precisely as possible. Here's her text."Title: [Bug] Issues with standalone SDXS version detection, mobile Vulkan extension crashes, and T5 quantization failures (t5_mini-t2)
​Description:
Hi leejet, thanks for your incredible work on stable-diffusion.cpp. While testing and running benchmarks in a mobile environment (Termux, Adreno GPU with Turnip Vulkan driver), I encountered several distinct roadblocks regarding model loading, quantization, and GPU backends:
​1. get sd version from file failed with standalone/distilled models (e.g., SDXS)
​When trying to run a standalone diffusion model (like SDXS, which consists solely of a distilled UNet without heavy pipeline components), sd-cli fails during initialization:
​Log error: [ERROR] stable-diffusion.cpp:841 - get sd version from file failed: ''
​Cause: The auto-detection logic checks for specific tensor keys or full checkpoint metadata to determine the model architecture. Standalone distilled UNets lack these markers, causing version resolution to return an empty string.
​Suggestion: Could we add a CLI flag (e.g., an architecture override) to manually specify the model type when passing standalone diffusion files?
​2. T5 Quantization / Conversion Failure (t5_mini-t2)
​When attempting to convert or quantize lightweight text encoder models like t5_mini-t2 into low-bit formats (such as Q4_0, Q4_K, or Q8_0), the weight conversion or runtime loading corrupts critical layer structures:
​Symptom: Quantized layers break internally, leading to segmentation faults or crashes in sdcpp right as it tries to parse or execute the text encoder.
​Cause: Certain tensor patterns or layer norms within smaller T5 variants might not map correctly to the current GGUF quantization routines, resulting in broken weight layouts.
​Suggestion: A review of the T5 conversion/quantization mapping for smaller or variant architectures would be extremely helpful to ensure low-bit compatibility.
​3. Vulkan Device Creation Failure on Mobile (Adreno / Turnip)
​When attempting to use the Vulkan backend (--backend vulkan), initialization crashes on mobile:
​Log error: libc++abi: terminating due to uncaught exception of type vk::ExtensionNotPresentError: vk::PhysicalDevice::createDevice: ErrorExtensionNotPresent
​Cause: The Vulkan wrapper strictly requests device extensions that might not be fully exposed by the Turnip driver on certain mobile architectures.
​Suggestion: Adding a graceful fallback or softer error handling for non-critical Vulkan extensions would greatly improve mobile compatibility.
​Thanks again for your time and for maintaining this project!"

What you expected to happen

Although the CPU generation is stable, it's extremely slow (especially the Minit2 model), which requires 100 steps. So I tried to speed up the calculations on the integrated Android 640. Unfortunately, I haven't been able to use it yet. I did receive the binary, though, and it compiled correctly.

What actually happened

The models don't run on the GPU, and trying to install a non-standard model (single-step SDXS512) on the CPU also doesn't work. The compiled CPU binary works fine, but inference on the same Minit2 at 256*256@100 took me over an hour.

Logs / error messages / stack trace

Log error: libc++abi: terminating due to uncaught exception of type vk::ExtensionNotPresentError: vk::PhysicalDevice::createDevice: ErrorExtensionNotPresent

Additional context / environment details

855( andreno 640)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions