Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not assume images in postprocess_batch is a tensor #1817

Merged
merged 2 commits into from
Jul 23, 2023

Conversation

ljleb
Copy link
Collaborator

@ljleb ljleb commented Jul 23, 2023

In sd-webui-comfyui we need images to be a list, so that each image in the list can have an arbitrary size, and so that the list size can change arbitrarily. It seems that len(tensor) is defined and equivalent to tensor.shape[0].

See AUTOMATIC1111/stable-diffusion-webui#11933 for details.

@ljleb ljleb changed the title fix: do not assume images in postprocess_batch is a list fix: do not assume images in postprocess_batch is a tensor Jul 23, 2023
@ljleb
Copy link
Collaborator Author

ljleb commented Jul 23, 2023

It seems that len(tensor) has been a thing for a long time:

https://github.com/pytorch/pytorch/blame/e3539a0e5497677a0f7ef29dc8278d249bbccb43/torch/_tensor.py#L907

This should then work no matter which version of torch is installed.

@huchenlei huchenlei self-requested a review July 23, 2023 18:13
Copy link
Collaborator

@huchenlei huchenlei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@huchenlei huchenlei merged commit e9679f8 into Mikubill:main Jul 23, 2023
1 check passed
@ljleb ljleb deleted the postprocess-fix branch July 23, 2023 21:11
@ljleb
Copy link
Collaborator Author

ljleb commented Jul 23, 2023

Thanks for the review! I wasn't sure if it was okay to merge for my own purposes 😅

@huchenlei
Copy link
Collaborator

Np. The PR passes web tests so I am confident that it does not break anything major. Also, can you take a look at #1802? I am not very familiar with ADetailer, but from the source code ADetailer is not trying to import anything directly from ControlNet. Why the behaviour changes after reload got removed?

@ljleb
Copy link
Collaborator Author

ljleb commented Jul 24, 2023

Sure I'll look into it.

tiangles pushed a commit to diffus-me/sd-webui-controlnet that referenced this pull request Aug 18, 2023
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.

2 participants