Skip to content

ci: split workflow into several jobs, exclude launch for vision tasks #175

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

Merged
merged 14 commits into from
Sep 13, 2021
32 changes: 17 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,24 @@ jobs:
runs-on: ${{ matrix.os }}
env:
RUN_SLOW_TESTS: 1
OMP_NUM_THREADS: 1
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
template:
[
text-classification,
vision-dcgan,
vision-classification,
vision-segmentation
]
test: [all, simple, launch, spawn]
exclude:
- template: vision-classification
test: launch
- template: vision-segmentation
test: launch
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
Expand Down Expand Up @@ -47,7 +61,7 @@ jobs:
- name: Install dependencies
run: |
pip install wheel setuptools pip -Uqq
pip install -r ./scripts/requirements.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html --progress-bar off
pip install -r ./scripts/requirements.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html -q
pip uninstall -y tqdm
npm i -g pnpm
pnpm i --frozen-lockfile --color
Expand All @@ -61,22 +75,10 @@ jobs:
- run: pnpm test:ci
- run: sh ./scripts/run_tests.sh unzip

- name: Run all
run: sh ./scripts/run_tests.sh all
- name: 'Run ${{ matrix.template }} ${{ matrix.test }}'
run: sh ./scripts/run_tests.sh ${{ matrix.test }} ${{ matrix.template }}
if: github.event_name != 'schedule'

- name: Run simple
run: sh ./scripts/run_tests.sh simple
if: github.event_name != 'schedule'

- name: Run launch
run: sh ./scripts/run_tests.sh launch
if: github.event_name == 'schedule'

- name: Run spawn
run: sh ./scripts/run_tests.sh spawn
if: github.event_name == 'schedule'

lint:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"dev": "vite",
"build": "vite build",
"serve": "vite preview",
"test": "jest --color",
"test": "jest --color --runInBand",
"test:ci": "start-server-and-test serve 5000 test",
"release": "node scripts/release.js",
"fmt": "prettier --write . && bash scripts/run_code_style.sh fmt",
Expand Down
32 changes: 16 additions & 16 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ unzip_all() {
}

run_simple() {
for dir in $(find ./dist-tests/*-simple -type d)
for dir in $(find ./dist-tests/$1-simple -type d)
do
cd $dir
python main.py --data_path ~/data \
--train_batch_size 4 \
--eval_batch_size 4 \
--train_batch_size 2 \
--eval_batch_size 2 \
--num_workers 2 \
--max_epochs 2 \
--train_epoch_length 4 \
Expand All @@ -30,13 +30,13 @@ run_simple() {
}

run_all() {
for dir in $(find ./dist-tests/*-all -type d)
for dir in $(find ./dist-tests/$1-all -type d)
do
cd $dir
pytest -vra --color=yes --tb=short test_*.py
python main.py --data_path ~/data \
--train_batch_size 4 \
--eval_batch_size 4 \
--train_batch_size 2 \
--eval_batch_size 2 \
--num_workers 2 \
--max_epochs 2 \
--train_epoch_length 4 \
Expand All @@ -46,15 +46,15 @@ run_all() {
}

run_launch() {
for dir in $(find ./dist-tests/*-launch -type d)
for dir in $(find ./dist-tests/$1-launch -type d)
do
cd $dir
python -m torch.distributed.launch \
--nproc_per_node 2 --use_env \
main.py --backend gloo --data_path ~/data \
--train_batch_size 4 \
--eval_batch_size 4 \
--num_workers 2 \
--train_batch_size 2 \
--eval_batch_size 2 \
--num_workers 1 \
--max_epochs 2 \
--train_epoch_length 4 \
--eval_epoch_length 4
Expand All @@ -63,14 +63,14 @@ run_launch() {
}

run_spawn() {
for dir in $(find ./dist-tests/*-spawn -type d)
for dir in $(find ./dist-tests/$1-spawn -type d)
do
cd $dir
python main.py --data_path ~/data \
--nproc_per_node 2 --backend gloo \
--train_batch_size 4 \
--eval_batch_size 4 \
--num_workers 2 \
--num_workers 1 \
--max_epochs 2 \
--train_epoch_length 4 \
--eval_epoch_length 4
Expand All @@ -81,11 +81,11 @@ run_spawn() {
if [ $1 = "unzip" ]; then
unzip_all
elif [ $1 = "simple" ]; then
run_simple
run_simple $2
elif [ $1 = "all" ]; then
run_all
run_all $2
elif [ $1 = "launch" ]; then
run_launch
run_launch $2
elif [ $1 = "spawn" ]; then
run_spawn
run_spawn $2
fi
4 changes: 2 additions & 2 deletions src/templates/template-vision-segmentation/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from torchvision.models.segmentation import deeplabv3_resnet101
from torchvision.models.segmentation import deeplabv3_resnet50


def setup_model(config):
return deeplabv3_resnet101(num_classes=config.num_classes)
return deeplabv3_resnet50(num_classes=config.num_classes)