{"record":{"id":"d9762586218e6961","repo":"mudler/LocalAI","slug":"acestep-cpp-fatal-failed-to-load-text-encoder-n","errorCode":null,"errorMessage":"[acestep-cpp] FATAL: failed to load text encoder\\n","messagePattern":"\\[acestep-cpp\\] FATAL: failed to load text encoder\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"backend/go/acestep-cpp/cpp/goacestepcpp.cpp","lineNumber":195,"sourceCode":"\n    std::string text_str  = std::string(\"# Instruction\\n\") + instruction + \"\\n\\n\" +\n                            \"# Caption\\n\" + cap_str + \"\\n\\n\" +\n                            \"# Metas\\n\" + metas + \"<|endoftext|>\\n\";\n    std::string lyric_str = std::string(\"# Languages\\n\") + lang_str + \"\\n\\n# Lyric\\n\" +\n                            lyrics_str + \"<|endoftext|>\";\n\n    // 3. Tokenize\n    auto text_ids  = bpe_encode(&tok, text_str.c_str(), true);\n    auto lyric_ids = bpe_encode(&tok, lyric_str.c_str(), true);\n    int  S_text    = (int)text_ids.size();\n    int  S_lyric   = (int)lyric_ids.size();\n\n    fprintf(stderr, \"[acestep-cpp] caption: %d tokens, lyrics: %d tokens\\n\", S_text, S_lyric);\n\n    // 4. Text encoder forward (backend init handled inside qwen3_load_text_encoder)\n    Qwen3GGML text_enc = {};\n    if (!qwen3_load_text_encoder(&text_enc, g_text_enc_path.c_str())) {\n        fprintf(stderr, \"[acestep-cpp] FATAL: failed to load text encoder\\n\");\n        return 4;\n    }\n\n    int                H_text = text_enc.cfg.hidden_size;  // 1024\n    std::vector<float> text_hidden(H_text * S_text);\n\n    qwen3_forward(&text_enc, text_ids.data(), S_text, text_hidden.data());\n    fprintf(stderr, \"[acestep-cpp] TextEncoder forward done\\n\");\n\n    // 5. Lyric embedding\n    std::vector<float> lyric_embed(H_text * S_lyric);\n    qwen3_embed_lookup(&text_enc, lyric_ids.data(), S_lyric, lyric_embed.data());\n\n    // 6. Condition encoder (backend init handled inside cond_ggml_load)\n    CondGGML cond = {};\n    if (!cond_ggml_load(&cond, g_dit_path.c_str())) {\n        fprintf(stderr, \"[acestep-cpp] FATAL: failed to load condition encoder\\n\");\n        qwen3_free(&text_enc);","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/go/acestep-cpp/cpp/goacestepcpp.cpp#L177-L213","documentation":"The acestep-cpp music-generation pipeline failed at step 4: qwen3_load_text_encoder() returned false, so the Qwen3 text encoder GGUF (g_text_enc_path) could not be loaded into the Qwen3GGML struct. The function is expected to also perform backend init internally, so a failure means either the file is missing/corrupt or ggml backend allocation failed. The shim aborts generation with exit code 4 after printing this to stderr.","triggerScenarios":"Calling the generate entry point with a text-encoder model path that does not exist, points at a non-GGUF or truncated file, has mismatched tensor names/architecture (not Qwen3 layout), or when ggml backend (CPU/GPU) initialization fails inside qwen3_load_text_encoder.","commonSituations":"Model gallery entry resolved to a wrong or partially downloaded text encoder file; user pointed --text-enc at the DiT or VAE weights instead of the Qwen3 encoder; disk-full or interrupted download left a truncated GGUF; build lacks the GPU backend the file was quantized for.","solutions":["Verify g_text_enc_path points to an existing, complete Qwen3 GGUF (check file size against the gallery manifest, re-download if truncated).","Run with GGML backend logging enabled (the ggml_log_cb shim already routes backend logs to stderr) to see the exact load failure before the FATAL line.","Confirm the file is actually the text encoder shard, not the DiT/VAE (g_dit_path) — tensor names must match the Qwen3 layout qwen3_load_text_encoder expects.","If backend init is the cause, check that the ggml backends bundled with the binary (CPU/CUDA/Metal) load — ggml_backend_load_all() output appears earlier in stderr."],"exampleFix":"// before: pointing at the wrong shard\nacestep_set_paths(\"dit.gguf\", \"vae.gguf\", \"dit.gguf\"); // text enc == dit, wrong\n// after: point text encoder at the Qwen3 GGUF\nacestep_set_paths(\"qwen3_text_encoder.gguf\", \"vae.gguf\", \"acestep_dit.gguf\");","handlingStrategy":"validation","validationCode":"// Go side, before generation:\nif _, err := os.Stat(textEncPath); err != nil {\n    return fmt.Errorf(\"text encoder missing: %w\", err)\n}\nif fi, _ := os.Stat(textEncPath); fi.Size() < 1<<20 {\n    return errors.New(\"text encoder file suspiciously small (truncated?)\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate all three model paths (text encoder, DiT, VAE) exist and match gallery manifest sizes before starting the pipeline.","Capture stderr including ggml log output so the underlying load failure is diagnosable.","Use the model gallery rather than manual paths to keep shards from the same release."],"tags":["acestep-cpp","model-loading","gguf","ggml","music-generation"],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}