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

feat: macOS support #143

Merged
merged 5 commits into from
Jul 15, 2024
Merged

Conversation

jeethu
Copy link
Contributor

@jeethu jeethu commented Jul 14, 2024

I've verified on my Linux box with NVIDIA gpus that this change is fully backwards compatible. Should work on any Apple Silicon Mac with at least 24GB of RAM or even 16GB if no other apps are running. Some caveats:

  1. The warping module cannot be run on MPS, because aten::grid_sampler_3d isn’t yet implemented in PyTorch’s MPS backend. The PYTORCH_ENABLE_MPS_FALLBACK env var can be set to work around it.
  2. Also, onnxruntime-gpu cannot be installed on macOS, so I've substituted it with onnxruntime-silicon.
  3. --flag_do_torch_compile doesn't work on macOS because the PyTorch MPS backend doesn't support it, yet.

Install requirements with:

pip install -r requirements_apple.txt

Run with:

PYTORCH_ENABLE_MPS_FALLBACK=1 python app.py

@zzzweakman
Copy link
Collaborator

Thanks so much for your PR! We tested it on macOS and everything works great.

Before merging into the main branch, we need to make some updates to the README and other formatting changes. We'll create a new branch for this and merge your changes there first. Once everything is ready, we'll merge it all into the main branch and release it as a new feature.

Thanks again for your contribution! @jeethu

@zzzweakman zzzweakman changed the base branch from main to feat/macOS-support July 15, 2024 07:50
@zzzweakman zzzweakman changed the title Support for running on Apple Silicon Macs using the PyTorch MPS backend feat: macOS support Jul 15, 2024
@zzzweakman zzzweakman merged commit 20b1a00 into KwaiVGI:feat/macOS-support Jul 15, 2024
@Fronkielein
Copy link

Fronkielein commented Jul 15, 2024

Thanks so much @jeethu and @zzzweakman for your efforts. I am an absolute beginner and I desperately tried to run LivePortrait on my Mac M1 until yesterday. I have no idea of how to install the new feature as soon as it is there, but I hope I'll find out. I'm just happy that there is a M1 solution now.

cleardusk added a commit that referenced this pull request Jul 17, 2024
* feat: macOS support (#143)

* Support for running on Apple Silicon Macs with MPS

* Minor typo fix: s/provicer/provider/

* Another typo fix: s/concact/concat/

* s/cudaexecutionprovider/CUDAExecutionProvider/

* Add requirements_apple.txt

* doc: macOS support

* chore: refine the structure and doc

* doc: update readme

* doc: update readme

* doc: update readme

* doc: update readme

---------

Co-authored-by: Jeethu Rao <jeethu@jeethurao.com>
Co-authored-by: zzzweakman <1819489045@qq.com>
@shaoguowen
Copy link

Thanks so much @jeethu and @zzzweakman for your efforts. I am an absolute beginner and I desperately tried to run LivePortrait on my Mac M1 until yesterday. I have no idea of how to install the new feature as soon as it is there, but I hope I'll find out. I'm just happy that there is a M1 solution now.

Hi, What is the speed on the M1?

@jeethu jeethu deleted the jeethu/mps branch July 18, 2024 19:53
@Fronkielein
Copy link

Fronkielein commented Jul 19, 2024 via email

@wming3
Copy link

wming3 commented Aug 7, 2024

inter cpu
torch insert failed
#295

@yourmoonlight
Copy link

yourmoonlight commented Aug 19, 2024

HI, it took 100 seconds of generation time for 97 frames (which is almost 4 seconds of video) Apple M1 Max with Apple GPU 64 GB RAM Mac Sonoma 14.5 (Mac Studio M1Max/64/2TB 24C GPU BTO)

Am 18.07.2024 um 07:57 schrieb shaoguowen @.***>: Thanks so much @jeethu https://github.com/jeethu and @zzzweakman https://github.com/zzzweakman for your efforts. I am an absolute beginner and I desperately tried to run LivePortrait on my Mac M1 until yesterday. I have no idea of how to install the new feature as soon as it is there, but I hope I'll find out. I'm just happy that there is a M1 solution now. Hi, What is the speed on the M1? — Reply to this email directly, view it on GitHub <#143 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJZASCBG5T2UDMQM7FKRKDTZM5KOJAVCNFSM6AAAAABK3GFJSGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZVGY2TMMRXHE. You are receiving this because you commented.

Hmmm, This speed is a bit slow, Do we have a way to accelerate on m1max?

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.

6 participants