mirror of
				https://github.com/facebookresearch/pytorch3d.git
				synced 2025-11-04 18:02:14 +08:00 
			
		
		
		
	update notebooks for s3 wheels
Summary: Prepare the tutorial notebooks to use wheels from S3 when run on colab. Reviewed By: nikhilaravi Differential Revision: D26226932 fbshipit-source-id: 1f9366c3fb4ba195333a5d5dfa3f6876ea934508
This commit is contained in:
		
							parent
							
								
									e0753f0b0d
								
							
						
					
					
						commit
						db6fbfad90
					
				@ -6,9 +6,8 @@ https://github.com/facebookresearch/pytorch3d/tree/stable/docs/tutorials .
 | 
			
		||||
 | 
			
		||||
There are links at the project homepage for opening these directly in colab.
 | 
			
		||||
 | 
			
		||||
They install torch, torchvision and PyTorch3D from pip, which should work
 | 
			
		||||
with the CUDA 10.1 inside a GPU colab notebook. If you need to install
 | 
			
		||||
PyTorch3D from source inside colab, you can use
 | 
			
		||||
They install PyTorch3D from pip, which should work inside a GPU colab notebook.
 | 
			
		||||
If you need to install PyTorch3D from source inside colab, you can use
 | 
			
		||||
```
 | 
			
		||||
import os
 | 
			
		||||
!curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz
 | 
			
		||||
 | 
			
		||||
@ -63,7 +63,7 @@
 | 
			
		||||
    "id": "WAHR1LMJmP-h"
 | 
			
		||||
   },
 | 
			
		||||
   "source": [
 | 
			
		||||
    "If `torch`, `torchvision` and `pytorch3d` are not installed, run the following cell:"
 | 
			
		||||
    "Ensure `torch` and `torchvision` are installed. If `pytorch3d` is not installed, install it using the following cell:"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
@ -80,19 +80,25 @@
 | 
			
		||||
   },
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "!pip install torch torchvision\n",
 | 
			
		||||
    "import os\n",
 | 
			
		||||
    "import sys\n",
 | 
			
		||||
    "import torch\n",
 | 
			
		||||
    "if torch.__version__=='1.6.0+cu101' and sys.platform.startswith('linux'):\n",
 | 
			
		||||
    "    !pip install pytorch3d\n",
 | 
			
		||||
    "else:\n",
 | 
			
		||||
    "    need_pytorch3d=False\n",
 | 
			
		||||
    "    try:\n",
 | 
			
		||||
    "        import pytorch3d\n",
 | 
			
		||||
    "    except ModuleNotFoundError:\n",
 | 
			
		||||
    "        need_pytorch3d=True\n",
 | 
			
		||||
    "    if need_pytorch3d:\n",
 | 
			
		||||
    "need_pytorch3d=False\n",
 | 
			
		||||
    "try:\n",
 | 
			
		||||
    "    import pytorch3d\n",
 | 
			
		||||
    "except ModuleNotFoundError:\n",
 | 
			
		||||
    "    need_pytorch3d=True\n",
 | 
			
		||||
    "if need_pytorch3d:\n",
 | 
			
		||||
    "    if torch.__version__.startswith(\"1.7\") and sys.platform.startswith(\"linux\"):\n",
 | 
			
		||||
    "        # We try to install PyTorch3D via a released wheel.\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",
 | 
			
		||||
    "        ])\n",
 | 
			
		||||
    "        !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
 | 
			
		||||
    "    else:\n",
 | 
			
		||||
    "        # We try to install PyTorch3D from source.\n",
 | 
			
		||||
    "        !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
 | 
			
		||||
    "        !tar xzf 1.10.0.tar.gz\n",
 | 
			
		||||
    "        os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
 | 
			
		||||
 | 
			
		||||
@ -50,7 +50,7 @@
 | 
			
		||||
    "id": "qkX7DiM6rmeM"
 | 
			
		||||
   },
 | 
			
		||||
   "source": [
 | 
			
		||||
    "If `torch`, `torchvision` and `pytorch3d` are not installed, run the following cell:"
 | 
			
		||||
    "Ensure `torch` and `torchvision` are installed. If `pytorch3d` is not installed, install it using the following cell:"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
@ -67,19 +67,25 @@
 | 
			
		||||
   },
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "!pip install torch torchvision\n",
 | 
			
		||||
    "import os\n",
 | 
			
		||||
    "import sys\n",
 | 
			
		||||
    "import torch\n",
 | 
			
		||||
    "if torch.__version__=='1.6.0+cu101' and sys.platform.startswith('linux'):\n",
 | 
			
		||||
    "    !pip install pytorch3d\n",
 | 
			
		||||
    "else:\n",
 | 
			
		||||
    "    need_pytorch3d=False\n",
 | 
			
		||||
    "    try:\n",
 | 
			
		||||
    "        import pytorch3d\n",
 | 
			
		||||
    "    except ModuleNotFoundError:\n",
 | 
			
		||||
    "        need_pytorch3d=True\n",
 | 
			
		||||
    "    if need_pytorch3d:\n",
 | 
			
		||||
    "need_pytorch3d=False\n",
 | 
			
		||||
    "try:\n",
 | 
			
		||||
    "    import pytorch3d\n",
 | 
			
		||||
    "except ModuleNotFoundError:\n",
 | 
			
		||||
    "    need_pytorch3d=True\n",
 | 
			
		||||
    "if need_pytorch3d:\n",
 | 
			
		||||
    "    if torch.__version__.startswith(\"1.7\") and sys.platform.startswith(\"linux\"):\n",
 | 
			
		||||
    "        # We try to install PyTorch3D via a released wheel.\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",
 | 
			
		||||
    "        ])\n",
 | 
			
		||||
    "        !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
 | 
			
		||||
    "    else:\n",
 | 
			
		||||
    "        # We try to install PyTorch3D from source.\n",
 | 
			
		||||
    "        !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
 | 
			
		||||
    "        !tar xzf 1.10.0.tar.gz\n",
 | 
			
		||||
    "        os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
 | 
			
		||||
 | 
			
		||||
@ -33,7 +33,7 @@
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "If `torch`, `torchvision` and `pytorch3d` are not installed, run the following cell:"
 | 
			
		||||
    "Ensure `torch` and `torchvision` are installed. If `pytorch3d` is not installed, install it using the following cell:"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
@ -42,19 +42,25 @@
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "!pip install torch torchvision\n",
 | 
			
		||||
    "import os\n",
 | 
			
		||||
    "import sys\n",
 | 
			
		||||
    "import torch\n",
 | 
			
		||||
    "if torch.__version__=='1.6.0+cu101' and sys.platform.startswith('linux'):\n",
 | 
			
		||||
    "    !pip install pytorch3d\n",
 | 
			
		||||
    "else:\n",
 | 
			
		||||
    "    need_pytorch3d=False\n",
 | 
			
		||||
    "    try:\n",
 | 
			
		||||
    "        import pytorch3d\n",
 | 
			
		||||
    "    except ModuleNotFoundError:\n",
 | 
			
		||||
    "        need_pytorch3d=True\n",
 | 
			
		||||
    "    if need_pytorch3d:\n",
 | 
			
		||||
    "need_pytorch3d=False\n",
 | 
			
		||||
    "try:\n",
 | 
			
		||||
    "    import pytorch3d\n",
 | 
			
		||||
    "except ModuleNotFoundError:\n",
 | 
			
		||||
    "    need_pytorch3d=True\n",
 | 
			
		||||
    "if need_pytorch3d:\n",
 | 
			
		||||
    "    if torch.__version__.startswith(\"1.7\") and sys.platform.startswith(\"linux\"):\n",
 | 
			
		||||
    "        # We try to install PyTorch3D via a released wheel.\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",
 | 
			
		||||
    "        ])\n",
 | 
			
		||||
    "        !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
 | 
			
		||||
    "    else:\n",
 | 
			
		||||
    "        # We try to install PyTorch3D from source.\n",
 | 
			
		||||
    "        !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
 | 
			
		||||
    "        !tar xzf 1.10.0.tar.gz\n",
 | 
			
		||||
    "        os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
 | 
			
		||||
 | 
			
		||||
@ -68,7 +68,7 @@
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "If `torch`, `torchvision` and `pytorch3d` are not installed, run the following cell:"
 | 
			
		||||
    "Ensure `torch` and `torchvision` are installed. If `pytorch3d` is not installed, install it using the following cell:"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
@ -81,19 +81,25 @@
 | 
			
		||||
   },
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "!pip install torch torchvision\n",
 | 
			
		||||
    "import os\n",
 | 
			
		||||
    "import sys\n",
 | 
			
		||||
    "import torch\n",
 | 
			
		||||
    "if torch.__version__=='1.6.0+cu101' and sys.platform.startswith('linux'):\n",
 | 
			
		||||
    "    !pip install pytorch3d\n",
 | 
			
		||||
    "else:\n",
 | 
			
		||||
    "    need_pytorch3d=False\n",
 | 
			
		||||
    "    try:\n",
 | 
			
		||||
    "        import pytorch3d\n",
 | 
			
		||||
    "    except ModuleNotFoundError:\n",
 | 
			
		||||
    "        need_pytorch3d=True\n",
 | 
			
		||||
    "    if need_pytorch3d:\n",
 | 
			
		||||
    "need_pytorch3d=False\n",
 | 
			
		||||
    "try:\n",
 | 
			
		||||
    "    import pytorch3d\n",
 | 
			
		||||
    "except ModuleNotFoundError:\n",
 | 
			
		||||
    "    need_pytorch3d=True\n",
 | 
			
		||||
    "if need_pytorch3d:\n",
 | 
			
		||||
    "    if torch.__version__.startswith(\"1.7\") and sys.platform.startswith(\"linux\"):\n",
 | 
			
		||||
    "        # We try to install PyTorch3D via a released wheel.\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",
 | 
			
		||||
    "        ])\n",
 | 
			
		||||
    "        !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
 | 
			
		||||
    "    else:\n",
 | 
			
		||||
    "        # We try to install PyTorch3D from source.\n",
 | 
			
		||||
    "        !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
 | 
			
		||||
    "        !tar xzf 1.10.0.tar.gz\n",
 | 
			
		||||
    "        os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
 | 
			
		||||
 | 
			
		||||
@ -38,7 +38,7 @@
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "## 0. Install and Import modules\n",
 | 
			
		||||
    "If `torch` and `pytorch3d` are not installed, run the following cell:"
 | 
			
		||||
    "Ensure `torch` and `torchvision` are installed. If `pytorch3d` is not installed, install it using the following cell:"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
@ -47,13 +47,29 @@
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "# !pip install torch\n",
 | 
			
		||||
    "# import sys\n",
 | 
			
		||||
    "# import torch\n",
 | 
			
		||||
    "# if torch.__version__=='1.6.0+cu101' and sys.platform.startswith('linux'):\n",
 | 
			
		||||
    "#     !pip install pytorch3d\n",
 | 
			
		||||
    "# else:\n",
 | 
			
		||||
    "#     !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
 | 
			
		||||
    "import os\n",
 | 
			
		||||
    "import sys\n",
 | 
			
		||||
    "import torch\n",
 | 
			
		||||
    "need_pytorch3d=False\n",
 | 
			
		||||
    "try:\n",
 | 
			
		||||
    "    import pytorch3d\n",
 | 
			
		||||
    "except ModuleNotFoundError:\n",
 | 
			
		||||
    "    need_pytorch3d=True\n",
 | 
			
		||||
    "if need_pytorch3d:\n",
 | 
			
		||||
    "    if torch.__version__.startswith(\"1.7\") and sys.platform.startswith(\"linux\"):\n",
 | 
			
		||||
    "        # We try to install PyTorch3D via a released wheel.\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",
 | 
			
		||||
    "        ])\n",
 | 
			
		||||
    "        !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
 | 
			
		||||
    "    else:\n",
 | 
			
		||||
    "        # We try to install PyTorch3D from source.\n",
 | 
			
		||||
    "        !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
 | 
			
		||||
    "        !tar xzf 1.10.0.tar.gz\n",
 | 
			
		||||
    "        os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
 | 
			
		||||
    "        !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
 | 
			
		||||
@ -46,8 +46,8 @@
 | 
			
		||||
    "id": "okLalbR_g7NS"
 | 
			
		||||
   },
 | 
			
		||||
   "source": [
 | 
			
		||||
    "If `torch`, `torchvision` and `pytorch3d` are not installed, run the following cell:"
 | 
			
		||||
   ]
 | 
			
		||||
     "Ensure `torch` and `torchvision` are installed. If `pytorch3d` is not installed, install it using the following cell:"
 | 
			
		||||
  ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
   "cell_type": "code",
 | 
			
		||||
@ -59,19 +59,25 @@
 | 
			
		||||
   },
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "!pip install torch torchvision\n",
 | 
			
		||||
    "import os\n",
 | 
			
		||||
    "import sys\n",
 | 
			
		||||
    "import torch\n",
 | 
			
		||||
    "if torch.__version__=='1.6.0+cu101' and sys.platform.startswith('linux'):\n",
 | 
			
		||||
    "    !pip install pytorch3d\n",
 | 
			
		||||
    "else:\n",
 | 
			
		||||
    "    need_pytorch3d=False\n",
 | 
			
		||||
    "    try:\n",
 | 
			
		||||
    "        import pytorch3d\n",
 | 
			
		||||
    "    except ModuleNotFoundError:\n",
 | 
			
		||||
    "        need_pytorch3d=True\n",
 | 
			
		||||
    "    if need_pytorch3d:\n",
 | 
			
		||||
    "need_pytorch3d=False\n",
 | 
			
		||||
    "try:\n",
 | 
			
		||||
    "    import pytorch3d\n",
 | 
			
		||||
    "except ModuleNotFoundError:\n",
 | 
			
		||||
    "    need_pytorch3d=True\n",
 | 
			
		||||
    "if need_pytorch3d:\n",
 | 
			
		||||
    "    if torch.__version__.startswith(\"1.7\") and sys.platform.startswith(\"linux\"):\n",
 | 
			
		||||
    "        # We try to install PyTorch3D via a released wheel.\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",
 | 
			
		||||
    "        ])\n",
 | 
			
		||||
    "        !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
 | 
			
		||||
    "    else:\n",
 | 
			
		||||
    "        # We try to install PyTorch3D from source.\n",
 | 
			
		||||
    "        !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
 | 
			
		||||
    "        !tar xzf 1.10.0.tar.gz\n",
 | 
			
		||||
    "        os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
 | 
			
		||||
 | 
			
		||||
@ -29,7 +29,7 @@
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "## 0. Install and Import modules\n",
 | 
			
		||||
    "If `torch` and `pytorch3d` are not installed, run the following cell:"
 | 
			
		||||
    "Ensure `torch` and `torchvision` are installed. If `pytorch3d` is not installed, install it using the following cell:"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
@ -38,13 +38,29 @@
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "# !pip install torch\n",
 | 
			
		||||
    "# import sys\n",
 | 
			
		||||
    "# import torch\n",
 | 
			
		||||
    "# if torch.__version__=='1.6.0+cu101' and sys.platform.startswith('linux'):\n",
 | 
			
		||||
    "#     !pip install pytorch3d\n",
 | 
			
		||||
    "# else:\n",
 | 
			
		||||
    "#     !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
 | 
			
		||||
    "import os\n",
 | 
			
		||||
    "import sys\n",
 | 
			
		||||
    "import torch\n",
 | 
			
		||||
    "need_pytorch3d=False\n",
 | 
			
		||||
    "try:\n",
 | 
			
		||||
    "    import pytorch3d\n",
 | 
			
		||||
    "except ModuleNotFoundError:\n",
 | 
			
		||||
    "    need_pytorch3d=True\n",
 | 
			
		||||
    "if need_pytorch3d:\n",
 | 
			
		||||
    "    if torch.__version__.startswith(\"1.7\") and sys.platform.startswith(\"linux\"):\n",
 | 
			
		||||
    "        # We try to install PyTorch3D via a released wheel.\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",
 | 
			
		||||
    "        ])\n",
 | 
			
		||||
    "        !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
 | 
			
		||||
    "    else:\n",
 | 
			
		||||
    "        # We try to install PyTorch3D from source.\n",
 | 
			
		||||
    "        !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
 | 
			
		||||
    "        !tar xzf 1.10.0.tar.gz\n",
 | 
			
		||||
    "        os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
 | 
			
		||||
    "        !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "If `torch`, `torchvision` and `pytorch3d` are not installed, run the following cell:"
 | 
			
		||||
    "Ensure `torch` and `torchvision` are installed. If `pytorch3d` is not installed, install it using the following cell:"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
@ -41,19 +41,25 @@
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "!pip install torch torchvision\n",
 | 
			
		||||
    "import os\n",
 | 
			
		||||
    "import sys\n",
 | 
			
		||||
    "import torch\n",
 | 
			
		||||
    "if torch.__version__=='1.6.0+cu101' and sys.platform.startswith('linux'):\n",
 | 
			
		||||
    "    !pip install pytorch3d\n",
 | 
			
		||||
    "else:\n",
 | 
			
		||||
    "    need_pytorch3d=False\n",
 | 
			
		||||
    "    try:\n",
 | 
			
		||||
    "        import pytorch3d\n",
 | 
			
		||||
    "    except ModuleNotFoundError:\n",
 | 
			
		||||
    "        need_pytorch3d=True\n",
 | 
			
		||||
    "    if need_pytorch3d:\n",
 | 
			
		||||
    "need_pytorch3d=False\n",
 | 
			
		||||
    "try:\n",
 | 
			
		||||
    "    import pytorch3d\n",
 | 
			
		||||
    "except ModuleNotFoundError:\n",
 | 
			
		||||
    "    need_pytorch3d=True\n",
 | 
			
		||||
    "if need_pytorch3d:\n",
 | 
			
		||||
    "    if torch.__version__.startswith(\"1.7\") and sys.platform.startswith(\"linux\"):\n",
 | 
			
		||||
    "        # We try to install PyTorch3D via a released wheel.\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",
 | 
			
		||||
    "        ])\n",
 | 
			
		||||
    "        !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
 | 
			
		||||
    "    else:\n",
 | 
			
		||||
    "        # We try to install PyTorch3D from source.\n",
 | 
			
		||||
    "        !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
 | 
			
		||||
    "        !tar xzf 1.10.0.tar.gz\n",
 | 
			
		||||
    "        os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
 | 
			
		||||
 | 
			
		||||
@ -39,7 +39,7 @@
 | 
			
		||||
   "cell_type": "markdown",
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "source": [
 | 
			
		||||
    "If torch, torchvision and PyTorch3D are not installed, run the following cell:"
 | 
			
		||||
    "Ensure `torch` and `torchvision` are installed. If `pytorch3d` is not installed, install it using the following cell:"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
@ -48,19 +48,25 @@
 | 
			
		||||
   "metadata": {},
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "!pip install torch torchvision\n",
 | 
			
		||||
    "import os\n",
 | 
			
		||||
    "import sys\n",
 | 
			
		||||
    "import torch\n",
 | 
			
		||||
    "if torch.__version__=='1.6.0+cu101' and sys.platform.startswith('linux'):\n",
 | 
			
		||||
    "    !pip install pytorch3d\n",
 | 
			
		||||
    "else:\n",
 | 
			
		||||
    "    need_pytorch3d=False\n",
 | 
			
		||||
    "    try:\n",
 | 
			
		||||
    "        import pytorch3d\n",
 | 
			
		||||
    "    except ModuleNotFoundError:\n",
 | 
			
		||||
    "        need_pytorch3d=True\n",
 | 
			
		||||
    "    if need_pytorch3d:\n",
 | 
			
		||||
    "need_pytorch3d=False\n",
 | 
			
		||||
    "try:\n",
 | 
			
		||||
    "    import pytorch3d\n",
 | 
			
		||||
    "except ModuleNotFoundError:\n",
 | 
			
		||||
    "    need_pytorch3d=True\n",
 | 
			
		||||
    "if need_pytorch3d:\n",
 | 
			
		||||
    "    if torch.__version__.startswith(\"1.7\") and sys.platform.startswith(\"linux\"):\n",
 | 
			
		||||
    "        # We try to install PyTorch3D via a released wheel.\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",
 | 
			
		||||
    "        ])\n",
 | 
			
		||||
    "        !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
 | 
			
		||||
    "    else:\n",
 | 
			
		||||
    "        # We try to install PyTorch3D from source.\n",
 | 
			
		||||
    "        !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
 | 
			
		||||
    "        !tar xzf 1.10.0.tar.gz\n",
 | 
			
		||||
    "        os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
 | 
			
		||||
 | 
			
		||||
@ -47,7 +47,7 @@
 | 
			
		||||
    "id": "okLalbR_g7NS"
 | 
			
		||||
   },
 | 
			
		||||
   "source": [
 | 
			
		||||
    "If `torch`, `torchvision` and `pytorch3d` are not installed, run the following cell:"
 | 
			
		||||
    "Ensure `torch` and `torchvision` are installed. If `pytorch3d` is not installed, install it using the following cell:"
 | 
			
		||||
   ]
 | 
			
		||||
  },
 | 
			
		||||
  {
 | 
			
		||||
@ -64,19 +64,25 @@
 | 
			
		||||
   },
 | 
			
		||||
   "outputs": [],
 | 
			
		||||
   "source": [
 | 
			
		||||
    "!pip install torch torchvision\n",
 | 
			
		||||
    "import os\n",
 | 
			
		||||
    "import sys\n",
 | 
			
		||||
    "import torch\n",
 | 
			
		||||
    "if torch.__version__=='1.6.0+cu101' and sys.platform.startswith('linux'):\n",
 | 
			
		||||
    "    !pip install pytorch3d\n",
 | 
			
		||||
    "else:\n",
 | 
			
		||||
    "    need_pytorch3d=False\n",
 | 
			
		||||
    "    try:\n",
 | 
			
		||||
    "        import pytorch3d\n",
 | 
			
		||||
    "    except ModuleNotFoundError:\n",
 | 
			
		||||
    "        need_pytorch3d=True\n",
 | 
			
		||||
    "    if need_pytorch3d:\n",
 | 
			
		||||
    "need_pytorch3d=False\n",
 | 
			
		||||
    "try:\n",
 | 
			
		||||
    "    import pytorch3d\n",
 | 
			
		||||
    "except ModuleNotFoundError:\n",
 | 
			
		||||
    "    need_pytorch3d=True\n",
 | 
			
		||||
    "if need_pytorch3d:\n",
 | 
			
		||||
    "    if torch.__version__.startswith(\"1.7\") and sys.platform.startswith(\"linux\"):\n",
 | 
			
		||||
    "        # We try to install PyTorch3D via a released wheel.\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",
 | 
			
		||||
    "        ])\n",
 | 
			
		||||
    "        !pip install pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
 | 
			
		||||
    "    else:\n",
 | 
			
		||||
    "        # We try to install PyTorch3D from source.\n",
 | 
			
		||||
    "        !curl -LO https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz\n",
 | 
			
		||||
    "        !tar xzf 1.10.0.tar.gz\n",
 | 
			
		||||
    "        os.environ[\"CUB_HOME\"] = os.getcwd() + \"/cub-1.10.0\"\n",
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user