Practical-RIFE icon indicating copy to clipboard operation
Practical-RIFE copied to clipboard

feat: support PyTorch mps backend on macOS

Open GoldJohnKing opened this issue 9 months ago • 0 comments

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.

GoldJohnKing avatar Apr 28 '25 08:04 GoldJohnKing