Skip to content

Commit

Permalink
Supporting passing ML framework name and version through the PjRt Cli…
Browse files Browse the repository at this point in the history
…ent Create options in PyTorch/xla. (#7249)
  • Loading branch information
aman2930 committed Jun 12, 2024
1 parent 90168e8 commit 81f657a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions torch_xla/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def _setup_default_env():
os.environ.setdefault('TPU_ML_PLATFORM', 'PyTorch/XLA')
# This is used for ML Framework Telemetry.
os.environ.setdefault('TPU_ML_PLATFORM_VERSION', __version__)
os.environ.setdefault('ENABLE_RUNTIME_UPTIME_TELEMETRY', '1')

if tpu.version() == 4:
os.environ.setdefault('TPU_MEGACORE', 'megacore_dense')
Expand Down
7 changes: 6 additions & 1 deletion torch_xla/_internal/tpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import torch_xla.core.xla_env_vars as xenv
import torch_xla.core.xla_model as xm
from torch_xla.experimental import plugins
from torch_xla.version import __version__

_GCE_METADATA_ROOT_URL = 'http://metadata.google.internal/computeMetadata/v1'
_ACCELERATOR_TYPE_TO_HOST_BOUNDS = {
Expand Down Expand Up @@ -347,5 +348,9 @@ def physical_chip_count(self):
def client_create_options(self):
return {
'max_inflight_computations':
xu.getenv_as('XLA_TPU_MAX_INFLIGHT_COMPUTATIONS', int, 4)
xu.getenv_as('XLA_TPU_MAX_INFLIGHT_COMPUTATIONS', int, 4),
'ml_framework_name':
'PyTorch/XLA',
'ml_framework_version':
__version__
}

0 comments on commit 81f657a

Please sign in to comment.