Skip to content

Commit

Permalink
update pytorch version
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: facebookresearch#2695

Reviewed By: alexander-kirillov

Differential Revision: D26837925

fbshipit-source-id: 04ac322ad191c5ed33733cd93044565562f48790
  • Loading branch information
ppwwyyxx authored and facebook-github-bot committed Mar 5, 2021
1 parent 6081ee5 commit ef2cd13
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 22 deletions.
21 changes: 11 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,17 @@ jobs:
- <<: *setup_venv

# Cache the venv directory that contains dependencies
# Refresh the key when dependencies should be updated (e.g. when pytorch releases)
- restore_cache:
keys:
- cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20201027
- cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210304

- <<: *install_linux_dep

- save_cache:
paths:
- ~/venv
key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20201027
key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210304

- <<: *install_detectron2
- <<: *run_unittests
Expand All @@ -164,15 +165,15 @@ jobs:
# Cache the directory that contains python and dependencies
- restore_cache:
keys:
- cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20201027
- cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210304

- <<: *install_python
- <<: *install_linux_dep

- save_cache:
paths:
- /opt/circleci/.pyenv
key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20201027
key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210304

- <<: *install_detectron2
- <<: *run_unittests
Expand All @@ -188,7 +189,7 @@ jobs:
# Cache the env directory that contains dependencies
- restore_cache:
keys:
- cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20201027
- cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210304

- run:
name: Install Dependencies
Expand All @@ -202,7 +203,7 @@ jobs:
- save_cache:
paths:
- env
key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20201027
key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210304

- <<: *install_detectron2
# TODO: unittest fails for now
Expand All @@ -212,9 +213,9 @@ workflows:
regular_test:
jobs:
- linux_cpu_tests:
name: linux_cpu_tests_pytorch1.7
pytorch_version: '1.7+cpu'
torchvision_version: '0.8.1+cpu'
name: linux_cpu_tests_pytorch1.8
pytorch_version: '1.8+cpu'
torchvision_version: '0.9+cpu'
context:
- DOCKERHUB_TOKEN
- linux_gpu_tests:
Expand All @@ -228,5 +229,5 @@ workflows:
- linux_gpu_tests:
name: linux_gpu_tests_pytorch1.8
pytorch_version: '1.8+cu101'
torchvision_version: 'master'
torchvision_version: '0.9+cu101'
- windows_cpu_build
4 changes: 3 additions & 1 deletion .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ jobs:
strategy:
fail-fast: false
matrix:
torch: [1.6, 1.7]
torch: [1.6, 1.7, 1.8]
include:
- torch: 1.6
torchvision: 0.7
- torch: 1.7
torchvision: 0.8
- torch: 1.8
torchvision: 0.9
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
12 changes: 11 additions & 1 deletion dev/packaging/build_all_wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ build_one() {

echo "Launching container $container_name ..."

for py in 3.6 3.7 3.8; do
py_versions=(3.6 3.7 3.8)
if [[ $pytorch_ver == "1.8" ]]; then
py_versions+=(3.9)
fi

for py in "${py_versions[@]}"; do
docker run -itd \
--name $container_name \
--mount type=bind,source="$(pwd)",target=/detectron2 \
Expand All @@ -46,6 +51,11 @@ EOF
if [[ -n "$1" ]] && [[ -n "$2" ]]; then
build_one "$1" "$2"
else
build_one cu111 1.8
build_one cu102 1.8
build_one cu101 1.8
build_one cpu 1.8

build_one cu110 1.7
build_one cu102 1.7
build_one cu101 1.7
Expand Down
10 changes: 9 additions & 1 deletion dev/packaging/pkg_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ setup_cuda() {
# See more details at https://github.com/pytorch/pytorch/blob/master/torch/utils/cpp_extension.py#L1363
export FORCE_CUDA=1
case "$CU_VERSION" in
cu112)
export CUDA_HOME=/usr/local/cuda-11.2/
export TORCH_CUDA_ARCH_LIST="3.7;5.0;5.2;6.0+PTX;6.1+PTX;7.0+PTX;7.5+PTX;8.0+PTX;8.6+PTX"
;;
cu111)
export CUDA_HOME=/usr/local/cuda-11.1/
export TORCH_CUDA_ARCH_LIST="3.7;5.0;5.2;6.0+PTX;6.1+PTX;7.0+PTX;7.5+PTX;8.0+PTX;8.6+PTX"
;;
cu110)
export CUDA_HOME=/usr/local/cuda-11.0/
# NOTE: may need to add 8.6 in the next ver
export TORCH_CUDA_ARCH_LIST="3.7;5.0;5.2;6.0+PTX;6.1+PTX;7.0+PTX;7.5+PTX;8.0+PTX"
;;
cu102)
Expand Down Expand Up @@ -54,6 +61,7 @@ setup_wheel_python() {
3.6) python_abi=cp36-cp36m ;;
3.7) python_abi=cp37-cp37m ;;
3.8) python_abi=cp38-cp38 ;;
3.9) python_abi=cp39-cp39 ;;
*)
echo "Unrecognized PYTHON_VERSION=$PYTHON_VERSION"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ RUN wget https://bootstrap.pypa.io/get-pip.py && \
# install dependencies
# See https://pytorch.org/ for other options if you use a different version of CUDA
RUN pip install --user tensorboard cmake # cmake from apt-get is too old
RUN pip install --user torch==1.7.1 torchvision==0.8.2 -f https://download.pytorch.org/whl/cu101/torch_stable.html
RUN pip install --user torch==1.8 torchvision==0.9 -f https://download.pytorch.org/whl/cu101/torch_stable.html

RUN pip install --user 'git+https://github.com/facebookresearch/fvcore'
# install detectron2
Expand Down
2 changes: 1 addition & 1 deletion docker/deploy.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN export CXXFLAGS=-D_GLIBCXX_USE_CXX11_ABI=$(python3 -c 'import torch; print(i
./configure --prefix=$HOME/.local && make && make install

# install libtorchvision
RUN git clone --branch v0.8.2 https://github.com/pytorch/vision/
RUN git clone --branch v0.9 https://github.com/pytorch/vision/
RUN mkdir vision/build && cd vision/build && \
cmake .. -DCMAKE_INSTALL_PREFIX=$HOME/.local -DCMAKE_BUILD_TYPE=Release -DWITH_CUDA=on -DTORCH_CUDA_ARCH_LIST=$TORCH_CUDA_ARCH_LIST && \
make && make install
Expand Down
30 changes: 23 additions & 7 deletions docs/tutorials/extend.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ which is a challenge for any research engineering project of a significant size:
In detectron2, there are two types of interfaces that address this tension together:

1. Functions and classes that take a config (`cfg`) argument
(sometimes with only a few extra arguments).
(sometimes with few extra arguments).

Such functions and classes implement
the "standard default" behavior: it will read what it needs from the
Expand All @@ -33,12 +33,28 @@ In detectron2, there are two types of interfaces that address this tension toget
When you need to implement something not supported by the "standard defaults"
included in detectron2, these well-defined components can be reused.

3. A few classes are implemented with the
[@configurable](../../modules/config.html#detectron2.config.configurable)
decorator - they can be called with either a config, or with explicit arguments.
Their explicit argument interfaces are currently __experimental__ and subject to change.
3. A few functions and classes are implemented with the
[@configurable](../modules/config.html#detectron2.config.configurable)
decorator - they can be called with either a config, or with explicit arguments, or a mixture of both.
Their explicit argument interfaces are currently experimental.

As an example, a Mask R-CNN model can be built like this:
As an example, a Mask R-CNN model can be built in the following ways:

1. Config-only:
```python
# load proper config file, then
model = build_model(cfg)
```

2. Mixture of config and additional argument overrides:
```python
model = GeneralizedRCNN(
cfg,
roi_heads=StandardROIHeads(cfg, batch_size_per_image=666),
pixel_std=[57.0, 57.0, 57.0])
```

3. Full explicit arguments:
<details>
<summary>
(click to expand)
Expand Down Expand Up @@ -103,7 +119,7 @@ In detectron2, there are two types of interfaces that address this tension toget
)
```

</details>
</details>


If you only need the standard behavior, the [Beginner's Tutorial](./getting_started.md)
Expand Down

0 comments on commit ef2cd13

Please sign in to comment.