mirror of
				https://github.com/facebookresearch/pytorch3d.git
				synced 2025-11-04 09:52:11 +08:00 
			
		
		
		
	PyTorch>1.9 version str
Make code for downloading linux wheels robust to double-digit PyTorch version.
This commit is contained in:
		
							parent
							
								
									d049cd2e01
								
							
						
					
					
						commit
						3fc3ea507b
					
				@ -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",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user