feat: Support NVIDIA PixelDiT and PiD (CORE-201) - #14103
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThis pull request adds PixelDiT, a pixel-space multimodal diffusion model, and PiD, a pixel-diffusion decoder variant, to ComfyUI. The implementation includes new pixel- and patch-level transformer modules, a Gemma2-2B-based text encoder/tokenizer, PiD low-quality latent injection and gating, updates to model detection/registration, model wrappers, and a ComfyUI node for PiD conditioning. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi, quick question about NVIDIA licensing.
I didn’t find the restrictive clause (“may not be distributed, deployed…”) on the HF page or in the LICENSE file. Since NVIDIA sometimes applies multiple overlapping licenses to their research models, could you clarify whether we should always assume the more restrictive NVIDIA Research license applies, even when the HuggingFace page only shows NSCLv1? Just trying to understand the policy you follow for ComfyUI integration. Thanks. |
|
Really want to try PiD, but I can't get access to the TE model yet. |
It's two different repos, the new PiD model uses the PixelDiT as base, this PR implements both. PixelDiT license: https://huggingface.co/nvidia/PixelDiT-1300M-1024px/blob/main/LICENSE So okay to repackage and share when license is included.
Edit: They have now changed the license to match PixelDiT: https://huggingface.co/nvidia/PiD/commit/b87dba45e5a2b2a18bac9515fca883f52b957558 |
I've made the repo public now: https://huggingface.co/Comfy-Org/PixelDiT |
Thank you! Just tested it, but I'm still a bit confused. Is PiD sensitive to the dimensions/image size? I tried with a vertical image, the source is 1088×1440. Then I downscaled it by 0.5 using the After that, I used another Image Resize node and set it to 2048×2048 with the method set to
If I increase it to something like 2880×2880, the image looks fine.
I also noticed it always adds a green color at the bottom part of image, even though I'm not seeing that in your example results?
|
|
I added better explanation for the different models, it's important to choose the correct one closest to your resolution, their naming is a bit confusing. |
Input image is too large maybe? That selected model works with 512x512 inputs. Also make sure to use the ELM variant of the Gemma2... at least with the PixelDit T2I the standard Gemma2 gives broken outputs. |
|
I have used the same workflow - [z_image_turbo_to_pid_02.json] but kept returning with error on the incorrect dimensions, e.g. Even after the PID conditioning, it does not work. Not sure what ight be the exact issue, thanks |
Z-image uses flux1 VAE, do you have that selected in the conditioning node? |
Thank you for the prompt reply. Yes, Flux1 VAE is selected in the conditioning node (latent_format = flux1) and the PID model itself being flux1 (e.g. [PiD_res2kto4k_sr4x_official_flux_distill_4step]) but same issue; perhaps I'll reinstall ComfyUI for a re-test thanks! |
|
Heads' up for anyone following along: the |
Yes, sorry for not mentioning that here, for the actually merged version it's just "flux" and "sd3" currently since it's easy to autodetect flux2, this makes the node automatic for anything but sd3. |
|
Thanks @kijai - I believe the attached JSON workflows from first post still use the old values. |
|
Hi @kijai . Why PiD for flux2, will make the picture turn whitish? I use ERNIE-Image to generate the origin picture |
It's just how the model is, I don't know why, could be the distillation (undistilled models are not released yet) or just their training in general.. all their examples are bright scenes too. The ComfyUI implementation matches what I get from their code:
|
|
What would have the most "real" details, generating at 1536x1536 natively, or using PiD to get from 1024x1024 to 4096x4096 ? |
I suppose it depends on the model, but probably the best use is to generate at given models native resolution, ending it early and passing the latent with the noise to PiD, then using the degrade_sigma to finish and decode the image. I don't know the optimal workflow for this yet, but seems to work great with Z-image at least. |
|
Hey guys, we have a new checkpoint for Thanks for merging PiD to ComfyUI!! |
|
Is this available in Comfyui studio? |
|
Hey guys! Is there a working method for Flux 2 yet? |
In VAE Decode after SamplerCustom you use pixel_space, not FLAX1, FLAX2 VAE |
|
|
|
I get the output image, but it is pretty much the same as the input. I tried upscaling a 1024x1024 image using pid_flux1_1024_to_4096_4step_bf16.safetensors, but got this error: [INFO] got prompt |
|
Perhaps I'm doing something wrong, but the output is not as good as expected?
Note that I resized the input to 1024x1024 for processing, and just resized it back to the original input size for comparison. Using the workflow here: #14103 (comment) with flux1 upscaling from 1024 to 4096 |
Use git and the And since you're using Desktop, wait a few extra days for it to catch up. |
|
Hi @kijai, We name the new flux2 checkpoint with
|
You are very likely downloaded the flux.2 diffusion model instead of flux.1. so make sure it starts with "pid_flux1...", not "pid_flux_2..." |
This comment was marked as resolved.
This comment was marked as resolved.
|
does anybody has the workflow for FLUX2 ? |
|
Is there no way to use this with a Load Image first node and not generate t2i first, just to upscale? Great work as usual @kijai |
|
There is, this just works on an empty chromaradiance latent, and the conditioning node uses a latent as input. So, you can build it up 'just to upscale' quite like a normal img2img worfklow. Note that there are different models for flux1 input latent (and zimage/zimageturbo input latent), flux2 input latent, sd3.5 input latent.. (and sdxl and qwen coming or already there?). And there are models made for 512 -> 2048 upscaling, and 1024 -> 4096 upscaling. If you go stray from those, your results may vary (but can also work ok). for instance, using the flux1 model, 512 to 2048 version:
Seems to work better on an ultra clean output of a diffusion model than a real image though. for flux2, just use a flux2 latent as input. PidConditioning set to flux-mode will autodetect which to use. Most people getting size mismatches from 16 -> 128 or something similar, are either loading the wrong Pid-model for their input latent, or are trying to vae-decode the Pid output with a real vae, instead of picking 'pixel_space'. |
















Adds support for Nvidia PixelDiT T2I image model, as well as the new PiD models.
Models (nsclv1 license):
https://huggingface.co/Comfy-Org/PixelDiT
PixelDiT text to image
pixeldit_test_01.json

PiD
Encode - decode example:
pid_512-2048_flux1_upscale_example_02.json
Z-image to 4096 example:
z_image_turbo_to_pid_03.json
