diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ec256e8..4cc4dbc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 @@ -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: diff --git a/package.json b/package.json index 1b840f67..de2d9ed6 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/run_tests.sh b/scripts/run_tests.sh index 67895cb4..435f5a19 100644 --- a/scripts/run_tests.sh +++ b/scripts/run_tests.sh @@ -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 \ @@ -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 \ @@ -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 @@ -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 @@ -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 diff --git a/src/templates/template-vision-segmentation/models.py b/src/templates/template-vision-segmentation/models.py index ee5c8119..552e34a2 100644 --- a/src/templates/template-vision-segmentation/models.py +++ b/src/templates/template-vision-segmentation/models.py @@ -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)