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

Use UNet precision, add --upcast-sampling support #143

Merged
merged 1 commit into from
Feb 17, 2023

Conversation

brkirch
Copy link
Contributor

@brkirch brkirch commented Feb 17, 2023

This will fix Macs needing --no-half (by adding dtype casting for --upcast-sampling) but also has a significant change - currently the ControlNet models appear to be loaded with full precision by default, this PR changes the precision to match the UNet precision of the loaded model in web UI. Unless there is something I'm missing, this change should significantly reduce VRAM usage for all users that aren't using --no-half.

Fixes #87, fixes #68.

@Mikubill
Copy link
Owner

Looks good. Will do some test later

@Mikubill
Copy link
Owner

Confirm works on M1 Pro and M1. But the result is weird: Looks like something was upscaled inproperly

@jwooldridge234
Copy link

Just tested on MacOs M1 Pro, can't see any issues and it runs super smooth now. Thanks for the hard work on this!

@Mikubill
Copy link
Owner

Hmm.. any screenshots? Maybe I misconfigured something on my MacBook.

@jwooldridge234
Copy link

Sure!

I'm only using Scribble at the moment and I always use the preprocessor bc I've found it steers the final image better.
image
image

Here's without the preprocessor:

image

@jwooldridge234
Copy link

Haven't tested the other models yet, maybe there's issues with those.

@Mikubill
Copy link
Owner

Looks nice. Note that MPS support is experimental, feel free to open issue if you have any questions.

@Mikubill Mikubill merged commit ca279df into Mikubill:main Feb 17, 2023
@brkirch
Copy link
Contributor Author

brkirch commented Feb 17, 2023

Confirm works on M1 Pro and M1. But the result is weird: Looks like something was upscaled inproperly

I’m going to guess that it has something to do with the PyTorch version; I’m using nightly builds (from February 10 currently; see AUTOMATIC1111/stable-diffusion-webui#7453 for the webui-user.sh file with the exact configuration). In the near future I plan to have PyTorch 2.0 set as the default version for Macs running web UI anyway, so any PRs I submit here for MPS will be intended to be used with that webui-user.sh configuration.

@baigalibao
Copy link

Error
Expecting value: line 1 column 1 (char 0)

recall this problem ,i dont know why

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.

MacOS? MPS keeps crashing
4 participants