Comfy-Org / Comfy-Org/ComfyUI

ComfyUI loads NetaAniLumina as fp32 by default, doing --force-fp16 renders the output as a black image

Open
#8,528 3 comments 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Custom Node Testing

- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)

### Expected Behavior

I'm trying to generate an image with Neta Lumina, a Lumina Image 2.0 finetuned model on Google Colab. It should work better than SDXL

### Actual Behavior

But the moment it loads the model the cpu ram went to exceed itself, and gave me C^. I noticed the dtype in the output lines were fp32.

![Image](https://github.com/user-attachments/assets/9f15b209-b0bd-43b8-b62f-8ea8e0559613)

Then so I tried to use the `--force-fp16` arg. After that it does load nicely, having it so close to the ram limit before it eventually loaded with draining its usage. However, after waiting for it's gen time, my output was just a black image? I see a way to solve this by the `--force-upcast-attention` arg, but that didn't change anything..

There wasn't any error/warning in the logs, but from the previous notebook I used, I only got this by `--force-fp16` (keep in mind that I'm using the new notebook)
```
/content/ComfyUI/nodes.py:1585: RuntimeWarning: invalid value encountered in cast
img = Image.fromarray(np.clip(i, 0, 255).astype(np.uint8))
```

### Steps to Reproduce

I forgot to save the workflow, but I still could describe how to make it work
Unfortunately the repo for the models I used were unaccessible unless you got accepted by the uploader. That one only got me C^. You can go to [https://huggingface.co/neta-art/NetaAniLumina_Alpha/tree/main](https://huggingface.co/neta-art/NetaAniLumina_Alpha/tree/main) and vouch for request. There is a Discord server if you want to make the access faster, but I'm not sure if I should send it here. From now on, I'll use the older version of NetaAni Lumina I2. This one I can run on fp32 but takes 5 minutes to gen.

1. Use [gutris/segsmaker](https://colab.research.google.com/github/gutris1/segsmaker/blob/main/notebook/Segsmaker_COLAB.ipynb) colab notebook
2. Install the required models, which are [NetaAniLumina](https://civitai.com/models/1612109/nietaaniluminaalpha?modelVersionId=1824406), [Flux Vae](https://huggingface.co/black-forest-labs/FLUX.1-dev/resolve/main/vae/diffusion_pytorch_model.safetensors), and [google/gemma-2-2b](https://huggingface.co/google/gemma-2-2b/tree/main)
3. Use the [ComfyUI's workflow for Lumina Image 2](https://comfyanonymous.github.io/ComfyUI_examples/lumina2/)
4. Just change the model slot, then on `got prompt` it should just load the gemma and vae from itself (I think? If vae was missing, just add load vae and use flux vae in it).. The Neta Lumina model itself however, loads as fp32 by default. You should still get the result image as normal but it takes a horrendeus 5 minutes!!

Do the same starting on step 3 with `--force-fp16` arg (and with `--force-upcast-attention` as a bonus). You will get a black image as a result, but just the gen time was a minute.

### Debug Logs

```powershell
//note that this is on the segsmaker notebook
got prompt
Using xformers attention in VAE
Using xformers attention in VAE
VAE load device: cuda:0, offload device: cpu, dtype: torch.float32
Requested to load LuminaTEModel_
loaded completely 9.5367431640625e+25 4986.46142578125 True
CLIP/text encoder model load device: cuda:0, offload device: cpu, current: cuda:0, dtype: torch.float16
FETCH ComfyRegistry Data: 85/88
FETCH ComfyRegistry Data [DONE]
[ComfyUI-Manager] default cache updated: https://api.comfy.org/nodes
FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json [DONE]
[ComfyUI-Manager] All startup tasks have been completed.
Warning, This is not a checkpoint file, trying to load it as a diffusion model only.
model weight dtype torch.float16, manual cast: None
model_type FLOW
WARNING: No VAE weights detected, VAE not initalized.
Requested to load Lumina2
loaded completely 8732.338471221923 4977.7440185546875 True
100% 25/25 [00:59<00:00, 2.37s/it]
Requested to load AutoencodingEngine
loaded completely 392.0347557067871 319.7467155456543 True
Prompt executed in 118.60 seconds
```

### Other

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.