Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated torch < 2.0.0. #525

Merged
merged 3 commits into from
Jun 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 3 additions & 43 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@ version: 2.1
# Executors
# -------------------------------------------------------------------------------------
executors:
gpu_cuda10:
environment:
CUDA_VERSION: "10.2"
CUDA_HOME: "/usr/local/cuda"
PYTHONUNBUFFERED: 1
machine:
image: ubuntu-2004:202107-02
resource_class: gpu.nvidia.small.multi # NVIDIA Tesla T4 2 GPU 4 vCPUs 15 GB RAM

gpu_cuda11:
environment:
CUDA_VERSION: "11.4"
Expand Down Expand Up @@ -103,35 +94,20 @@ setup_environment_310: &setup_environment_310
pip install --progress-bar off --upgrade pip
pip install --progress-bar off --upgrade setuptools

install_torch_cuda10: &install_torch_cuda10
- run:
name: Install Torch for cuda10
working_directory: ~/project
command: |
pip install --progress-bar off torch==1.12.1+cu102 torchvision==0.13.1+cu102 torchaudio==0.12.1+cu102 -f https://download.pytorch.org/whl/cu102/torch_stable.html
python -c 'import torch; print("Torch version:", torch.__version__); assert torch.cuda.is_available()'

install_torch_cuda11: &install_torch_cuda11
- run:
name: Install Torch for cuda11
working_directory: ~/project
command: |
pip install --progress-bar off torch==1.13.0 torchvision==0.14.0 torchaudio==0.13.0 --extra-index-url https://download.pytorch.org/whl/cu117
pip install --progress-bar off torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu117
python -c 'import torch; print("Torch version:", torch.__version__); assert torch.cuda.is_available()'

install_functorch_021: &install_functorch_021
- run:
name: Install Functorch
working_directory: ~/project
command: |
pip install functorch==0.2.1

install_torch: &install_torch
- run:
name: Install Torch
working_directory: ~/project
command: |
pip install torch==1.13.0
pip install torch

install_recent_cmake_2004: &install_recent_cmake_2004
- run:
Expand Down Expand Up @@ -230,7 +206,7 @@ build_cuda11_wheel: &build_cuda11_wheel
working_directory: /home/circleci
command: |
THESEUS_GIT_COMMIT=$(git --git-dir project/.git log --format="%H" -n 1)
THESEUS_VERSION=$(grep -Eo "[0-9].[0-9].[0-9][.0-9a-z]*" project/theseus/__init__.py)
THESEUS_VERSION=$(grep -Eo "[0-9].[0-9].[0-9][.0-9a-z]*" project/theseus/_version.py | tail -n 1)
./project/build_scripts/build_wheel.sh . ${THESEUS_GIT_COMMIT} 11.6 ${THESEUS_VERSION}
source ~/conda/bin/activate theseus
pip install $(ls */*.whl)
Expand Down Expand Up @@ -379,21 +355,6 @@ jobs:
- <<: *run_other_unit_tests

# ------- GPU only jobs -------
unittests_gpu17_cuda10:
executor: gpu_cuda10
steps:
- checkout
- <<: *update_and_install_python
- <<: *install_suitesparse
- <<: *setup_cuda10_libs
- <<: *setup_environment
- <<: *install_torch_cuda10
- <<: *install_functorch_021
- <<: *install_recent_cmake_2004
- <<: *build_baspacho_cuda
- <<: *setup_project
- <<: *run_gpu_tests

unittests_gpu17_cuda11:
executor: gpu_cuda11
steps:
Expand Down Expand Up @@ -426,7 +387,6 @@ workflows:
version: 2
build:
jobs:
- unittests_gpu17_cuda10
- unittests_gpu17_cuda11
- test_cuda11_wheel
- py38_precommit
Expand Down
6 changes: 3 additions & 3 deletions build_scripts/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
# ROOT_DIR: is the directory where the Dockerfile, tar.gz and .whl files will be stored
# (under a new subdirectory named theseus_docker_3.9)
# COMMIT: is a theseus commit hash or tag (e.g., 0.1.3).
# CUDA_VERSION: the version of CUDA to use. We have tested 10.2, 11.3, 11.6, and 11.7.
# CUDA_VERSION: the version of CUDA to use. We have tested 11.3, 11.6, and 11.7.
# You can also pass "cpu" to compile without CUDA extensions.
# THESEUS_VERSION: defaults to COMMIT, otherwise it must match the version in the commit.
# INCLUDE_LABS: if !=0, the compiled wheel also includes Theseus Labs.
# For example
# ./build_scripts/build_wheel.sh . 0.1.0 10.2
# ./build_scripts/build_wheel.sh . 0.1.4 11.3
# NIGHTLY: if !=0, compiles a wheel for the nightly package (forces INCLUDE_LABS=1).
# THESEUS_VERSION and COMMIT are also ignored, since version is set to YYYY.MM.DD.
# and commit is set to `main`.
Expand Down Expand Up @@ -57,7 +57,7 @@ else
GIT_CMD="git checkout ${COMMIT} -b tmp_build"
fi

SUPPORTED_CUDA_VERSIONS="10.2 11.3 11.6 11.7"
SUPPORTED_CUDA_VERSIONS="11.3 11.6 11.7"
CUDA_VERSION_IS_SUPPORTED=$(echo "cpu ${SUPPORTED_CUDA_VERSIONS}" | grep -w ${CUDA_VERSION})
[ "${CUDA_VERSION_IS_SUPPORTED}" ] || die "CUDA_VERSION must be one of (cpu ${SUPPORTED_CUDA_VERSIONS})"

Expand Down
1 change: 0 additions & 1 deletion requirements/main.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ scipy>=1.5.3
scikit-sparse>=0.4.5
pytest>=6.2.1
pybind11>=2.7.1
functorch==0.2.1 # > 0.2.1 will install torch1.13, which breaks CUDA 10.2
semantic-version==2.10.0
torchlie
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ def maybe_create_baspacho_extension(has_cuda):
if is_nightly:
version = nightly_date_str
else:
with open(Path("theseus") / "__init__.py", "r") as f:
with open(Path("theseus") / "_version.py", "r") as f:
for line in f:
if "__version__" in line:
if "__version__ = " in line:
version = line.split("__version__ = ")[1].rstrip().strip('"')

with open("README.md", "r") as fh:
Expand Down
2 changes: 1 addition & 1 deletion theseus/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
__version__ = "0.1.4"
from ._version import __version__

from .constants import DeviceType as DeviceType

Expand Down
13 changes: 13 additions & 0 deletions theseus/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import warnings

from torch import __version__ as _torch_version
from semantic_version import Version

if Version(_torch_version) < Version("2.0.0"):
warnings.warn(
"Using torch < 2.0 is deprecated and support will be discontinued "
mhmukadam marked this conversation as resolved.
Show resolved Hide resolved
" in future releases.",
FutureWarning,
)

__version__ = "0.2.0.dev0"
6 changes: 5 additions & 1 deletion theseus/core/cost_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@

import torch
import torch.autograd.functional as autogradF
from functorch import jacrev, vmap

try:
from torch.func import jacrev, vmap
except ModuleNotFoundError:
from functorch import jacrev, vmap # type: ignore
mhmukadam marked this conversation as resolved.
Show resolved Hide resolved
from typing_extensions import Protocol

from theseus.geometry import Manifold
Expand Down