Skip to content

✨initial implementation for Mask region selection. #23

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

ashen-sensored
Copy link

Dirty initial implementation.
image

@ashen-sensored ashen-sensored force-pushed the feature/mask_selection branch from 693f630 to d766dd4 Compare March 3, 2023 15:26
@ashen-sensored ashen-sensored force-pushed the feature/mask_selection branch from d766dd4 to 5eda734 Compare March 3, 2023 15:28
@catboxanon catboxanon mentioned this pull request Mar 3, 2023
@ashen-sensored ashen-sensored force-pushed the feature/mask_selection branch from 8207b2a to 6d295b9 Compare March 3, 2023 22:59
@ashen-sensored ashen-sensored force-pushed the feature/mask_selection branch from 6d295b9 to 03bf2ae Compare March 3, 2023 23:59
@BlueAccords
Copy link

Is it possible for this to use a different lora per masked area? or do we still need to to combine this implementation with https://github.com/opparco/stable-diffusion-webui-composable-lora ?

@ashen-sensored
Copy link
Author

Is it possible for this to use a different lora per masked area? or do we still need to to combine this implementation with https://github.com/opparco/stable-diffusion-webui-composable-lora ?

The feature I implemented has no conflict with the extension you mentioned. In fact it is functional at current state of this branch.

@OedoSoldier
Copy link

I've got this:

ImportError: cannot import name 'on_after_ui' from 'modules.script_callbacks'

@ashen-sensored
Copy link
Author

I've got this:

ImportError: cannot import name 'on_after_ui' from 'modules.script_callbacks'

Take a look at README,
run git apply --ignore-whitespace extensions/stable-diffusion-webui-two-shot/cfg_denoised_callback-ea9bd9fc.patch in your automatic webui folder.

@ashen-sensored
Copy link
Author

ashen-sensored commented Mar 4, 2023

Is it possible for this to use a different lora per masked area? or do we still need to to combine this implementation with https://github.com/opparco/stable-diffusion-webui-composable-lora ?

Here's a demo of composable lora working, you use the same syntax as webui's built-in Lora extension.
Screenshot from 2023-03-04 05-10-33
00109-2904427694

@sergiogonzalezch
Copy link

how i can install the extension on colab?

@sra-tatata
Copy link

Issues - The extension's mask color sketching function does not work well with chrome(extreme stuttering) due to gradio's Image component bug, firefox is recommended.

Painting doesn't work on any browser - it's not gradio's fault since it works on controlnet
After loading the png file, painting is already working. So it's not graudio's or browser's fault

@catboxanon
Copy link

Any reason to not open a PR in the webui repo for the callback patch included? This is getting shared around a lot with many not realizing it will not work out of the box.

@remixer-dec
Copy link

Issues - The extension's mask color sketching function does not work well with chrome(extreme stuttering) due to gradio's Image component bug, firefox is recommended.

Tried in Chromium - crash
Tried in Firefox (110.0.1) - crash
Tried in Safari - no crash, but 0.01FPS, unusable
gradio==3.16.2

@djkacevedo
Copy link

djkacevedo commented Mar 5, 2023

The mask window stutters and breaks for me. I tried in both chrome and firefox. No errors are thrown. Here's what it does in firefox. This is on a fresh install of the webui with only this feature and the patch installed on it.

latent-couple-mask-break

@quixot1c
Copy link

quixot1c commented Mar 5, 2023

The mask window stutters and breaks for me. I tried in both chrome and firefox. No errors are thrown. Here's what it does in firefox. This is on a fresh install of the webui with only this feature and the patch installed on it.

I have the exact same thing on Firefox with the Sketch tab in A1111, so it does seem Gradio related. It is fixed when I load in an image from disk (in the case of the sketch tool, I have not tried this extension yet).

@ashen-sensored
Copy link
Author

ashen-sensored commented Mar 6, 2023

Bug related to gradio Image component(the stuttering) has been fixed.
Since gradio is not maintaining downstream bugfix branches, and currently webui has a version pin of 3.16.2, I'll distribute my fixed wheel for gradio.

For end users, please refer to the prerequisite section of README for instructions.

Bugfix related modifications:
https://github.com/ashen-sensored/gradio/tree/3.16.2

@ashen-sensored ashen-sensored force-pushed the feature/mask_selection branch from fd0c1b4 to c113858 Compare March 6, 2023 03:27
@ashen-sensored ashen-sensored force-pushed the feature/mask_selection branch from c113858 to 1dfc95f Compare March 6, 2023 03:55
@sra-tatata
Copy link

Bugfix related modifications:
https://github.com/ashen-sensored/gradio/tree/3.16.2

The bugfix didn't change anything - it's still as it was - you can't create a drawing canvas but you can load a graphic file and draw on it.

@ashen-sensored
Copy link
Author

ashen-sensored commented Mar 6, 2023

The bugfix didn't change anything - it's still as it was - you can't create a drawing canvas but you can load a graphic file and draw on it.

Did you pull my latest commit and run pip install --force-reinstall --no-deps gradio-3.16.2-py3-none-any.whl in the folder?
Also, don't forget to do a hard reload in your browser after installing the fix.

image

@navvac
Copy link

navvac commented Mar 6, 2023

Bugfix related modifications:
https://github.com/ashen-sensored/gradio/tree/3.16.2

The bugfix didn't change anything - it's still as it was - you can't create a drawing canvas but you can load a graphic file and draw on it.

Dude, it worked perfectly for me. You basically just have to install the file gradio-3.16.2-py3-none-any.whl

@sra-tatata
Copy link

Did you pull my latest commit and run pip install --force-reinstall --no-deps gradio-3.16.2-py3-none-any.whl in the folder?
Also, don't forget to do a hard reload in your browser after installing the fix.

Yes also on fresh install

@ashen-sensored
Copy link
Author

Did you pull my latest commit and run pip install --force-reinstall --no-deps gradio-3.16.2-py3-none-any.whl in the folder?
Also, don't forget to do a hard reload in your browser after installing the fix.

Yes also on fresh install

Is there any error message in your console after the stuttering crashes the canvas?

@sra-tatata
Copy link

https://youtu.be/ybFyIaA9EQo

There are no errors displayed in the console. Only when trying "I've finished my sketch" and updating. Drawing at the beginning lags a lot and later it is not possible - the cursor disappears after hovering over the canvas. Drawing on the loaded image is possible.

@ashen-sensored
Copy link
Author

ashen-sensored commented Mar 6, 2023

https://youtu.be/ybFyIaA9EQo

There are no errors displayed in the console. Only when trying "I've finished my sketch" and updating. Drawing at the beginning lags a lot and later it is not possible - the cursor disappears after hovering over the canvas. Drawing on the loaded image is possible.

The official implementation of webui.sh created a venv, but you're not using it.
Activate it first by source venv/bin/activate, then run pip install --force-reinstall --no-deps gradio-3.16.2-py3-none-any.whl in extensions/stable-diffusion-webui-two-shot directory again.

@sra-tatata
Copy link

The official implementation of webui.sh created a venv, but you're not using it.
Activate it first by source venv/bin/activate, then run pip install --force-reinstall --no-deps gradio-3.16.2-py3-none-any.whl in extensions/stable-diffusion-webui-two-shot directory again.

Yes you are right
Now it is working. Thank you

@QR-0W
Copy link

QR-0W commented Mar 9, 2023

是否可以在每个遮罩区域使用不同的劳拉? 或者我们是否仍然需要将这个实现与 https://github.com/opparco/stable-diffusion-webui-composable-lora 结合起来?

这是可组合 lora 工作的演示,您使用与 webui 的内置 Lora 扩展相同的语法。 截图自2023-03-04 05-10-33 00109-2904427694

yeah, I tried to use the same prompt but replaced the Lora you uesd in this example with some other Lora I got from civitai. Sadly it didn't works. Could you give me some help?
图片

@guzuligo
Copy link

guzuligo commented Mar 9, 2023

It would be great if this could also generate ControlNet segmentation mask.
A class dropdown under each prompt.

@Padusarbor
Copy link

是否可以在每个遮罩区域使用不同的劳拉? 或者我们是否仍然需要将这个实现与 https://github.com/opparco/stable-diffusion-webui-composable-lora 结合起来?

这是可组合 lora 工作的演示,您使用与 webui 的内置 Lora 扩展相同的语法。 截图自2023-03-04 05-10-33 00109-2904427694

yeah, I tried to use the same prompt but replaced the Lora you uesd in this example with some other Lora I got from civitai. Sadly it didn't works. Could you give me some help? 图片

Did you use one lora twice? opparco/stable-diffusion-webui-composable-lora#7 It seems okay when I use different loras but when I duplicate them, the image becomes corrupted.

@QR-0W
Copy link

QR-0W commented Mar 9, 2023

是否可以在每个遮罩区域使用不同的劳拉? 或者我们是否仍然需要将这个实现与 https://github.com/opparco/stable-diffusion-webui-composable-lora 结合起来?

这是可组合 lora 工作的演示,您使用与 webui 的内置 Lora 扩展相同的语法。 截图自2023-03-04 05-10-33 00109-2904427694

yeah, I tried to use the same prompt but replaced the Lora you uesd in this example with some other Lora I got from civitai. Sadly it didn't works. Could you give me some help? 图片

Did you use one lora twice? opparco/stable-diffusion-webui-composable-lora#7 It seems okay when I use different loras but when I duplicate them, the image becomes corrupted.

I'm sure I'm not using duplicate LORA when I generate this image, but I used 3 LORAs and 1 LoCon.
I'm not sure whether multiple LORAs' weight added together caused this result, or just simply one or some of my used LORAs are overfitting as overfitting LORA would also cause image corruption.

@richadlee
Copy link

Can you add a feature to save a masked image area?
Sometimes I draw a masked area with a very good effect and would like to save it for future use.
Alternatively, you could add an option for masked area templates, where saved masked areas can be stored, and a button to send the template to the plugin.

@G-force78
Copy link

I've got this:
ImportError: cannot import name 'on_after_ui' from 'modules.script_callbacks'

Take a look at README, run git apply --ignore-whitespace extensions/stable-diffusion-webui-two-shot/cfg_denoised_callback-ea9bd9fc.patch in your automatic webui folder.

How and when would I do this when using a collab notebook?

@G-force78
Copy link

The bugfix didn't change anything - it's still as it was - you can't create a drawing canvas but you can load a graphic file and draw on it.

Did you pull my latest commit and run pip install --force-reinstall --no-deps gradio-3.16.2-py3-none-any.whl in the folder? Also, don't forget to do a hard reload in your browser after installing the fix.

image

I now cant get a share link to launch WebUI.

@sliptrick
Copy link

the style sheet included causes subfolders in the extra-networks area to be placed inconveniently to the center-left of the network-cards.
changing
display: flex
to
display: start
fixes the issue and didn't seem to affect this extension from working

@estilog
Copy link

estilog commented Mar 14, 2023

https://youtu.be/ybFyIaA9EQo
There are no errors displayed in the console. Only when trying "I've finished my sketch" and updating. Drawing at the beginning lags a lot and later it is not possible - the cursor disappears after hovering over the canvas. Drawing on the loaded image is possible.

The official implementation of webui.sh created a venv, but you're not using it. Activate it first by source venv/bin/activate, then run pip install --force-reinstall --no-deps gradio-3.16.2-py3-none-any.whl in extensions/stable-diffusion-webui-two-shot directory again.

Tried all the suggestions and the UI is still stuttering and unusable. Windows 11 with latest updates of everything. RTX 3090.

@enternalsaga
Copy link

style

this!!! thank you, I got that issue and could not find the culprit.

@sliptrick
Copy link

style

this!!! thank you, I got that issue and could not find the culprit.

Just remember to change it again when you update the extension, lol

@kimahana12312
Copy link

kimahana12312 commented Mar 19, 2023

I doesn't know programming...
How should I install this?

@nistvan86
Copy link

nistvan86 commented Mar 30, 2023

What is blocking this to be merged into the main branch?
Also I can't seem to be able to contact @ashen-sensored anywhere, so I'll give it a go here.
So is there any limitation how many colors a mask can contain? I've created a mask with a bunch of colors and it can't render the prompt list, so I assume I must have reached some kind of limit.

@HeavyTony2
Copy link

@ashen-sensored The "Extra generation params" don't work as supposed. Generated images with your fork don't have the latent couple metadata.

@G-force78
Copy link

sketch window always freezes for me after making the blob masks, could be firefox I dont know.

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.