File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 14
14
from lantern .set_seeds import set_seeds
15
15
from lantern .worker_init_fn import worker_init_fn
16
16
from lantern .progress_bar import ProgressBar
17
- from lantern .early_stopping import EarlyStopping
17
+
18
+ try :
19
+ from lantern .early_stopping import EarlyStopping
20
+ except ImportError :
21
+ pass
18
22
from lantern .git_info import git_info
19
23
20
24
from pkg_resources import get_distribution , DistributionNotFound
Original file line number Diff line number Diff line change 1
- import torch .utils .tensorboard
2
1
from typing import Optional
3
2
4
3
from lantern import FunctionalBase
5
4
5
+ try :
6
+ import torch .utils .tensorboard
7
+
8
+ SummaryWriter = torch .utils .tensorboard .SummaryWriter
9
+ except ImportError :
10
+ SummaryWriter = None
11
+ pass
12
+
6
13
7
14
class EarlyStopping (FunctionalBase ):
8
15
"""Keeps track of the best score and how long ago it was calculated."""
9
16
10
- tensorboard_logger : torch . utils . tensorboard . SummaryWriter
17
+ tensorboard_logger : SummaryWriter
11
18
best_score : Optional [float ] = None
12
19
scores_since_improvement : int = - 1
13
20
You can’t perform that action at this time.
0 commit comments