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

Request: Add Metal GPU Apple Silicon Support #14

Closed
Runtrons opened this issue Feb 25, 2025 · 5 comments
Closed

Request: Add Metal GPU Apple Silicon Support #14

Runtrons opened this issue Feb 25, 2025 · 5 comments

Comments

@Runtrons
Copy link

It would be fantastic to see support for Metal GPU on Apple Silicon in Wan2.1. This enhancement could significantly improve performance for users on macOS devices. This would involve:

  • Replacing CUDA device initialization with MPS (e.g., torch.device("mps" if torch.backends.mps.is_available() else "cpu")).
  • Adjusting precision from float64 to float32 in areas like sinusoidal embeddings and rotary encodings.
  • Handling random generation by creating tensors on CPU before moving them to MPS.
  • Replacing CUDA-specific calls (e.g., torch.cuda.empty_cache(), torch.cuda.amp.autocast) with conditional alternatives.
  • Adding a compatibility layer during model loading for device differences.

I’m willing to help contribute to this effort and collaborate with anyone interested in making this happen.

@bakhti-ai
Copy link

Hi there, I forked and adjusted the repo to make it work on my macbook m1 pro. After adjustments it worked on macos. I opened a PR for this original repo as well. You can check it out here #69

@Runtrons
Copy link
Author

You rock! Really appreciate your contribution!

@FurkanGozukara
Copy link

Hi there, I forked and adjusted the repo to make it work on my macbook m1 pro. After adjustments it worked on macos. I opened a PR for this original repo as well. You can check it out here #69

i cant imagine speed :D what are the step speeds for 1.3b 480p and 14b 720p?

@bakhti-ai
Copy link

Hi there, I forked and adjusted the repo to make it work on my macbook m1 pro. After adjustments it worked on macos. I opened a PR for this original repo as well. You can check it out here #69

i cant imagine speed :D what are the step speeds for 1.3b 480p and 14b 720p?

I haven't tested 14b 720p locally and not going to :D
I tried 1.3b, 480p, frame_num 8 and I think it took around 10mins to generate the video so 1min per step I guess

@bakhti-ai
Copy link

bakhti-ai commented Feb 26, 2025

Hi there, I forked and adjusted the repo to make it work on my macbook m1 pro. After adjustments it worked on macos. I opened a PR for this original repo as well. You can check it out here #69

i cant imagine speed :D what are the step speeds for 1.3b 480p and 14b 720p?

I haven't tested 14b 720p locally and not going to :D I tried 1.3b, 480p, frame_num 8 and I think it took around 10mins to generate the video so 1min per step I guess

Then I increased frame_num to 24 to generate a little longer video, then waited around 1,5 hours but it was only 20% I just stopped it there

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