Skip to content

Mac Support: Adapt FramePack for Apple Silicon#2

Merged
donghao1393 merged 9 commits into
mainfrom
feature/mac-support
Apr 18, 2025
Merged

Mac Support: Adapt FramePack for Apple Silicon#2
donghao1393 merged 9 commits into
mainfrom
feature/mac-support

Conversation

@donghao1393

@donghao1393 donghao1393 commented Apr 18, 2025

Copy link
Copy Markdown
Owner

This PR adds support for running FramePack on Apple Silicon Macs using MPS (Metal Performance Shaders) backend.

Changes

  • Added basic MPS support tests to verify functionality on Apple Silicon
  • Added MPS attention mechanism tests to verify the chunked attention implementation
  • Added documentation for Mac users
  • Added MPS fallback for unsupported operations
  • Based on PR Tinygrad MPS lllyasviel/FramePack#65 by @mdaiter, which implemented the core MPS adaptations

Testing

  • Tested on M4 Max with 128GB memory
  • Basic MPS support tests pass successfully
  • MPS attention mechanism tests pass successfully

Documentation

  • Added with instructions for Mac users
  • Included performance considerations and troubleshooting tips
  • Added instructions for handling unsupported MPS operations

Usage

For operations not yet implemented in MPS, we use the environment variable to fall back to CPU. This is handled automatically in the code and documented in the troubleshooting section.

A convenience script is provided to run the demo with the correct environment variables set.

This PR is a work in progress and will be updated with additional optimizations as needed.

@donghao1393 donghao1393 merged commit c0df480 into main Apr 18, 2025
@donghao1393 donghao1393 deleted the feature/mac-support branch April 18, 2025 18:59
@mdaiter

mdaiter commented Apr 18, 2025

Copy link
Copy Markdown

(Thank you @donghao1393 ! Can send yo more as I keep digging)

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.

2 participants