File tree Expand file tree Collapse file tree 8 files changed +46
-13
lines changed
template-text-classification
template-vision-classification
template-vision-segmentation Expand file tree Collapse file tree 8 files changed +46
-13
lines changed Original file line number Diff line number Diff line change 47
47
- name : Install dependencies
48
48
run : |
49
49
pip install wheel setuptools pip -Uqq
50
- pip install --pre pytorch-ignite
51
50
pip install -r ./scripts/requirements.txt -f https://download.pytorch.org/whl/cpu/torch_stable.html --progress-bar off
52
51
pip uninstall -y tqdm
53
52
npm i -g pnpm
98
97
restore-keys : |
99
98
pnpm-and-pip-cache-
100
99
101
- - run : pip install -Uq pip wheel && pip install -Uq "black==20.8b1" "isort==5.7.0"
100
+ - run : pip install -Uq pip wheel && sh scripts/run_code_style.sh install
102
101
- run : npm i -g pnpm
103
102
- run : pnpm i --frozen-lockfile --color
104
103
- run : pnpm lint
Original file line number Diff line number Diff line change @@ -5,9 +5,10 @@ set -xeu
5
5
if [ $1 == " lint" ]; then
6
6
black . -l 80 --check
7
7
isort . --profile black --check
8
+ flake8 --select F401 . # find unused imports
8
9
elif [ $1 == " fmt" ]; then
9
10
isort . --profile black
10
11
black . -l 80
11
12
elif [ $1 == " install" ]; then
12
- pip install " black==20.8b1" " isort==5.7.0"
13
+ pip install " black==20.8b1" " isort==5.7.0" flake8
13
14
fi
Original file line number Diff line number Diff line change 4
4
5
5
#::: if (it.logger) { :::#
6
6
if rank == 0 :
7
- exp_logger .close ()
7
+ from ignite .contrib .handlers .wandb_logger import WandBLogger
8
+
9
+ if isinstance (exp_logger , WandBLogger ):
10
+ # why handle differently for wandb?
11
+ # See: https://github.com/pytorch/ignite/issues/1894
12
+ exp_logger .finish ()
13
+ elif exp_logger :
14
+ exp_logger .close ()
8
15
#::: } :::#
9
16
10
17
#::: if (it.save_training || it.save_evaluation) { :::#
Original file line number Diff line number Diff line change 5
5
import ignite .distributed as idist
6
6
import yaml
7
7
from data import setup_data
8
+ from ignite .contrib .handlers import LRScheduler , PiecewiseLinear
8
9
from ignite .engine import Events
9
- from ignite .handlers .param_scheduler import LRScheduler , PiecewiseLinear
10
10
from ignite .metrics import Accuracy , Loss
11
11
from ignite .utils import manual_seed
12
12
from models import TransformerModel
@@ -157,7 +157,14 @@ def _():
157
157
#::: if (it.logger) { :::#
158
158
# close logger
159
159
if rank == 0 :
160
- exp_logger .close ()
160
+ from ignite .contrib .handlers .wandb_logger import WandBLogger
161
+
162
+ if isinstance (exp_logger , WandBLogger ):
163
+ # why handle differently for wandb?
164
+ # See: https://github.com/pytorch/ignite/issues/1894
165
+ exp_logger .finish ()
166
+ elif exp_logger :
167
+ exp_logger .close ()
161
168
#::: } :::#
162
169
#
163
170
#::: if (it.save_training || it.save_evaluation) { :::#
Original file line number Diff line number Diff line change @@ -113,7 +113,14 @@ def _():
113
113
#::: if (it.logger) { :::#
114
114
# close logger
115
115
if rank == 0 :
116
- exp_logger .close ()
116
+ from ignite .contrib .handlers .wandb_logger import WandBLogger
117
+
118
+ if isinstance (exp_logger , WandBLogger ):
119
+ # why handle differently for wandb?
120
+ # See: https://github.com/pytorch/ignite/issues/1894
121
+ exp_logger .finish ()
122
+ elif exp_logger :
123
+ exp_logger .close ()
117
124
#::: } :::#
118
125
#
119
126
#::: if (it.save_training || it.save_evaluation) { :::#
Original file line number Diff line number Diff line change 10
10
from ignite .utils import manual_seed
11
11
from models import Discriminator , Generator
12
12
from torch import nn , optim
13
- from torch .utils .data .distributed import DistributedSampler
14
13
from trainers import setup_evaluator , setup_trainer
15
14
from utils import *
16
15
@@ -168,7 +167,14 @@ def _():
168
167
#::: if (it.logger) { :::#
169
168
# close logger
170
169
if rank == 0 :
171
- exp_logger .close ()
170
+ from ignite .contrib .handlers .wandb_logger import WandBLogger
171
+
172
+ if isinstance (exp_logger , WandBLogger ):
173
+ # why handle differently for wandb?
174
+ # See: https://github.com/pytorch/ignite/issues/1894
175
+ exp_logger .finish ()
176
+ elif exp_logger :
177
+ exp_logger .close ()
172
178
#::: } :::#
173
179
#
174
180
#::: if (it.save_training || it.save_evaluation) { :::#
Original file line number Diff line number Diff line change 1
1
import os
2
2
from argparse import Namespace
3
- from numbers import Number
4
3
from typing import Iterable
5
4
6
5
import ignite .distributed as idist
Original file line number Diff line number Diff line change 4
4
5
5
import ignite .distributed as idist
6
6
import yaml
7
- from data import denormalize , download_datasets , setup_data
7
+ from data import denormalize , setup_data
8
+ from ignite .contrib .handlers import LRScheduler
8
9
from ignite .engine import Events
9
- from ignite .handlers .param_scheduler import LRScheduler
10
10
from ignite .metrics import ConfusionMatrix , IoU , mIoU
11
11
from ignite .utils import manual_seed
12
12
from models import setup_model
@@ -176,7 +176,14 @@ def _():
176
176
#::: if (it.logger) { :::#
177
177
# close logger
178
178
if rank == 0 :
179
- exp_logger .close ()
179
+ from ignite .contrib .handlers .wandb_logger import WandBLogger
180
+
181
+ if isinstance (exp_logger , WandBLogger ):
182
+ # why handle differently for wandb?
183
+ # See: https://github.com/pytorch/ignite/issues/1894
184
+ exp_logger .finish ()
185
+ elif exp_logger :
186
+ exp_logger .close ()
180
187
#::: } :::#
181
188
#
182
189
#::: if (it.save_training || it.save_evaluation) { :::#
You can’t perform that action at this time.
0 commit comments