Skip to content

"get sd version from file failed:" To work with img2img and gaianet/FLUX.1-Fill-dev-GGUF #655

@ServeurpersoCom

Description

@ServeurpersoCom

I love stable-diffusion.cpp; I try a flux.1-fill model https://huggingface.co/gaianet/FLUX.1-Fill-dev-GGUF (Quantized with stable-diffusion.cpp master-c3eeb669.)

#105
#511
"Adds support for sd1.x inpaint, sd2.x inpaint, sdxl inpaint, and Flux Fill models, as well as "inpainting" (masked img2img) with normal diffusion models."

const char* model_version_to_str[] = {
    "SD 1.x",
    "SD 1.x Inpaint",
    "SD 2.x",
    "SD 2.x Inpaint",
    "SDXL",
    "SDXL Inpaint",
    "SVD",
    "SD3.x",
    "Flux",
    "Flux Fill"};
...

->
        version = model_loader.get_sd_version();
        if (version == VERSION_COUNT) {
            LOG_ERROR("get sd version from file failed: '%s'", model_path.c_str());
            return false;
        }

If I override version with VERSION_FLUX_FILL (I tried with and without --vae from flux) I get same :

ggml_cuda_init: GGML_CUDA_FORCE_MMQ:    no
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
ggml_cuda_init: found 1 CUDA devices:
  Device 0: NVIDIA GeForce RTX 4060 Ti, compute capability 8.9, VMM: yes
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.conv_in.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.conv_in.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.conv_out.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.conv_out.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.attn_1.k.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.attn_1.k.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.attn_1.norm.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.attn_1.norm.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.attn_1.proj_out.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.attn_1.proj_out.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.attn_1.q.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.attn_1.q.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.attn_1.v.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.attn_1.v.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_1.conv1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_1.conv1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_1.conv2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_1.conv2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_1.norm1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_1.norm1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_1.norm2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_1.norm2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_2.conv1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_2.conv1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_2.conv2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_2.conv2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_2.norm1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_2.norm1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_2.norm2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.mid.block_2.norm2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.norm_out.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.norm_out.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.0.conv1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.0.conv1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.0.conv2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.0.conv2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.0.nin_shortcut.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.0.nin_shortcut.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.0.norm1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.0.norm1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.0.norm2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.0.norm2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.1.conv1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.1.conv1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.1.conv2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.1.conv2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.1.norm1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.1.norm1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.1.norm2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.1.norm2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.2.conv1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.2.conv1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.2.conv2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.2.conv2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.2.norm1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.2.norm1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.2.norm2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.0.block.2.norm2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.0.conv1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.0.conv1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.0.conv2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.0.conv2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.0.nin_shortcut.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.0.nin_shortcut.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.0.norm1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.0.norm1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.0.norm2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.0.norm2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.1.conv1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.1.conv1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.1.conv2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.1.conv2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.1.norm1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.1.norm1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.1.norm2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.1.norm2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.2.conv1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.2.conv1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.2.conv2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.2.conv2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.2.norm1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.2.norm1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.2.norm2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.block.2.norm2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.upsample.conv.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.1.upsample.conv.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.2.block.0.conv1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.2.block.0.conv1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.2.block.0.conv2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.2.block.0.conv2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.2.block.0.norm1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.2.block.0.norm1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.2.block.0.norm2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.2.block.0.norm2.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.2.block.1.conv1.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.2.block.1.conv1.weight' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.2.block.1.conv2.bias' not in model file
[ERROR] model.cpp:1938 - tensor 'first_stage_model.decoder.up.2.block.1.conv2.weight' not in model file

So the real issue seems to be that even with --vae, the external ae.safetensors (provided by the original Flux model authors) is either:

  • Not being loaded properly
  • Or not merged/used during the model initialization phase (even though all first_stage_model.decoder.* tensors are present in the VAE file)

Maybe the VAE external loading logic is disabled or bypassed for non-standard model versions like VERSION_FLUX_FILL? Or perhaps the loading logic only works for certain architectures like SDXL?

Would love a pointer to where in model.cpp / model_loader.cpp this logic is handled, happy to test/debug/provide trace if needed!

Happy to test any WIP/fix branch. My server is running 24/7 and already compiles custom builds.

gguf-dump.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions