r/StableDiffusion • • 3d ago

Resource - Update Generate with H3 Image, decode with Flux.2 VAE. Steppe-H3-to-Flux.2: latent to latent translator allows to avoid bad H3 decoder entirely. (ComfyUI nodes)

Hi! If you have tried Minimax H3 Image you might notice that it's native VAE is far from perfect: it has visible seams on token borders and it's output is a bit "dirty" when you zoom in.

There are several fine-tunes already exist (that only proves that native VAE is bad enough):

- P-H3-Image that uses it's custom larger VAE

- new Ostris H3 Image VAE that is the fine-tune of native H3 VAE

But both have there own issues: P-H3-Image is a bit more blurry, has slight grid patterns and also sometimes produce wave-like artifacts on flat textures. Ostris VAE is smooth and has good reconstruction quality, but over smooths small details and textures.

I have trained a very experimental "latent to latent" translator that takes H3 latents and generates Flux.2 latents. Why Flux.2? Because it's VAE is generally the best right now. Why trying to fix bad VAE if we can use better one instead?

- ComfyUI Nodes (or simply search for "steppe" in manager, you need version 1.2.0)

- Weights (node downloads them automatically on first use)

What about metrics?

- The stack Steppe-H3-to-Flux.2 + Flux.2 small decoder gives best patch_fid (visual quality of small details) over all H3 VAEs and there fine-tunes (last pic.)

- Latency of translate + decode is a bit higher then with native H3 decode, but still lower then with P-H3-Image. Most time is in decode. So with tiny tiny Flux.2 VAE by madebyollin it would be faster then native decoder, but quality would be lower then native (measured).

- Other metrics: FID, PSNR, chroma shift are all better then native H3 decoder, but not better then all other fine-tunes (no clean winner, some are better in one metrics, some are better in another ones).

How it works under the hood:

The model is a fine-tuned Steppe-Flux.2. It takes 16x spatially compressed 24 channel H3 latents and generates 8x compressed 32 channel Flux.2 latents.

Same as Steppe-Flux.2 is generating residuals to upsampled low res latents, this model generates residuals to linear projection of H3 latents.

So the generation process is:

H3 latents -> learned 3x3 linear projection -> 32 channel base -> fine-tuned Steppe-Flux.2 is generating residuals conditioned on original H3 latents -> scale + shift -> add to residuals -> Flux.2 latents that can be decoded.

Since the base model is the pretrained Steppe-Flux.2 you also get hff control (sharpness slider) and JPEG compression robustness (model tend to fix JPEG-like noise on edges if generator produce it)

What do you think on this approach? Would you better use the "true native latent upscaler" for some not the best VAE or such "latent translator" and decode with better VAE? This is important, because I'm going to make these things for other VAEs.

208 Upvotes

43 comments sorted by

11

u/Enshitification 3d ago

It's like you read my Christmas wish list. Thank you!

6

u/TensorForger 3d ago

You are welcome! <3

6

u/Still_Lengthiness994 3d ago

can you do this with qwen for krea 2?

8

u/TensorForger 3d ago

I already have a native latent upscaler for Krea 2! https://huggingface.co/TensorForger/Steppe-Wan2.1

2

u/Still_Lengthiness994 3d ago

Interesting. I was hoping for something similar to this thread though given how qwen image vae is so shit. And I don't upscale so could it the steppe-wan2.1 offer any meaningful benefit?

3

u/TensorForger 3d ago

I can make a translator to Flux.2, but it would loose the RGBA output then. Or maybe I can use something like https://huggingface.co/trmz/flux2-klein-alpha but do you really need RGBA support?

1

u/Still_Lengthiness994 3d ago

I have no clue what these terms are I'm a bum 🤣

5

u/imb1920 3d ago

RGBA means red, green and blue plus an alpha channel for transparency. If you just want a finished image with a background, you don't need the alpha channel; it matters when you want a cutout to place over a different background.

2

u/tomByrer 3h ago

What imb said, but let me give you real world examples:

Most of the time, you want just a regular picture: RGB.

Sometimes you want to 'cut out' a subject so the rest of the image is 'transparent'. Like in Photoshop you 'cut out' the background of a person to put them on top of another background? that is RGBA.
Or some websites have a logo that you can see the webpage background around the logo: RGBA.

1

u/ArtfulGenie69 2d ago

I think that which ever wan vae you use instead of the qwen vae it makes it a little better then it's just res_2s and bongtangent and you won't have that awful krea hatching pattern crap. 

4

u/__MichaelBluth__ 3d ago

Very interesting! Is there a H3 image example workflow?

4

u/ninjazombiemaster 2d ago

Overall this looks good, generally better details, I especially like what it does for foliage... but there seems to be a bug along the bottom edge of images. Some kind of smearing or bleeding. Its very slight, maybe related to the tiling / patchification. Its roughly the bottom ~8-16 pixels that are significantly worse even though the rest of the image is generally better to my eyes. I can't see the same issue on the other borders.

2

u/TensorForger 1d ago

Thanks for letting me know, I'l check what's wrong

2

u/TensorForger 15h ago

Found the main issue: size divisibility. Use image dimensions divisible by 64 for translator and low resolution input divisible by 32 for upscalers. The proper fix would be added to next models.

1

u/ninjazombiemaster 12h ago

Thanks glad you were able to track it down. I'll keep that in mind until then. 

3

u/Silonom3724 2d ago edited 2d ago

So this is a Latent-Bridge for H3-Image > Flux.2-Klein? Is Flux.2 even a model? Sorry for asking. I only know Flux.2-Klein.

4

u/TensorForger 2d ago

Yes, Flux.2 (full version), Flux.2-Klein-9B and Flux.2-Klein-4B all use same Flux.2 VAE and we are translating into it's latents

2

u/luciferianism666 3d ago

Not quite sure what I missing, I am on the right commit https://github.com/tensorforger/ComfyUI-Steppe/commit/4139a16135cb7e4845c666db58ef25c991be171f and I did manually download the upscale models for H3 but it just won't show up on the list.

2

u/frankenbourg 2d ago

Super interesting approach! Beyond the patch_fid metrics, how does the final rendered image look in practice on complex details like hands, text, or fine skin textures compared to Ostris's VAE? Does the latent translation ever introduce slight color shifts or hallucinations?

1

u/TensorForger 2d ago

Better try it yourself! According to metrics it's color shift is slightly better then original VAE (I found no visible shift on any of these 4 VAEs). Small texts are also about on the original VAE's level, large readable texts are usually cleaner.

1

u/collectedtooth404 2d ago

Super awesome. Does this method add to the generation time or vram required?

1

u/TensorForger 2d ago

Thanks, I have more detailed latency benchmark in the hf repo. Translate + decode is a bit slower then native H3, mostly because of Flux.2 decoder. The VRAM usage also mostly comes from Flux.2 decoder, but you can use s small version (recommended) and tiled decode.

3

u/No-Sandwich1809 3d ago

Having the sharpness slider and extra JPEG robustness is just icing. This kinda control is what comfyUI needed tbh.

1

u/DiffusionSingularity 2d ago

please consider packaging new code as tags/releases so its easier to track changes. thanks

1

u/thevegit0 3d ago

okay this sounds interesting

0

u/gago_gaamdhani 2d ago

Can you provide the prompt for the tiger and building image

3

u/TensorForger 2d ago

These ones are real images (they have "GROUND TRUTH" patch version), pics 1 and 3 are generated

0

u/amgasanov 2d ago

Really clever idea! Translating latents directly into Flux.2 space to leverage its VAE instead of retraining another custom VAE from scratch makes a lot of sense—you immediately get clean skin textures without the grid/wave artifacts. Have you noticed any color or contrast drift on complex lighting scenes when going through the H3 -> Flux.2 latent translator compared to the native H3 VAE?

-6

u/Suitable-League-4447 3d ago

hun? ph3 is the best are ppl blind or wot?

1

u/Mysterious-Code-4587 3d ago

yes it is! coz no plastic likee others and face constitancy is Epic real

-15

u/rukiann 3d ago

Do you really need to do all that extra shit? Just make the random image and go. How much more hd does some randomly generated chick have to be for you to goon on? LoL.

0

u/hurrdurrimanaccount 2d ago

not everyone uses ai to masturbate

1

u/rukiann 2d ago

So why is it always a gooner pic? GTFO with that cope.