Bug Report: Incorrect VAE Used in Pipeline

#12
by PierrunoYT - opened

🐛 Bug Report: Incorrect VAE Used in Pipeline

Title: Fix default VAE: Use AutoencoderKL instead of AutoencoderTiny

Repository: FLUX.1-Krea-dev-Pinokio


📝 Description

The app currently loads a high-quality AutoencoderKL from the FLUX.1-Krea-dev model, but uses taef1 (AutoencoderTiny) as the VAE in the pipeline by default.

This causes:

  • Noticeable drop in image quality
  • Runtime warning:
    Expected types for vae: (<class 'AutoencoderKL'>,), got <class 'AutoencoderTiny'>.
    
  • Wasted memory (loading two VAEs)
  • Misalignment with expected FLUX.1-level output quality

🔍 Root Cause

In app.py, the pipeline is initialized with taef1 (a low-fidelity decoder), even though a full AutoencoderKL is available:

pipe = DiffusionPipeline.from_pretrained("PierrunoYT/FLUX.1-Krea-dev", ..., vae=taef1)

But taef1 is not appropriate for high-quality generation.

✅ Expected Behavior

By default, the pipeline should use the included AutoencoderKL for accurate, high-fidelity image reconstruction.

💡 Solution

Update the pipeline to use the correct VAE:

pipe = DiffusionPipeline.from_pretrained(
    "PierrunoYT/FLUX.1-Krea-dev",
    torch_dtype=dtype,
    vae=good_vae  # ← AutoencoderKL (high quality), not taef1
).to(device)

🛠️ Suggested Fix

Replace this line:

pipe = DiffusionPipeline.from_pretrained(..., vae=taef1)

With:

pipe = DiffusionPipeline.from_pretrained(..., vae=good_vae)

Optionally, remove loading taef1 unless offering a "fast decode" mode.

📌 Impact

  • ✅ Higher image quality
  • ✅ No more VAE type mismatch warnings
  • ✅ Better utilization of the trained model

Thank you for your excellent work on bringing FLUX.1-Krea-dev to Pinokio!
This small fix ensures users get the full quality they expect.


One-sentence summary for maintainers:
The pipeline currently uses AutoencoderTiny (taef1) instead of the higher-quality AutoencoderKL available in the model, reducing output fidelity.


Let me know if you'd like a pull request (PR) for this fix — I can write the exact code change for app.py.

Sign up or log in to comment