-
Notifications
You must be signed in to change notification settings - Fork 25.2k
[MPS] Add Conv3D support for MPS #114183
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
[MPS] Add Conv3D support for MPS #114183
Conversation
Signed-off-by: Lucas Steuernagel <lucas.tnagel@gmail.com>
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/114183
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (3 Unrelated Failures)As of commit 61b2bae with merge base 8c4812b ( FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
UNSTABLE - The following job failed but was likely due to flakiness present on trunk and has been marked as unstable:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
ae32e68
to
de4da94
Compare
Signed-off-by: Lucas Steuernagel <lucas.tnagel@gmail.com>
de4da94
to
be120dd
Compare
40ad309
to
48124c4
Compare
06fa8a7
to
8fea514
Compare
Either the build CI does not have the newer MacOS SDK or it is still running MacOS 12, because it does not work without the conditional compilation statement I added: On the other hand, the CI test job is on MacOS 13.2.1. This means the code for @kulinseth |
e85e47b
to
c81e901
Compare
Signed-off-by: Lucas Steuernagel <lucas.tnagel@gmail.com>
8a4849f
to
c9950e1
Compare
@pytorchbot merge -f "Lint + MPS are green" |
The merge job was canceled. If you believe this is a mistake, then you can re trigger it through pytorch-bot. |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
how do i make this work? still getting same "Conv3d is not supported on MPS" error when using SVD on comfyUI on M2 MBP Ventura 13.5.2 thank you :) |
@motannhoff SVD in comfyUI is now working for me on my M2, though it feels really slow. |
I followed your instructions and ran 'pip3 install --force-reinstall --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu' on M2. However, when running svd, I still encountered the error 'RuntimeError: Conv3D is not supported on MPS'. I have been stuck for a few days now. Could you please provide more details on how you managed to run it? |
same for me. still getting error. |
Managed to run successfully on M3 Max w/ ComfyUI on 12/16, for ppl. still see the Conv3D is not supported, make sure that the torchvision and torchaudio is installed w/ --no-dep flag, otherwise they will force uninstall the dev231216 version and install back dev231215 version of torch nightly. So my approach is force install torch 231216 (and upwards) then Prob. soon they will update their dependency to something higher than 20231215, then it should just work with normal installation method Speed is around 11s/it for a 768*512 image, so a 14 frams vid took bout 3 mins |
Fixes pytorch#77818 I saw that PR pytorch#99246 was approved, but no one fixed the rebase conflicts, so I am bringing this up again to be merged. I am leveraging @mattiaspaul work. Quoting the description here: > * this pull request enables 3D convolutions (forward/backward) for MPS (Apple Silicon) within the same Convolution.mm file as conv2d. > * does not support channel_last (since pytorch doesn't implement channel_last for 3D tensors) > * does not support conv3d_transpose and treats depth-separable convolutions not as normal case (there are no MPS kernels available for either of those so far) > * requires MacOS >=13.2 (Ventura) Please, let me know if there are any other changes needed and I'll be happy to implement them. Pull Request resolved: pytorch#114183 Approved by: https://github.com/malfet
Tried this method and got it to work for a single run, but when trying to generate another video I'm getting an error about a leaked semaphor, not sure if anyone else is getting this or how to force it to de-allocate the semaphor: /AppleInternal/Library/BuildRoots/0032d1ee-80fd-11ee-8227-6aecfccc70fe/Library/Caches/com.apple.xbs/Sources/MetalPerformanceShaders/MPSCore/Types/MPSNDArray.mm:761: failed assertion `[MPSNDArray initWithDevice:descriptor:] Error: total bytes of NDArray > 2**32'
Abort trap: 6 python main.py --force-fp16
/lib/python3.10/multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be 1 leaked semaphore objects to clean up at shutdown Tried on M3 Max 128G, python 3.10.12 Also if there is a better place to discuss this than a closed github merge I'll gladly move the discussion there |
This solution seems working, I got one extra error, then set env with "PYTORCH_MPS_HIGH_WATERMARK_RATIO=0.0" |
Fixes pytorch#77818 I saw that PR pytorch#99246 was approved, but no one fixed the rebase conflicts, so I am bringing this up again to be merged. I am leveraging @mattiaspaul work. Quoting the description here: > * this pull request enables 3D convolutions (forward/backward) for MPS (Apple Silicon) within the same Convolution.mm file as conv2d. > * does not support channel_last (since pytorch doesn't implement channel_last for 3D tensors) > * does not support conv3d_transpose and treats depth-separable convolutions not as normal case (there are no MPS kernels available for either of those so far) > * requires MacOS >=13.2 (Ventura) Please, let me know if there are any other changes needed and I'll be happy to implement them. Pull Request resolved: pytorch#114183 Approved by: https://github.com/malfet
It works, the versions are torch 2.3.0.dev20231216 Tried on M3, python 3.11.5 |
@mattiaspaul @LucasSte Why is this closed? I am able to successfully use ConvTranspose3D when following the directions here: |
How did you manage to compile that? It's crashing and burning over here.
-- the original error --
|
@LucasSte @malfet @kulinseth is conv3d supported on mps now in the latest version or not? All video generation models are broken on mps, I'm wondering if this is the reason. |
Fixes #77818
I saw that PR #99246 was approved, but no one fixed the rebase conflicts, so I am bringing this up again to be merged.
I am leveraging @mattiaspaul work. Quoting the description here:
Please, let me know if there are any other changes needed and I'll be happy to implement them.
cc @kulinseth @albanD @malfet @DenisVieriu97 @razarmehr