mirror of
				https://github.com/facebookresearch/pytorch3d.git
				synced 2025-11-04 18:02:14 +08:00 
			
		
		
		
	PyTorch>1.9 version str
Summary: Make code for downloading linux wheels robust to double-digit PyTorch minor version. Reviewed By: nikhilaravi Differential Revision: D33170562 fbshipit-source-id: 559a97cc98ff8411e235a9f9e29f84b7a400c716
This commit is contained in:
		
							parent
							
								
									315f2487db
								
							
						
					
					
						commit
						1152a93b72
					
				@ -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
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user