diff --git a/docs/tutorials/README.md b/docs/tutorials/README.md index e3c999ab..ecb7d5f6 100644 --- a/docs/tutorials/README.md +++ b/docs/tutorials/README.md @@ -8,11 +8,17 @@ 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 -`!pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'` +PyTorch3D from source inside colab, you can use +``` +import os +!curl -O https://github.com/NVIDIA/cub/archive/1.10.0.tar.gz +!tar xzf 1.10.0.tar.gz +os.environ["CUB_HOME"] = os.getcwd() + "/cub-1.10.0" +!pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'` +``` instead. The versions of these tutorials on the main branch may need to use the latest -pytorch3d from the main branch. You may be able to install this from source -with +PyTorch3D from the main branch. You may be able to install this from source +with the same commands as above, but replacing the last line with `!pip install 'git+https://github.com/facebookresearch/pytorch3d.git'`. diff --git a/docs/tutorials/bundle_adjustment.ipynb b/docs/tutorials/bundle_adjustment.ipynb index 67862446..0e1b239f 100644 --- a/docs/tutorials/bundle_adjustment.ipynb +++ b/docs/tutorials/bundle_adjustment.ipynb @@ -81,12 +81,22 @@ "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", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " need_pytorch3d=False\n", + " try:\n", + " import pytorch3d\n", + " except ModuleNotFoundError:\n", + " need_pytorch3d=True\n", + " if need_pytorch3d:\n", + " !curl -O 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'" ] }, { diff --git a/docs/tutorials/camera_position_optimization_with_differentiable_rendering.ipynb b/docs/tutorials/camera_position_optimization_with_differentiable_rendering.ipynb index 2c83027a..533de740 100644 --- a/docs/tutorials/camera_position_optimization_with_differentiable_rendering.ipynb +++ b/docs/tutorials/camera_position_optimization_with_differentiable_rendering.ipynb @@ -68,12 +68,22 @@ "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", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " need_pytorch3d=False\n", + " try:\n", + " import pytorch3d\n", + " except ModuleNotFoundError:\n", + " need_pytorch3d=True\n", + " if need_pytorch3d:\n", + " !curl -O 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'" ] }, { diff --git a/docs/tutorials/dataloaders_ShapeNetCore_R2N2.ipynb b/docs/tutorials/dataloaders_ShapeNetCore_R2N2.ipynb index 15c3f9e0..e2643983 100644 --- a/docs/tutorials/dataloaders_ShapeNetCore_R2N2.ipynb +++ b/docs/tutorials/dataloaders_ShapeNetCore_R2N2.ipynb @@ -43,12 +43,22 @@ "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", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " need_pytorch3d=False\n", + " try:\n", + " import pytorch3d\n", + " except ModuleNotFoundError:\n", + " need_pytorch3d=True\n", + " if need_pytorch3d:\n", + " !curl -O 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'" ] }, { diff --git a/docs/tutorials/deform_source_mesh_to_target_mesh.ipynb b/docs/tutorials/deform_source_mesh_to_target_mesh.ipynb index f6a83206..8f5b59d5 100644 --- a/docs/tutorials/deform_source_mesh_to_target_mesh.ipynb +++ b/docs/tutorials/deform_source_mesh_to_target_mesh.ipynb @@ -82,12 +82,22 @@ "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", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " need_pytorch3d=False\n", + " try:\n", + " import pytorch3d\n", + " except ModuleNotFoundError:\n", + " need_pytorch3d=True\n", + " if need_pytorch3d:\n", + " !curl -O 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'" ] }, { diff --git a/docs/tutorials/fit_textured_mesh.ipynb b/docs/tutorials/fit_textured_mesh.ipynb index b751dc3a..9685f954 100644 --- a/docs/tutorials/fit_textured_mesh.ipynb +++ b/docs/tutorials/fit_textured_mesh.ipynb @@ -60,12 +60,22 @@ "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", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " need_pytorch3d=False\n", + " try:\n", + " import pytorch3d\n", + " except ModuleNotFoundError:\n", + " need_pytorch3d=True\n", + " if need_pytorch3d:\n", + " !curl -O 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'" ] }, { diff --git a/docs/tutorials/render_colored_points.ipynb b/docs/tutorials/render_colored_points.ipynb index 7f13afe5..a1e7d329 100644 --- a/docs/tutorials/render_colored_points.ipynb +++ b/docs/tutorials/render_colored_points.ipynb @@ -42,12 +42,22 @@ "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", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " need_pytorch3d=False\n", + " try:\n", + " import pytorch3d\n", + " except ModuleNotFoundError:\n", + " need_pytorch3d=True\n", + " if need_pytorch3d:\n", + " !curl -O 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'" ] }, { diff --git a/docs/tutorials/render_densepose.ipynb b/docs/tutorials/render_densepose.ipynb index 54e77324..a314d9c9 100644 --- a/docs/tutorials/render_densepose.ipynb +++ b/docs/tutorials/render_densepose.ipynb @@ -49,13 +49,31 @@ "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", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'\n", - "# we also install chumpy as it is needed to load the SMPL model pickle file\n", + " need_pytorch3d=False\n", + " try:\n", + " import pytorch3d\n", + " except ModuleNotFoundError:\n", + " need_pytorch3d=True\n", + " if need_pytorch3d:\n", + " !curl -O 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'" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# We also install chumpy as it is needed to load the SMPL model pickle file.\n", "!pip install chumpy" ] }, diff --git a/docs/tutorials/render_textured_meshes.ipynb b/docs/tutorials/render_textured_meshes.ipynb index e6f9c5f9..7f3c5d4a 100644 --- a/docs/tutorials/render_textured_meshes.ipynb +++ b/docs/tutorials/render_textured_meshes.ipynb @@ -65,12 +65,22 @@ "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", - " !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'" + " need_pytorch3d=False\n", + " try:\n", + " import pytorch3d\n", + " except ModuleNotFoundError:\n", + " need_pytorch3d=True\n", + " if need_pytorch3d:\n", + " !curl -O 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'" ] }, {