-
Notifications
You must be signed in to change notification settings - Fork 19.5k
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
keras with pytorch backend and mps set to default should use an mps generatir in randperm #19436
Comments
Hi @ralphrmartin , I have tested the code snippet and getting |
I'm not quite sure who needs to do what here. Is this a matter for the mps team? I'm just an end user trying to use this stuff, and I get the error given in my initial report when running on an Apple Silicon MacBook Pro, with the following versions of packages, using Python 3.12.2
|
Some operations, such as the 'aten::random_' operator, are currently unsupported for the MPS device in the Torch backend. You can find more information about this issue at pytorch/pytorch#77764. As a temporary solution, I recommend setting the environment variable PYTORCH_ENABLE_MPS_FALLBACK. This enables keras to automatically utilize the GPU, you don't need to set the default device in torch. |
Hi @ralphrmartin , Could you please refer above comment of @M7Saad .Is It seems compatibility issue with Pytorch ? |
Thank you. |
Hi @ralphrmartin , Could you please confirm whether this issue is with pytorch compatibility? If so whether we can mark it as resolved ? Thanks! |
Setting PYTORCH_ENABLE_MPS_FALLBACK 1 prevents the issue, thanks. |
Thanks for the response. Can we mark this as closed now? |
I guess so, but maybe the documentation needs updating to prevent other users from tripping over this. |
@ralphrmartin Hi Ralph, looking into this more it seems that If so we can remove the flag check from keras/keras/src/backend/torch/core.py Line 24 in 63586fa
|
I am lost at this point. Using
My original comment holds, that if I dont use If I set
If I dont do So, now what? |
Looks like mps is stable enough that we can remove the experimental flag, will submit a separate PR. Thank you for flagging this Ralph. |
Keras with pytorch backend and mps set to default needs to use an mps generator in randperm
The following code
produces the following error
The text was updated successfully, but these errors were encountered: