Skip to content

Commit

Permalink
Update r2.1 wheel to be compatible with PyPI (#5550)
Browse files Browse the repository at this point in the history
* Update project metadata and remove useless files

* Update README

* Add manylinux platform tag

* formatting
  • Loading branch information
will-cromar authored Sep 8, 2023
1 parent 89574d2 commit 691838f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 77 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ started:
To install PyTorch/XLA a new VM:

```
pip install torch~=2.0.0 https://storage.googleapis.com/tpu-pytorch/wheels/tpuvm/torch_xla-2.0-cp38-cp38-linux_x86_64.whl
pip install torch~=2.1.0 torch_xla[tpu]~=2.1.0 -f https://storage.googleapis.com/libtpu-releases/libtpu_releases.html
```

To update your existing training loop, make the following changes:

```
```diff
-import torch.multiprocessing as mp
+import torch_xla.core.xla_model as xm
+import torch_xla.distributed.parallel_loader as pl
Expand Down Expand Up @@ -64,7 +64,7 @@ To update your existing training loop, make the following changes:
If you're using `DistributedDataParallel`, make the following changes:


```
```diff
import torch.distributed as dist
-import torch.multiprocessing as mp
+import torch_xla.core.xla_model as xm
Expand Down
2 changes: 1 addition & 1 deletion infra/ansible/roles/build_srcs/tasks/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

- name: Build PyTorch/XLA
ansible.builtin.command:
cmd: python setup.py bdist_wheel
cmd: python setup.py bdist_wheel -p manylinux_2_28_x86_64
chdir: "{{ (src_root, 'pytorch/xla') | path_join }}"
environment: "{{ env_vars }}"

Expand Down
65 changes: 0 additions & 65 deletions scripts/fixup_binary.py

This file was deleted.

34 changes: 26 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
base_dir = os.path.dirname(os.path.abspath(__file__))

_libtpu_version = '0.1.dev20230809'
_libtpu_storage_path = f'https://storage.googleapis.com/cloud-tpu-tpuvm-artifacts/wheels/libtpu-nightly/libtpu_nightly-{_libtpu_version}-py3-none-any.whl'


def _get_build_mode():
Expand Down Expand Up @@ -307,15 +306,37 @@ def run(self):
super().run()


# Read in README.md for our long_description
cwd = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(cwd, "README.md"), encoding="utf-8") as f:
long_description = f.read()

setup(
name=os.environ.get('TORCH_XLA_PACKAGE_NAME', 'torch_xla'),
version=version,
description='XLA bridge for PyTorch',
long_description=long_description,
long_description_content_type="text/markdown",
url='https://github.com/pytorch/xla',
author='PyTorch/XLA Dev Team',
author_email='[email protected]',
# Exclude the build files.
packages=find_packages(exclude=['build']),
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: BSD License",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries",
"Topic :: Software Development :: Libraries :: Python Modules",
"Programming Language :: C++",
"Programming Language :: Python :: 3",
],
python_requires=">=3.8.0",
packages=find_packages(include=['torch_xla*']),
ext_modules=[
BazelExtension('//:_XLAC.so'),
],
Expand All @@ -334,12 +355,9 @@ def run(self):
},
extras_require={
# On Cloud TPU VM install with:
# $ sudo pip3 install torch_xla[tpuvm] -f https://storage.googleapis.com/tpu-pytorch/wheels/tpuvm/torch_xla-1.11-cp38-cp38-linux_x86_64.whl
'tpuvm': [f'libtpu-nightly @ {_libtpu_storage_path}'],
# pip install torch_xla[tpu] -f https://storage.googleapis.com/libtpu-releases/libtpu_releases.html
'tpu': [f'libtpu-nightly=={_libtpu_version}'],
},
data_files=[
'scripts/fixup_binary.py',
],
cmdclass={
'build_ext': BuildBazelExtension,
'clean': Clean,
Expand Down

0 comments on commit 691838f

Please sign in to comment.