[go: nahoru, domu]

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

TF 2.16.1 and Apple Silicon GPU support not working. #63854

Open
msusol opened this issue Mar 17, 2024 · 4 comments
Open

TF 2.16.1 and Apple Silicon GPU support not working. #63854

msusol opened this issue Mar 17, 2024 · 4 comments
Assignees
Labels
subtype:macOS macOS Build/Installation issues TF 2.16 type:build/install Build and install issues

Comments

@msusol
Copy link
msusol commented Mar 17, 2024

Issue type

Bug

Have you reproduced the bug with TensorFlow Nightly?

No

Source

binary

TensorFlow version

v2.16.1-0-g5bc9d26649c 2.16.1

Custom code

Yes

OS platform and distribution

Mac OS 14.3.1 Apple M3 Pro

Mobile device

No response

Python version

3.11

Bazel version

No response

GCC/compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

I can not get the basic example showing use of GPU to work on MacOS w/ TF 2.16.1.

However, It performs as expected in TF2.15.0

Standalone code to reproduce the issue

I have prepared 2 notebooks to show the behavior clearly, each using their own virtual environments.

  1. GPU working TensorFlow215.ipynb
  2. Unexpected TensorFlow216.ipynb

Relevant log output

No response

@asesh
Copy link
asesh commented Mar 18, 2024

You will have to install tensorflow-metal to add support for GPU on Apple silicons. More info

@msusol
Copy link
Author
msusol commented Mar 18, 2024

I did. Please look at the notebooks where I show exactly what was installed.

https://github.com/msusol/jupyter-notebook-on-macos/blob/main/notebooks/TensorFlow216.ipynb

@sushreebarsa sushreebarsa added type:build/install Build and install issues subtype:macOS macOS Build/Installation issues TF 2.16 and removed type:bug Bug labels Mar 21, 2024
@SuryanarayanaY
Copy link
Collaborator

Hi @msusol ,

As a temporary fix you can use Keras2 backend. Since TF2.16 defaults to Keras3 backend it uses Keras3 by default with tf.keras. You can switch to Keras2 backend by installing tf_keras package and setting os.environ['TF_USE_LEGACY_KERAS'] = '1'. Meanwhile team will look into the issue with Keras3 vs Mac compatibility.

@msusol
Copy link
Author
msusol commented Mar 29, 2024

Hi @msusol ,

As a temporary fix you can use Keras2 backend. Since TF2.16 defaults to Keras3 backend it uses Keras3 by default with tf.keras. You can switch to Keras2 backend by installing tf_keras package and setting os.environ['TF_USE_LEGACY_KERAS'] = '1'. Meanwhile team will look into the issue with Keras3 vs Mac compatibility.

Verified that this change does restore GPU access to the kernel:
msusol/datascience-pro@7688a9f

Waiting for the resolution to remove the legacy flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
subtype:macOS macOS Build/Installation issues TF 2.16 type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

4 participants