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

Introduction to Diffusers Notebook - Mac M1 Support #12

Open
schauppi opened this issue Nov 29, 2022 · 4 comments
Open

Introduction to Diffusers Notebook - Mac M1 Support #12

schauppi opened this issue Nov 29, 2022 · 4 comments

Comments

@schauppi
Copy link

I have spotted an Issue not directly for this notebook but for Mac m1 users.

If you set device = torch.device("cpu") the output of show_images(xb).resize((8 * 64, 64), resample=Image.NEAREST) gives you 8 different images of butterflies.
Bit if you set device = torch.device("mps") the output of the same functions return 8 times the same butterfly.

Don´t know what's going on under the hood with torch gpu for Mac m1 yet - didn't find something googeling it.

@johnowhitaker
Copy link
Collaborator

Very strange! Hopefully someone with a mac can figure out a fix, I can't think what would be causing this.

@angellmethod
Copy link
Contributor

I can repo this but I think the issue in pytorch core from this issue I found:

pytorch/pytorch#84523

@angellmethod
Copy link
Contributor

The simple workaround as far as this notebook goes looks like moving the detach().cpu() operation into make_grid.

grid = torchvision.utils.make_grid(x.detach().cpu()) 

grid_im = grid.permute(1, 2, 0).clip(0, 1) * 255

@johnowhitaker
Copy link
Collaborator

Thanks for the detective work @angellmethod, I'll test and push the change post Christmas chaos :)

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

No branches or pull requests

3 participants