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

Load correct libtpu for pytorch & jax. #1166

Merged
merged 2 commits into from
May 26, 2022
Merged

Load correct libtpu for pytorch & jax. #1166

merged 2 commits into from
May 26, 2022

Conversation

djherbis
Copy link
Contributor

It turns out jax & pytorch are incompatible (require different libtpu
versions). In order to support importing EITHER of them (but not both)
we will swap in the correct libtpu during import (by monkey-patching the
import code for both).

https://b/213335159

It turns out jax & pytorch are incompatible (require different libtpu
versions). In order to support importing EITHER of them (but not both)
we will swap in the correct libtpu during import (by monkey-patching the
import code for both).

https://b/213335159
@djherbis djherbis requested a review from rosbo May 26, 2022 14:18
sed -i "1s/^/from jax._src.cloud_tpu_init import cloud_tpu_init\ncloud_tpu_init()\n/" /opt/conda/lib/python3.7/site-packages/tensorflow/__init__.py

# Set these env vars so that they don't produce errs calling the metadata server to load them:
ENV TPU_ACCELERATOR_TYPE=v3-8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the session manager set these instead?

This image could eventually be used on TPU v4 or TPU v3 pods (e.g. v3-XYZ).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll stick them in the session-manager as well (which will override the image defaults), but having the defaults helped me release the image quicker.

I doubt we'll be jumping TPU arch's anytime soon though, but I agree with the idea.

@djherbis djherbis merged commit b6c9ef1 into main May 26, 2022
@djherbis djherbis deleted the fix-libtpu branch May 26, 2022 17:06
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.

2 participants