Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow me to preface: I don't know a thing about PyTorch, Diffusion, Arrays, Tensors, or any of this nonsense. I'm just a girl who wants to mask and tile. 😷
First problem. In
slice_cond
the branches that handle areas expect cond to be a tuple. cond is not a tuple. Removed the indexing which clears the error in #36Second problem, the tensor is not the size the sampler expects it to be later on in the process. I did a lots of debugger and eventually glazed that mask tensors are 3-dimensional with no color information, while other tensors are 4-dimensional. But some functions here are turning a nice mask tensor into a full-color tensor.
See,
comfy.sample.prepare_mask
fluffs up the tensor from a typical mask tensor ofmask X x-pos X y-pos
to amask X rgba X x-pos X y-pos
size. Not a problem for a while until it is.So I lifted that function and did a little squeeze to remove the baby dimension that gets injected when the reshape interpolates the tensor into the size which
interpolate
can handle (for whatever reason it requires a 4-dimensional array or it dies (pytorch is a dumpster fire of raccoons who are also on fire)).Is this correct? I don't know. Is it right? Who knows. Does it stop the crashes when your condies have maskeys? Yes. It stops those.
Someone with maths please just take this PR and make it beautiful. And write some tests.
Also I don't know squat about Python.