Skip to content

Commit

Permalink
PyTorch>1.9 version str
Browse files Browse the repository at this point in the history
Summary: Make code for downloading linux wheels robust to double-digit PyTorch minor version.

Reviewed By: nikhilaravi

Differential Revision: D33170562

fbshipit-source-id: 559a97cc98ff8411e235a9f9e29f84b7a400c716
  • Loading branch information
bottler authored and facebook-github-bot committed Dec 18, 2021
1 parent 315f248 commit 1152a93
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 12 deletions.
3 changes: 2 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ In general, from inside IPython, or in Google Colab or a jupyter notebook, you c
```
import sys
import torch
pyt_version_str=torch.__version__.split("+")[0].replace(".", "")
version_str="".join([
f"py3{sys.version_info.minor}_cu",
torch.version.cuda.replace(".",""),
f"_pyt{torch.__version__[0:5:2]}"
f"_pyt{pyt_version_str}"
])
!pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html
```
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorials/bundle_adjustment.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,11 @@
"if need_pytorch3d:\n",
" if torch.__version__.startswith(\"1.10.\") and sys.platform.startswith(\"linux\"):\n",
" # We try to install PyTorch3D via a released wheel.\n",
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
" version_str=\"\".join([\n",
" f\"py3{sys.version_info.minor}_cu\",\n",
" torch.version.cuda.replace(\".\",\"\"),\n",
" f\"_pyt{torch.__version__[0:5:2]}\"\n",
" f\"_pyt{pyt_version_str}\"\n",
" ])\n",
" !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
" else:\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,11 @@
"if need_pytorch3d:\n",
" if torch.__version__.startswith(\"1.10.\") and sys.platform.startswith(\"linux\"):\n",
" # We try to install PyTorch3D via a released wheel.\n",
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
" version_str=\"\".join([\n",
" f\"py3{sys.version_info.minor}_cu\",\n",
" torch.version.cuda.replace(\".\",\"\"),\n",
" f\"_pyt{torch.__version__[0:5:2]}\"\n",
" f\"_pyt{pyt_version_str}\"\n",
" ])\n",
" !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
" else:\n",
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorials/dataloaders_ShapeNetCore_R2N2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,11 @@
"if need_pytorch3d:\n",
" if torch.__version__.startswith(\"1.10.\") and sys.platform.startswith(\"linux\"):\n",
" # We try to install PyTorch3D via a released wheel.\n",
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
" version_str=\"\".join([\n",
" f\"py3{sys.version_info.minor}_cu\",\n",
" torch.version.cuda.replace(\".\",\"\"),\n",
" f\"_pyt{torch.__version__[0:5:2]}\"\n",
" f\"_pyt{pyt_version_str}\"\n",
" ])\n",
" !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
" else:\n",
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorials/deform_source_mesh_to_target_mesh.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,11 @@
"if need_pytorch3d:\n",
" if torch.__version__.startswith(\"1.10.\") and sys.platform.startswith(\"linux\"):\n",
" # We try to install PyTorch3D via a released wheel.\n",
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
" version_str=\"\".join([\n",
" f\"py3{sys.version_info.minor}_cu\",\n",
" torch.version.cuda.replace(\".\",\"\"),\n",
" f\"_pyt{torch.__version__[0:5:2]}\"\n",
" f\"_pyt{pyt_version_str}\"\n",
" ])\n",
" !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
" else:\n",
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorials/fit_simple_neural_radiance_field.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@
"if need_pytorch3d:\n",
" if torch.__version__.startswith(\"1.10.\") and sys.platform.startswith(\"linux\"):\n",
" # We try to install PyTorch3D via a released wheel.\n",
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
" version_str=\"\".join([\n",
" f\"py3{sys.version_info.minor}_cu\",\n",
" torch.version.cuda.replace(\".\",\"\"),\n",
" f\"_pyt{torch.__version__[0:5:2]}\"\n",
" f\"_pyt{pyt_version_str}\"\n",
" ])\n",
" !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
" else:\n",
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorials/fit_textured_mesh.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@
"if need_pytorch3d:\n",
" if torch.__version__.startswith(\"1.10.\") and sys.platform.startswith(\"linux\"):\n",
" # We try to install PyTorch3D via a released wheel.\n",
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
" version_str=\"\".join([\n",
" f\"py3{sys.version_info.minor}_cu\",\n",
" torch.version.cuda.replace(\".\",\"\"),\n",
" f\"_pyt{torch.__version__[0:5:2]}\"\n",
" f\"_pyt{pyt_version_str}\"\n",
" ])\n",
" !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
" else:\n",
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorials/fit_textured_volume.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@
"if need_pytorch3d:\n",
" if torch.__version__.startswith(\"1.10.\") and sys.platform.startswith(\"linux\"):\n",
" # We try to install PyTorch3D via a released wheel.\n",
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
" version_str=\"\".join([\n",
" f\"py3{sys.version_info.minor}_cu\",\n",
" torch.version.cuda.replace(\".\",\"\"),\n",
" f\"_pyt{torch.__version__[0:5:2]}\"\n",
" f\"_pyt{pyt_version_str}\"\n",
" ])\n",
" !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
" else:\n",
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorials/render_colored_points.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,11 @@
"if need_pytorch3d:\n",
" if torch.__version__.startswith(\"1.10.\") and sys.platform.startswith(\"linux\"):\n",
" # We try to install PyTorch3D via a released wheel.\n",
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
" version_str=\"\".join([\n",
" f\"py3{sys.version_info.minor}_cu\",\n",
" torch.version.cuda.replace(\".\",\"\"),\n",
" f\"_pyt{torch.__version__[0:5:2]}\"\n",
" f\"_pyt{pyt_version_str}\"\n",
" ])\n",
" !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
" else:\n",
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorials/render_densepose.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@
"if need_pytorch3d:\n",
" if torch.__version__.startswith(\"1.10.\") and sys.platform.startswith(\"linux\"):\n",
" # We try to install PyTorch3D via a released wheel.\n",
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
" version_str=\"\".join([\n",
" f\"py3{sys.version_info.minor}_cu\",\n",
" torch.version.cuda.replace(\".\",\"\"),\n",
" f\"_pyt{torch.__version__[0:5:2]}\"\n",
" f\"_pyt{pyt_version_str}\"\n",
" ])\n",
" !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
" else:\n",
Expand Down
3 changes: 2 additions & 1 deletion docs/tutorials/render_textured_meshes.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@
"if need_pytorch3d:\n",
" if torch.__version__.startswith(\"1.10.\") and sys.platform.startswith(\"linux\"):\n",
" # We try to install PyTorch3D via a released wheel.\n",
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
" version_str=\"\".join([\n",
" f\"py3{sys.version_info.minor}_cu\",\n",
" torch.version.cuda.replace(\".\",\"\"),\n",
" f\"_pyt{torch.__version__[0:5:2]}\"\n",
" f\"_pyt{pyt_version_str}\"\n",
" ])\n",
" !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
" else:\n",
Expand Down
3 changes: 2 additions & 1 deletion packaging/linux_wheels/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ commands.
```
import sys
import torch
pyt_version_str=torch.__version__.split("+")[0].replace(".", "")
version_str="".join([
f"py3{sys.version_info.minor}_cu",
torch.version.cuda.replace(".",""),
f"_pyt{torch.__version__[0:5:2]}"
f"_pyt{pyt_version_str}"
])
!pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html
```

0 comments on commit 1152a93

Please sign in to comment.