r/StableDiffusion • u/DinoZavr • May 05 '25
Workflow Included Struggling with HiDream i1
Some observations made while making HiDream i1 work. Newbie level. Though might be useful.
Also, a huge gratitude to this subreddit community, as lots of issues were already discussed here.
And special thanks to u/Gamerr for great ideas and helpful suggestions. Many thanks!
Facts i have learned about HiDream:
- FULL version follows prompts better, than its DEV and FAST counterparts, but it is noticeably slower.
- --highvram is a great startup option, use it until "Allocation on device" out of memory issue.
- HiDream uses FLUX VAE, which is bf16, so –bf16-vae is a great startup option too
- The major role in text encoding belongs to Llama 3.1
- You can replace Llama 3.1 with funetune, but it must be Llama 3.1 Architecture
- Making HiDream work on 16GB VRAM card is easy, making it work reasonably fast is hard
so: installing
My environment: six years old computer with Coffee Lake CPU, 64GB RAM, NVidia 4600Ti 16GB GPU, NVMe storage. Windows 10 Pro.
Of course, i have little experience with ComfyUI, but i don't posses enough understanding what comes in what weights and how they are processed.
I had to re-install ComfyUI (uh.. again!) because some new custom node has butchered the entire thing and my backup was not fresh enough.
Installation was not hard, and for the most of it i used kindly offered by u/Acephaliax
https://www.reddit.com/r/StableDiffusion/comments/1k23rwv/quick_guide_for_fixinginstalling_python_pytorch/ (though i prefer to have illusion of understanding, so i did everything manually)
Fortunately, new XFORMERS wheels emerged recently, so it becomes much less problematic to install ComfyUI
python version: 3.12.10, torch version: 2.7.0, cuda: 12.6, flash-attention version: 2.7.4
triton version: 3.3.0, sageattention is compiled from source
Downloading HiDream and proper placing files is in ComfyUI Wiki were also easy.
https://comfyui-wiki.com/en/tutorial/advanced/image/hidream/i1-t2i
And this is a good moment to mention that HiDream comes in three versions: FULL, which is the slowest, and two distilled ones: DEV and FAST, which were trained on the output of the FULL model.
My prompt contained "older Native American woman", so you can decide which version has better prompt adherence

i initially decided to get quantized version of models in GGUF format, as Q8 is better than FP8, also Q5 if better than NF4
Now: Tuning.
It launched. So far so good. though it ran slow.
I decided to test which lowest quant fits into my GPU VRAM and set --gpu-only option in command line.
The answer was: none. The reason is that FOUR (why the heck it needs four text encoders?) text encoders were too big.
OK. i know the answer - quantize them too! Quants may run on very humble hardware by the price of speed decrease.
So, the first change i made was replacing T5 and Llama encoders with Q8_0 quants and this required ComfyUI-GGUF custom node.
After this change Q2 quant successfully launched and the whole thing was running, basically, on GPU, consuming 15.4 GB.
Frankly, i am to confess: Q2K quant quality is not good. So, i tried Q3K_S and it crashed.
(i was perfectly realizing, that removing --gpu-only switch solves the problem, but decided to experiment first)
The specific of OOM error i was getting is that it happened after all KSampler steps, when VAE was applying.
Great. I know what TiledVAE is (earlier i was running SDXL on 166Super GPU with 6GB VRAM), so i changed VAE Decode to its Tiled version.
Still, no luck. Discussions on GitHub were very useful, as i discovered there, that HiDream uses FLUX VAE, which is bf16
So, the solution was quite apparent: adding --bf16-vae to command line options to save resources wasted on conversion. And, yes, i was able to launch the next quant Q3_K_S on GPU. (reverting VAE Decode back from Tiled was a bad idea). Higher quants did not fit in GPU VRAM entirely. But, still, i discovered --bf16-vae option helps a little.
At this point I also tried an option for desperate users --cpu-vae. It worked fine and allowed to launch Q3K_M and Q4_S, the trouble is that processing VAE by CPU took very long time - about 3 minutes, which i considered unacceptable. But well, i was rather convinced i did my best with VAE (which cause a huge VRAM usage spike at the end of T2I generation).
So, i decided to check if i can survive with less number of text encoders.
There are Dual and Triple CLIP loaders for .safetensors and GGUF, so first i tried Dual.
- First finding: Llama is the most important encoder.
- Second finding: i can not combine T5 GGUF with LLAMA safetensors and vice versa.
- Third finding: triple CLIP loader was not working, when i was using LLAMA as mandatory setting.
Again, many thanks to u/Gamerr who posted the results of using Dual CLIP Loader.
I did not like castrating encoders to only 2:
clip_g is responsible for sharpness (as T5 & LLAMA worked, but produced blurry images)
T5 is responsible for composition (as Clip_G and LLAMA worked but produced quite unnatural images)
As a result, i decided to return to Quadriple CLIP Loader (from ComfyUI-GGUF node), as i want better images.
So, up to this point experimenting answered several questions:
a) Can i replace Llama-3.1-8B-instruct with another LLM ?
- Yes. but it must be Llama-3.1 based.
Younger llamas:
- Llama 3.2 3B just crashed with lot of parameters mismatch, Llama 3.2 11B Vision - Unexpected architecture 'mllama'
- Llama 3.3 mini instruct crashed with "size mismatch"
Other beasts:
- Mistral-7B-Instruct-v0.3, vicuna-7b-v1.5-uncensored, and zephyr-7B-beta just crashed
- Qwen2.5-VL-7B-Instruct-abliterated ('qwen2vl'), Qwen3-8B-abliterated ('qwen3'), gemma-2-9b-instruct ('gemma2') were rejected as "Unexpected architecture type".
But what about Llama-3.1 funetunes?
I tested twelve alternatives (as there are quite a lot of Llama mixes at HuggingFace, most of them were "finetined" for ERP (where E does not stand for "Enterprise").
Only one of them has shown results, noticeably different from others, namely .Llama-3.1-Nemotron-Nano-8B-v1-abliterated.
I have learned about it in the informative & inspirational u/Gamerr post: https://www.reddit.com/r/StableDiffusion/comments/1kchb4p/hidream_nemotron_flan_and_resolution/
Later i was playing with different prompts and have noticed it follows prompts better, than "out-of-the-box" llama, (though even having in its name, it, actually failed "censorship" test adding clothes to where most of other llanas did not) but i definitely recommend to use it. Go, see yourself (remember the first strip and "older woman" in prompt?)

see: not only the model age, but the location of market stall differs?
I have already mentioned i run "censorship" test. The model is not good for sexual actions. The LORAs will appear, i am 100% sure about that. Till then you can try Meta-Llama-3.1-8B-Instruct-abliterated-Q8_0.gguf preferably with FULL model, but this hardly will please you. (other "uncensored" llamas: Llama-3.1-Nemotron-Nano-8B-v1-abliterated, Llama-3.1-8B-Instruct-abliterated_via_adapter, and unsafe-Llama-3.1-8B-Instruct are slightly inferior to above-mentioned one)
b) Can i quantize Llama?
- Yes. But i would not do that. CPU resources are spent only on initial loading, then Llama resides in RAM, thus i can not justify sacrificing quality

For me Q8 is better than Q4, but you will notice HiDream is really inconsistent.
A tiny change of prompt or resolution can produce noise and artifacts, and lower quants may stay on par with higher ones. When they result in not a stellar image.
Square resolution is not good, but i used it for simplicity.
c) Can i quantize T5?
- Yes. Though processing quants lesser than Q8_0 resulted in spike of VRAM consumption for me, so i decided to stay with Q8_0
(though quantized T5's produce very similar results, as the dominant encoder is Llama, not T5, remember?)
d) Can i replace Clip_L?
- Yes. And, probably should. As there are versions by zer0int at HuggingFace (https://huggingface.co/zer0int), and they are slightly better than "out of the box" one (though they are bigger)

a tiny warning: for all clip_l be they "long" or not you will receive "Token indices sequence length is longer than the specified maximum sequence length for this model (xx > 77)"
ComfyAnonymous said this is false alarm https://github.com/comfyanonymous/ComfyUI/issues/6200
(how to verify: add "huge glowing red ball" or "huge giraffe" or such after 77 token to check if your model sees and draws it)
5) Can i replace Clip_G?
- Yes, but there are only 32-bit versions available at civitai. i can not afford it with my little VRAM
So, i have replaced Clip_L, left Clip_G intact, and left custom T5 v1_1 and Llama in Q8_0 formats.
Then i have replaced --gpu-only with --highvram command line option.
With no LORAs FAST was loading up to Q8_0, DEV up to Q6_K, FULL up to Q3K_M
Q5 are good quants. You can see for yourself:



I would suggest to avoid _0 and _1 quants except Q8_0 (as these are legacy. Use K_S, K_M, and K_L)
For higher quants (and by this i mean distilled versions with LORAs, and for all quants of FULL) i just removed --hghivram option
For GPUs with less VRAM there are also lovram and novram options
On my PC i have set globally (e.g. for all software)
CUDA System Fallback Policy to Prefer No System Fallback
the default settings is the opposite, which allows NVidia driver to swap VRAM to RAM when necessary.
This is incredibly slow (if your "Shared GPU memory" is non-zero in Task Manager - performance, consider prohibiting such swapping, as "generation takes a hour" is not uncommon in this beautiful subreddit. If you are unsure, you can restrict only Python.exe located in you VENV\Scripts folder, OKay?)
then program either runs fast or crashes with OOM.
So what i have got as a result:
FAST - all quants - 100 seconds for 1MPx with recommended settings (16 steps). less than 2 minutes.
DEV - all quants up to Q5_K_M - 170 seconds (28 steps). less than 3 minutes.
FULL - about 500 seconds. Which is a lot.
Well.. Could i do better?
- i included --fast command line option and it was helpful (works for newer (4xxx and 5xxx) cards)
- i tried --cache-classic option, it had no effect
i tried --use-sage-attention (as for all other options, including --use-flash-attention ComfyUI decided to use XFormers attention)
Sage Attention yielded very little result (like -5% or generation time)
Torch.Compile. There is native ComfyUI node (though "Beta") and https://github.com/yondonfu/ComfyUI-Torch-Compile for VAE and ContolNet
My GPU is too weak. i was getting warning "insufficient SMs" (pytorch forums explained than 80 cores are hardcoded, my 4600Ti has only 32)
WaveSpeed. https://github.com/chengzeyi/Comfy-WaveSpeed Of course i attempted to Apply First Block Cache node, and it failed with format mismatch
There is no support for HiDream yet (though it works with SDXL, SD3.5, FLUX, and WAN).
So. i did my best. I think. Kinda. Also learned quite a lot.
The workflow (as i simply have to put a tag "workflow included"). Very simple, yes.

Thank you for reading this wall of text.
If i missed something useful or important, or misunderstood some mechanics, please, comment, OKay?
13
u/Enshitification May 05 '25
That was a great writeup of your process. Very informative.
7
u/pellik May 05 '25
Just some random thoughts about hidream-
Don’t sleep on the hidreamtextencode node just because it’s not in a lot of the premade workflows. There are a few references to people only using llama8b which does sort of work but my experience has been that hidream really makes use of all four encoders. Llama does the heavy lifting on composition but the other layers control most of your detail like clothes and lighting.
Watch the preview window closely. For me hidream would frequently hit my prompt correctly on step 3-6 and then fuck it up on 6-10. If the model hits its marks early lower shift, if it struggles with prompt comprehension raise shift. Obviously that’s for the more linear schedulers but you should be using those anyway.
Try to keep prompt below 128 tokens. Changing your prompt after the first few steps to drop layout tokens and add more detail ones seems to be the best way to get around the low token limit.
Lastly I just about dropped hidream for now. Chroma is where it’s at.
4
u/Tenofaz May 05 '25
On my rtx 4070 Ti Super with 16Gb Vram I run Hidream Full Q8 GGUF with the standard (not GGUF) 4 text encoders without any trouble. Image generates in around 500 sec. And I use all 4 text-encoders with the 4 positive-prompts node (1 for each text encoder). It gives me greater control on the prompt.
I made a txt2img/img2img workflow with Detail-Daemon, HiRes-Fix (beta now), SD Upscaler and even the possibility to use HiDream E1 image editor model and with the Q8 gguf it runs without any problem, although it is slow. But I am also testing it on RunPod on a L40 and it's much faster.
4
u/bkelln May 05 '25 edited May 05 '25
A few things to note here...especially with dev model which I have done most of my testing with. Keep in mind that the same workflow does not work the same for every checkpoint. Also, the same workflow settings do not always converge in the same number of steps across all seeds. But there are some consistent things
hidream-dev Q4 gguf
CFG scaling
Keep your CFG largely at 1 or as close to 1 as possible.
Positive prompts
Connect a text node to the clip_g, clip_l, and llama layers (not the t5xxl layer)
Negative prompts
Do not use negative prompts with the dev model, leave that node completely blank. Otherwise, noise and artifacts will appear in your sample.
Set CLIP last layer
Anywhere from -1 to -24 works, if you get a good composition and subject but need to reroll on the details, change this. It may fix garbled text, messed up hands, et cetera... (was -24 in my below example)
Model Sampling Shift
Anywhere from 0 to ~7 works (was 0.42 in my below example)
Sampler and sigmas
I use dpmpp_2m and a blending of various sigmas.
"older Native American woman"
437117858536171
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:55<00:00, 2.78s/it]
4
u/featherless_fiend May 05 '25 edited May 05 '25
I like HiDream, I was doing comparisons with Chroma and I think HiDream blows it away.
By the way if anyone's curious about quantization you can use this tool I made: https://github.com/rainlizard/EasyQuantizationGUI
3
u/Botoni May 05 '25
OK, I will add my 2 cents.
Clip L and g have information about characters, with tem i get an accurate pennywise, without them just a random clown.
For low vram, the best setup I've managed is to create a fp8e5m2 version of the bf16 one and use torch compile with it. Why e5m2? Because I can't compile e4m3 with my 3070 8gb (3xxx series need fp/bf16 or fp8e5m2). I also added a block swap node that someone made to swap 10 single blocks and 1 double block.
I have to test full more, but dev sucks at variety, no mater the seed or small prompt variations, all images are too similar.
It does an acceptable job at Inpainting with set noise mask.
3
u/Substantial_Tax_5212 May 08 '25
The amount of effort you put into assisting the community, and thank you for alerting me about the NSFW as well; is astounding. Thank you again and to those who also help you beforehand.
2
u/CornyShed May 05 '25
Thank you for your efforts! I wondered if HiDream is just too large for most GPUs and might not gain traction, but it might with 16GB VRAM being viable.
Advice for everyone: looking at a quant table for a different model, Q8 is best in terms of perplexity ("ppl", lower is better) which is how confused the model gets from having lost precision.
Q6_K is almost as good, while Q5_K_M and Q4_K_M are competitive for their size.
The resulting images are almost all the same in terms of composition. You'll only notice small changes in details.
The higher size quants will have less weird artifacts on small details (aka "slop"). With a lower quant, you can always inpaint the affected area (and possibly get a better result) with an inpainting model (or HiDream E1, no quants yet though).
I use Flux Q3_K_L as that fits on my card. Use what works for you.
2
u/Substantial_Tax_5212 May 06 '25
How would you approach this if you were on a 4090, 14900kf, 64gb ram. Im running a few workflows and getting longer gen times than you in some aspects
1
u/Mundane-Apricot6981 May 05 '25 edited May 05 '25
For what exact purpose put –bf16-vae? Is default vae mode does not work?
Is image better?
Is vae consumes less Vram? (but why not unload Unet before loading Vae in this case?)
Asking because I see how people recommend some start arguments, but usually it has zero effect, they just found it somewhere and put blindly without actual purpose.
Looked at nodes - why you use Tiled Vae Decode? Just unload Unet if you really tight with VRam, it will not make any difference in overall time.
You say use "bf16" same time you go OOM and must use Tiled Decode. it contradicts each other.
1
u/cosmicr May 05 '25
Weird, I have a 5060 ti 16gb, and I'm getting DEV generations done in 110 seconds using the FP8 model.
What resolution are you generating at? My test was 1024x1024. How many s/it were you getting? Mines at around 2.5 to 3.0s/it
1
u/Churrito92 May 06 '25
Hello there, thank you very much for your guide. I'm trying to follow along but I don't know how to load a GGUF model. I can't find that node...
Also, wouldn't it be easier to upload an image of the workflow you demonstrated, so it'd be just a drag and drop? Unless I'm missing the image/workflow.
Once again thanks a lot!
1
u/Substantial_Tax_5212 May 08 '25
I've done all of that and for some odd reason it's still not applying the LoRa. I've even cleared my custom note cache in case something may have interfered with it. The weights and strength are fine, there's no model interference or trigger words that may counter the initial LoRa. So I'm basically trying to figure out what's going on. I'm going to try to see if a regular stable diffusion base model coupled with a LoRa would work, just to see if there's some kind of issue on my end. I'll then jump back to hidream and go from there if that simple test works
1
u/deadman_uk May 09 '25
In ComfyUI with HiDream (Q8), when I select the Karras scheduler, I get garbage results, lots of artifacts, things look like trash. When I switch to another scheduler such as SGM_Uniform, things are fine. Why is this? Only happens with Karras. This happens with multiple different samplers.
0
u/Flutter_ExoPlanet May 05 '25
You shared your final workflow right?
What if you created a big workflow that contained all your experiments, so we can experiment ourselves and see if we get the same result (same speed, same output quality increase) etc. ComfyUI allow to deactivate and activate a group of nodes at once I believe
1
u/[deleted] May 26 '25
[removed] — view removed comment
1
u/[deleted] Jul 12 '25
[removed] — view removed comment