FahimF / sd-gui

Clean and simple Stable Diffusion GUI for macOS, Windows, and Linux
MIT License
230 stars 17 forks source link

Thanks for putting this together #1

Closed ronanwp closed 1 year ago

ronanwp commented 1 year ago

I had the following issues with the install on my MBP M1. I thought I would share with you along with my workarounds.

  1. The conda install does not work as it appears to be for windows. I went to the anaconda site and downloaded this script which worked: https://repo.anaconda.com/archive/Anaconda3-2022.05-MacOSX-arm64.sh
  2. I had to alter my .zshrc to include the path to where I installed conda for the commands to work. conda activate ml would not work unless conda was explicitly on the path.
  3. I did not initially have access to "Compvis/stable-diffusion-v1-4" on huggingface.co. I had to search for the Model on the huggingface site and accept the license. The instructions mention this earlier but it might be clearer if they are mentioned here also :)
  4. Initially I also got ImportError: cannot import name 'EntryNotFoundError' from 'huggingface_hub.utils'. I followed the instructions to pip install diffusers which resolved the issue. I am not on an Intel Mac though

Good news. It works now! Thank you for putting this together and sharing it. I hope my install instructions are a help to you.

FahimF commented 1 year ago

Thanks for the feedback Ronan :smile: I'm a bit puzzled by #1 since as you can see from the URL, it is for the latest MacOSX miniconda. Plus, I installed it on an Intel mac myself and it worked. So just trying to figure out what might have gone wrong ...

The miniconda install should prompt you to add the path to your settings. If you do not accept, you will of course have to manually add it it. But it's a good point. Will update the docs to reflect this.

You are right about agreeing to the license part. I should have been clearer about that. I had forgotten that step since I agreed to the license a couple of weeks ago. Will add/update.

Yes, it appears #4 is the solution on both Intel and Apple Silicon since a couple of others have mentioned this on Reddit as well. I'll update the docs to reflect this.

ronanwp commented 1 year ago

Thanks Fahim,

Yeah, when I executed the Miniconda command:

/bin/bash -c "$(curl -fsSL https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh)"

It looks like the right script but running it failed as it tried to execute a Windows exe. Not sure what was going on.

Ronan

On Sat, Sep 10, 2022 at 7:26 PM Fahim Farook @.***> wrote:

Closed #1 https://github.com/FahimF/sd-gui/issues/1 as completed.

— Reply to this email directly, view it on GitHub https://github.com/FahimF/sd-gui/issues/1#event-7361484621, or unsubscribe https://github.com/notifications/unsubscribe-auth/AT3DCMUIKW5FLDROV4SEM73V5UDIHANCNFSM6AAAAAAQJPL4NY . You are receiving this because you authored the thread.Message ID: @.***>

HugoSega commented 1 year ago

Thanks Fahim for putting all this together.

here is the fix for the seeds to work properly. Seeds don't seem to work very well on M1s, but you can re-generate an image by changing in txt2img.py

Change start_code = torch.randn([opt.n_samples, opt.C, opt.H // opt.f, opt.W // opt.f], device=device) to: start_code = torch.randn([opt.n_samples, opt.C, opt.H // opt.f, opt.W // opt.f], device="cpu").to(torch.device("mps"))

And then, move seed_everything(opt.seed) ``below model = load_model_from_config(config, f"{opt.ckpt}") below model = load_model_from_config(config, f"{opt.ckpt}")

For img2img.py, change

z_enc = sampler.stochastic_encode(init_latent, torch.tensor([t_enc]*batch_size).to(device)) to: z_enc = sampler.stochastic_encode(init_latent, torch.tensor([t_enc] * batch_size).to(device), noise=torch.randn_like(init_latent, device="cpu").to(device) if opt.fixed_code else None,)

Thanks again Fahim !