mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-02 03:42:50 +08:00
Changed tutorials' pip searching
Summary: ### Generalise tutorials' pip searching: ## Required Information: This diff contains changes to several PyTorch3D tutorials. **Purpose of this diff:** Replace the current installation code with a more streamlined approach that tries to install the wheel first and falls back to installing from source if the wheel is not found. **Why this diff is required:** This diff makes it easier to cope with new PyTorch releases and reduce the need for manual intervention, as the current process involves checking the version of PyTorch in Colab and building a new wheel if it doesn't match the expected version, which generates additional work each time there is a a new PyTorch version in Colab. **Changes:** Before: ``` if torch.__version__.startswith("2.1.") and sys.platform.startswith("linux"): # We try to install PyTorch3D via a released wheel. pyt_version_str=torch.__version__.split("+")[0].replace(".", "") version_str="".join([ f"py3{sys.version_info.minor}_cu", torch.version.cuda.replace(".",""), f"_pyt{pyt_version_str}" ]) !pip install fvcore iopath !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html else: # We try to install PyTorch3D from source. !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable' ``` After: ``` pyt_version_str=torch.__version__.split("+")[0].replace(".", "") version_str="".join([ f"py3{sys.version_info.minor}_cu", torch.version.cuda.replace(".",""), f"_pyt{pyt_version_str}" ]) !pip install fvcore iopath if sys.platform.startswith("linux"): # We try to install PyTorch3D via a released wheel. !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html pip_list = !pip freeze need_pytorch3d = not any(i.startswith("pytorch3d==") for i in pip_list) if need_pytorch3d: # We try to install PyTorch3D from source. !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable' ``` Reviewed By: bottler Differential Revision: D55431832 fbshipit-source-id: a8de9162470698320241ae8401427dcb1ce17c37
This commit is contained in:
parent
b215776f2d
commit
31e3488a51
@ -83,25 +83,31 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
|
"import subprocess\n",
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" # We try to install PyTorch3D via a released wheel.\n",
|
" version_str=\"\".join([\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" version_str=\"\".join([\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" ])\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" !pip install fvcore iopath\n",
|
||||||
" ])\n",
|
" if sys.platform.startswith(\"linux\"):\n",
|
||||||
" !pip install fvcore iopath\n",
|
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" else:\n",
|
" pip_list = !pip freeze\n",
|
||||||
" # We try to install PyTorch3D from source.\n",
|
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
" if need_pytorch3d:\n",
|
||||||
|
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
||||||
|
"if need_pytorch3d:\n",
|
||||||
|
" print(\"Installing PyTorch3D from source\")\n",
|
||||||
|
" !pip install ninja\n",
|
||||||
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -70,25 +70,31 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
|
"import subprocess\n",
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" # We try to install PyTorch3D via a released wheel.\n",
|
" version_str=\"\".join([\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" version_str=\"\".join([\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" ])\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" !pip install fvcore iopath\n",
|
||||||
" ])\n",
|
" if sys.platform.startswith(\"linux\"):\n",
|
||||||
" !pip install fvcore iopath\n",
|
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" else:\n",
|
" pip_list = !pip freeze\n",
|
||||||
" # We try to install PyTorch3D from source.\n",
|
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
" if need_pytorch3d:\n",
|
||||||
|
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
||||||
|
"if need_pytorch3d:\n",
|
||||||
|
" print(\"Installing PyTorch3D from source\")\n",
|
||||||
|
" !pip install ninja\n",
|
||||||
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -45,25 +45,31 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
|
"import subprocess\n",
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" # We try to install PyTorch3D via a released wheel.\n",
|
" version_str=\"\".join([\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" version_str=\"\".join([\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" ])\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" !pip install fvcore iopath\n",
|
||||||
" ])\n",
|
" if sys.platform.startswith(\"linux\"):\n",
|
||||||
" !pip install fvcore iopath\n",
|
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" else:\n",
|
" pip_list = !pip freeze\n",
|
||||||
" # We try to install PyTorch3D from source.\n",
|
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
" if need_pytorch3d:\n",
|
||||||
|
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
||||||
|
"if need_pytorch3d:\n",
|
||||||
|
" print(\"Installing PyTorch3D from source\")\n",
|
||||||
|
" !pip install ninja\n",
|
||||||
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -84,25 +84,31 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
|
"import subprocess\n",
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" # We try to install PyTorch3D via a released wheel.\n",
|
" version_str=\"\".join([\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" version_str=\"\".join([\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" ])\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" !pip install fvcore iopath\n",
|
||||||
" ])\n",
|
" if sys.platform.startswith(\"linux\"):\n",
|
||||||
" !pip install fvcore iopath\n",
|
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" else:\n",
|
" pip_list = !pip freeze\n",
|
||||||
" # We try to install PyTorch3D from source.\n",
|
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
" if need_pytorch3d:\n",
|
||||||
|
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
||||||
|
"if need_pytorch3d:\n",
|
||||||
|
" print(\"Installing PyTorch3D from source\")\n",
|
||||||
|
" !pip install ninja\n",
|
||||||
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -50,25 +50,31 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
|
"import subprocess\n",
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" # We try to install PyTorch3D via a released wheel.\n",
|
" version_str=\"\".join([\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" version_str=\"\".join([\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" ])\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" !pip install fvcore iopath\n",
|
||||||
" ])\n",
|
" if sys.platform.startswith(\"linux\"):\n",
|
||||||
" !pip install fvcore iopath\n",
|
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" else:\n",
|
" pip_list = !pip freeze\n",
|
||||||
" # We try to install PyTorch3D from source.\n",
|
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
" if need_pytorch3d:\n",
|
||||||
|
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
||||||
|
"if need_pytorch3d:\n",
|
||||||
|
" print(\"Installing PyTorch3D from source\")\n",
|
||||||
|
" !pip install ninja\n",
|
||||||
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -62,25 +62,31 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
|
"import subprocess\n",
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" # We try to install PyTorch3D via a released wheel.\n",
|
" version_str=\"\".join([\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" version_str=\"\".join([\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" ])\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" !pip install fvcore iopath\n",
|
||||||
" ])\n",
|
" if sys.platform.startswith(\"linux\"):\n",
|
||||||
" !pip install fvcore iopath\n",
|
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" else:\n",
|
" pip_list = !pip freeze\n",
|
||||||
" # We try to install PyTorch3D from source.\n",
|
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
" if need_pytorch3d:\n",
|
||||||
|
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
||||||
|
"if need_pytorch3d:\n",
|
||||||
|
" print(\"Installing PyTorch3D from source\")\n",
|
||||||
|
" !pip install ninja\n",
|
||||||
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -41,25 +41,31 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
|
"import subprocess\n",
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" # We try to install PyTorch3D via a released wheel.\n",
|
" version_str=\"\".join([\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" version_str=\"\".join([\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" ])\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" !pip install fvcore iopath\n",
|
||||||
" ])\n",
|
" if sys.platform.startswith(\"linux\"):\n",
|
||||||
" !pip install fvcore iopath\n",
|
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" else:\n",
|
" pip_list = !pip freeze\n",
|
||||||
" # We try to install PyTorch3D from source.\n",
|
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
" if need_pytorch3d:\n",
|
||||||
|
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
||||||
|
"if need_pytorch3d:\n",
|
||||||
|
" print(\"Installing PyTorch3D from source\")\n",
|
||||||
|
" !pip install ninja\n",
|
||||||
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -72,25 +72,31 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
|
"import subprocess\n",
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" # We try to install PyTorch3D via a released wheel.\n",
|
" version_str=\"\".join([\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" version_str=\"\".join([\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" ])\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" !pip install fvcore iopath\n",
|
||||||
" ])\n",
|
" if sys.platform.startswith(\"linux\"):\n",
|
||||||
" !pip install fvcore iopath\n",
|
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" else:\n",
|
" pip_list = !pip freeze\n",
|
||||||
" # We try to install PyTorch3D from source.\n",
|
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
" if need_pytorch3d:\n",
|
||||||
|
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
||||||
|
"if need_pytorch3d:\n",
|
||||||
|
" print(\"Installing PyTorch3D from source\")\n",
|
||||||
|
" !pip install ninja\n",
|
||||||
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -66,25 +66,31 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
|
"import subprocess\n",
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" # We try to install PyTorch3D via a released wheel.\n",
|
" version_str=\"\".join([\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" version_str=\"\".join([\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" ])\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" !pip install fvcore iopath\n",
|
||||||
" ])\n",
|
" if sys.platform.startswith(\"linux\"):\n",
|
||||||
" !pip install fvcore iopath\n",
|
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" else:\n",
|
" pip_list = !pip freeze\n",
|
||||||
" # We try to install PyTorch3D from source.\n",
|
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
" if need_pytorch3d:\n",
|
||||||
|
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
||||||
|
"if need_pytorch3d:\n",
|
||||||
|
" print(\"Installing PyTorch3D from source\")\n",
|
||||||
|
" !pip install ninja\n",
|
||||||
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -44,25 +44,31 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
|
"import subprocess\n",
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" # We try to install PyTorch3D via a released wheel.\n",
|
" version_str=\"\".join([\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" version_str=\"\".join([\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" ])\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" !pip install fvcore iopath\n",
|
||||||
" ])\n",
|
" if sys.platform.startswith(\"linux\"):\n",
|
||||||
" !pip install fvcore iopath\n",
|
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" else:\n",
|
" pip_list = !pip freeze\n",
|
||||||
" # We try to install PyTorch3D from source.\n",
|
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
" if need_pytorch3d:\n",
|
||||||
|
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
||||||
|
"if need_pytorch3d:\n",
|
||||||
|
" print(\"Installing PyTorch3D from source\")\n",
|
||||||
|
" !pip install ninja\n",
|
||||||
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -51,25 +51,31 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
|
"import subprocess\n",
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" # We try to install PyTorch3D via a released wheel.\n",
|
" version_str=\"\".join([\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" version_str=\"\".join([\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" ])\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" !pip install fvcore iopath\n",
|
||||||
" ])\n",
|
" if sys.platform.startswith(\"linux\"):\n",
|
||||||
" !pip install fvcore iopath\n",
|
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" else:\n",
|
" pip_list = !pip freeze\n",
|
||||||
" # We try to install PyTorch3D from source.\n",
|
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
" if need_pytorch3d:\n",
|
||||||
|
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
||||||
|
"if need_pytorch3d:\n",
|
||||||
|
" print(\"Installing PyTorch3D from source\")\n",
|
||||||
|
" !pip install ninja\n",
|
||||||
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -67,25 +67,31 @@
|
|||||||
"import os\n",
|
"import os\n",
|
||||||
"import sys\n",
|
"import sys\n",
|
||||||
"import torch\n",
|
"import torch\n",
|
||||||
|
"import subprocess\n",
|
||||||
"need_pytorch3d=False\n",
|
"need_pytorch3d=False\n",
|
||||||
"try:\n",
|
"try:\n",
|
||||||
" import pytorch3d\n",
|
" import pytorch3d\n",
|
||||||
"except ModuleNotFoundError:\n",
|
"except ModuleNotFoundError:\n",
|
||||||
" need_pytorch3d=True\n",
|
" need_pytorch3d=True\n",
|
||||||
"if need_pytorch3d:\n",
|
"if need_pytorch3d:\n",
|
||||||
" if torch.__version__.startswith(\"2.2.\") and sys.platform.startswith(\"linux\"):\n",
|
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
||||||
" # We try to install PyTorch3D via a released wheel.\n",
|
" version_str=\"\".join([\n",
|
||||||
" pyt_version_str=torch.__version__.split(\"+\")[0].replace(\".\", \"\")\n",
|
" f\"py3{sys.version_info.minor}_cu\",\n",
|
||||||
" version_str=\"\".join([\n",
|
" torch.version.cuda.replace(\".\",\"\"),\n",
|
||||||
" f\"py3{sys.version_info.minor}_cu\",\n",
|
" f\"_pyt{pyt_version_str}\"\n",
|
||||||
" torch.version.cuda.replace(\".\",\"\"),\n",
|
" ])\n",
|
||||||
" f\"_pyt{pyt_version_str}\"\n",
|
" !pip install fvcore iopath\n",
|
||||||
" ])\n",
|
" if sys.platform.startswith(\"linux\"):\n",
|
||||||
" !pip install fvcore iopath\n",
|
" print(\"Trying to install wheel for PyTorch3D\")\n",
|
||||||
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
" !pip install --no-index --no-cache-dir pytorch3d -f https://dl.fbaipublicfiles.com/pytorch3d/packaging/wheels/{version_str}/download.html\n",
|
||||||
" else:\n",
|
" pip_list = !pip freeze\n",
|
||||||
" # We try to install PyTorch3D from source.\n",
|
" need_pytorch3d = not any(i.startswith(\"pytorch3d==\") for i in pip_list)\n",
|
||||||
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
" if need_pytorch3d:\n",
|
||||||
|
" print(f\"failed to find/install wheel for {version_str}\")\n",
|
||||||
|
"if need_pytorch3d:\n",
|
||||||
|
" print(\"Installing PyTorch3D from source\")\n",
|
||||||
|
" !pip install ninja\n",
|
||||||
|
" !pip install 'git+https://github.com/facebookresearch/pytorch3d.git@stable'"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user