Skip to content

feat: support PyTorch mps backend on macOS #146

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

GoldJohnKing
Copy link

This PR adds PyTorch's mps (Metal Performance Shaders) backend support on macOS systems, which improves performance from ~1 it/s (pure CPU) to ~7 it/s on Apple M4 chips.

Note that in warplayer.py, mps backend does not support padding_mode='border' in torch.nn.functional.grid_sample function. Switching to padding_mode='zero' while clamping grid to (-1,1) does the trick. They should produce the same result.

Because some files in train_log/train_log_SAFA also need to be changed, I removed train_log exclusion from .gitignore and added files from RIFE_v4.26 and SAFA_v0.5. If they should be placed else where, please let me know.

Tested on my Mac mini M4 with a 1280x720 video, it works well.

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.

1 participant