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

txt2mask script is now available #636

Closed
ThereforeGames opened this issue Sep 17, 2022 · 5 comments
Closed

txt2mask script is now available #636

ThereforeGames opened this issue Sep 17, 2022 · 5 comments
Labels
enhancement New feature or request

Comments

@ThereforeGames
Copy link
Contributor

Hi, I wrote another script for your UI! It allows the user to create a mask for the image using natural language, instead of having to use the brush tool. More info here: https://github.com/ThereforeGames/txt2mask

Would you mind adding it to the wiki when you have a chance? I was checking to see if I could edit the wiki page myself but couldn't see a way of doing so - apologies if I'm overlooking something obvious there.

Thanks!

@PhreakHeaven
Copy link

PhreakHeaven commented Sep 18, 2022

@ThereforeGames

Hi, I wrote another script for your UI! It allows the user to create a mask for the image using natural language, instead of having to use the brush tool. More info here: https://github.com/ThereforeGames/txt2mask

Would you mind adding it to the wiki when you have a chance? I was checking to see if I could edit the wiki page myself but couldn't see a way of doing so - apologies if I'm overlooking something obvious there.

Thanks!

AHHH!

Pickle problems after hitting 'Generate'.

Traceback (most recent call last):
File "G:\StableDiffVoldy\stable-diffusion-webui\modules\ui.py", line 126, in f
res = list(func(*args, **kwargs))
File "G:\StableDiffVoldy\stable-diffusion-webui\webui.py", line 55, in f
res = func(*args, **kwargs)
File "G:\StableDiffVoldy\stable-diffusion-webui\modules\img2img.py", line 131, in img2img
processed = modules.scripts.scripts_img2img.run(p, *args)
File "G:\StableDiffVoldy\stable-diffusion-webui\modules\scripts.py", line 140, in run
processed = script.run(p, *script_args)
File "G:\StableDiffVoldy\stable-diffusion-webui\scripts\txt2mask.py", line 86, in run
p.image_mask = get_mask()
File "G:\StableDiffVoldy\stable-diffusion-webui\scripts\txt2mask.py", line 46, in get_mask
model.load_state_dict(torch.load('./repositories/clipseg/weights/rd64-uni.pth', map_location=torch.device('cuda')), strict=False);
File "G:\StableDiffVoldy\stable-diffusion-webui\venv\lib\site-packages\torch\serialization.py", line 713, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "G:\StableDiffVoldy\stable-diffusion-webui\venv\lib\site-packages\torch\serialization.py", line 920, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, 'v'.

@PhreakHeaven
Copy link

PhreakHeaven commented Sep 18, 2022

@ThereforeGames

Hmm, so I found people with the same issue, but for other repos (not even related to SD, but utilizing the pickles) and it seems this occurrence tends to be related to downloading/extracting the .zip, rather than cloning the repo. I deleted all of the extracted files and performed a "git clone https://github.com/ThereforeGames/txt2mask" and that eliminated the error. The script was unsuccessful at changing hair color (my first attempt), though :-P, which I expected.

I DID have to cut/paste the files/directories from the cloned dir (txt2mask) into the root dir of the WebUI project to get everything to go where necessary, in case anyone has problems after clone.

@ThereforeGames
Copy link
Contributor Author

Hmm, so I found people with the same issue, but for other repos (not even related to SD, but utilizing the pickles) and it seems this occurrence tends to be related to downloading/extracting the .zip, rather than cloning the repo.

That's interesting, thanks for sharing a workaround - I'll have to do more research into this issue and see if there's a proper fix.

@ThereforeGames
Copy link
Contributor Author

Okay, I updated the repo with a possible fix - it turns out that Github doesn't like serving these model files for some reason (if you check repositories\clipseg\weights you might find that they're only 1kb each) so instead I'm having the script fetch the files at runtime.

You may need to delete the broken weights first and re-run the web UI to download the proper files.

Hope that helps!

@JashoBell
Copy link
Collaborator

Hi, I wrote another script for your UI! It allows the user to create a mask for the image using natural language, instead of having to use the brush tool. More info here: https://github.com/ThereforeGames/txt2mask

Would you mind adding it to the wiki when you have a chance? I was checking to see if I could edit the wiki page myself but couldn't see a way of doing so - apologies if I'm overlooking something obvious there.

Thanks!

Added to the wiki. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants