Skip to content

Fix batch handling, attempt to deal with non-4 dimensional latents - #6

Merged
Extraltodeus merged 1 commit into
Extraltodeus:mainfrom
blepping:fix_batch_handling
Jun 16, 2025
Merged

Fix batch handling, attempt to deal with non-4 dimensional latents#6
Extraltodeus merged 1 commit into
Extraltodeus:mainfrom
blepping:fix_batch_handling

Conversation

@blepping

Copy link
Copy Markdown
Contributor

As noted in #5, DistanceSampler currently fails on batches. This pull implements the simplest/dumbest solution: we just cram the batch (and any extra dimensions) into the channel dimension. I don't know if this is a correct solution, but it does seem to work and produce reasonable results. These changes also fix DistanceSampler for non-4 dimensional (3+) dimensions. For example, video models like Wan use 5 dimensional latents. Theoretically these changes would also work with 3 dimensional latents but I don't know of any 1D VAE models to test with at the moment. I did test with Wan and it works, even with batches of video latents.

Should close #5


Not sure if you're interested but I can also submit a pull that allows setting the various DistanceSampler options in the node rather than having to configure them by preset:

image

Would also be pretty easy to add ancestral sampling support. Let me know if you'd accept a pull adding that kind of stuff!

@Extraltodeus
Extraltodeus merged commit ece7be1 into Extraltodeus:main Jun 16, 2025
@Extraltodeus

Copy link
Copy Markdown
Owner

Oh wow! Thank you!!

@Extraltodeus

Extraltodeus commented Jun 16, 2025

Copy link
Copy Markdown
Owner

I'd be curious on how to implement and ancestral version BTW!

I only gave this a weak try and got more noise at the end 😅

@blepping

Copy link
Copy Markdown
Contributor Author

I'd be curious on how to implement and ancestral version BTW!

I've actually had a working version (though based on an older version of Distance) in my Overly Complicated Sampling node pack for a while now: https://github.com/blepping/comfyui_overly_complicated_sampling/blob/heun_experiments/py/step_samplers/extraltodeus.py

I created a pull that adds ancestral support over in #7.

@Extraltodeus

Copy link
Copy Markdown
Owner

Well it's impressive! Thank you very much! :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ValueError: too many values to unpack (expected 5)

2 participants