Skip to content

Commit ea3b3f2

Browse files
ppwwyyxxfacebook-github-bot
authored andcommitted
add python 3.9 to CircleCI
Summary: Pull Request resolved: facebookresearch#3410 avoid bugs like the last diff Reviewed By: zhanghang1989 Differential Revision: D30599205 fbshipit-source-id: 3b2abd2885d384bd3f2a29b454d3da5e023e01a3
1 parent b9d83a3 commit ea3b3f2

File tree

2 files changed

+32
-21
lines changed

2 files changed

+32
-21
lines changed

.circleci/config.yml

+30-19
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ windows-cpu: &windows_cpu
2626
# resource_class: windows.gpu.nvidia.medium
2727
# image: windows-server-2019-nvidia:stable
2828

29-
pytorch_parameters: &pytorch_parameters
29+
version_parameters: &version_parameters
3030
parameters:
3131
pytorch_version:
3232
type: string
@@ -37,11 +37,15 @@ pytorch_parameters: &pytorch_parameters
3737
# use test wheels index to have access to RC wheels
3838
# https://download.pytorch.org/whl/test/torch_test.html
3939
default: "https://download.pytorch.org/whl/torch_stable.html"
40+
python_version: # NOTE: only affect linux
41+
type: string
42+
default: '3.6.8'
4043

4144
environment:
4245
PYTORCH_VERSION: << parameters.pytorch_version >>
4346
TORCHVISION_VERSION: << parameters.torchvision_version >>
4447
PYTORCH_INDEX: << parameters.pytorch_index >>
48+
PYTHON_VERSION: << parameters.python_version>>
4549

4650
# -------------------------------------------------------------------------------------
4751
# Re-usable commands
@@ -66,8 +70,10 @@ install_python: &install_python
6670
name: Install Python
6771
working_directory: ~/
6872
command: |
69-
pyenv install -s 3.6.8
70-
pyenv global 3.6.8
73+
# upgrade pyenv
74+
cd /opt/circleci/.pyenv/plugins/python-build/../.. && git pull && cd -
75+
pyenv install -s $PYTHON_VERSION
76+
pyenv global $PYTHON_VERSION
7177
python --version
7278
which python
7379
pip install --upgrade pip
@@ -118,6 +124,8 @@ install_detectron2: &install_detectron2
118124
- run:
119125
name: Install Detectron2
120126
command: |
127+
# Remove if it's in cache
128+
pip uninstall -y detectron2
121129
pip install --progress-bar off -e .[all]
122130
python -m detectron2.utils.collect_env
123131
@@ -133,58 +141,58 @@ run_unittests: &run_unittests
133141
jobs:
134142
linux_cpu_tests:
135143
<<: *cpu
136-
<<: *pytorch_parameters
144+
<<: *version_parameters
137145

138146
working_directory: ~/detectron2
139147

140148
steps:
141149
- checkout
142150

143-
# Cache the venv directory that contains dependencies
151+
# Cache the venv directory that contains python, dependencies, and checkpoints
144152
# Refresh the key when dependencies should be updated (e.g. when pytorch releases)
145153
- restore_cache:
146154
keys:
147-
- cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210802
155+
- cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210827
148156

149157
- <<: *install_python
150158
- <<: *install_linux_dep
159+
- <<: *install_detectron2
160+
- <<: *run_unittests
151161

152162
- save_cache:
153163
paths:
154164
- /opt/circleci/.pyenv
155-
key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210802
165+
- ~/.torch
166+
key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210827
156167

157-
- <<: *install_detectron2
158-
- <<: *run_unittests
159168

160169
linux_gpu_tests:
161170
<<: *gpu
162-
<<: *pytorch_parameters
171+
<<: *version_parameters
163172

164173
working_directory: ~/detectron2
165174

166175
steps:
167176
- checkout
168177

169-
# Cache the directory that contains python and dependencies
170178
- restore_cache:
171179
keys:
172-
- cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210404
180+
- cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210827
173181

174182
- <<: *install_python
175183
- <<: *install_linux_dep
184+
- <<: *install_detectron2
185+
- <<: *run_unittests
176186

177187
- save_cache:
178188
paths:
179189
- /opt/circleci/.pyenv
180-
key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210404
181-
182-
- <<: *install_detectron2
183-
- <<: *run_unittests
190+
- ~/.torch
191+
key: cache-{{ arch }}-<< parameters.pytorch_version >>-{{ .Branch }}-20210827
184192

185193
windows_cpu_build:
186194
<<: *windows_cpu
187-
<<: *pytorch_parameters
195+
<<: *version_parameters
188196
steps:
189197
- <<: *add_ssh_keys
190198
- checkout
@@ -221,8 +229,6 @@ workflows:
221229
name: linux_cpu_tests_pytorch1.9
222230
pytorch_version: '1.9.0+cpu'
223231
torchvision_version: '0.10.0+cpu'
224-
context:
225-
- DOCKERHUB_TOKEN
226232
- linux_gpu_tests:
227233
name: linux_gpu_tests_pytorch1.7
228234
pytorch_version: '1.7.0'
@@ -237,6 +243,11 @@ workflows:
237243
name: linux_gpu_tests_pytorch1.9
238244
pytorch_version: '1.9+cu102'
239245
torchvision_version: '0.10+cu102'
246+
- linux_gpu_tests:
247+
name: linux_gpu_tests_pytorch1.9_python39
248+
pytorch_version: '1.9+cu102'
249+
torchvision_version: '0.10+cu102'
250+
python_version: '3.9.6'
240251
- windows_cpu_build:
241252
pytorch_version: '1.9+cpu'
242253
torchvision_version: '0.10+cpu'

tests/test_export_torchscript.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"""
3434

3535

36-
@unittest.skipIf(os.environ.get("CI") or TORCH_VERSION < (1, 8), "Insufficient Pytorch version")
36+
@unittest.skipIf(TORCH_VERSION < (1, 8), "Insufficient Pytorch version")
3737
class TestScripting(unittest.TestCase):
3838
def testMaskRCNNFPN(self):
3939
self._test_rcnn_model("COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml")
@@ -86,7 +86,7 @@ def _test_retinanet_model(self, config_path):
8686
# https://github.com/pytorch/pytorch/issues/46944
8787

8888

89-
@unittest.skipIf(os.environ.get("CI") or TORCH_VERSION < (1, 8), "Insufficient Pytorch version")
89+
@unittest.skipIf(TORCH_VERSION < (1, 8), "Insufficient Pytorch version")
9090
class TestTracing(unittest.TestCase):
9191
def testMaskRCNNFPN(self):
9292
# TODO: this test requires manifold access, see: T88318502

0 commit comments

Comments
 (0)