17
17
import time
18
18
from typing import TYPE_CHECKING
19
19
from typing import Dict
20
+ from typing import Optional
20
21
from typing import Tuple
21
22
from typing import Union
22
23
@@ -59,7 +60,7 @@ def _get_dataset_length(
59
60
60
61
61
62
def _eval_by_dataset (
62
- solver : "solver.Solver" , epoch_id : int , log_freq : int
63
+ solver : "solver.Solver" , epoch_id : Optional [ int ] , log_freq : int
63
64
) -> Tuple [float , Dict [str , Dict [str , float ]]]:
64
65
"""Evaluate with computing metric on total samples(default process).
65
66
@@ -68,7 +69,7 @@ def _eval_by_dataset(
68
69
69
70
Args:
70
71
solver (solver.Solver): Main Solver.
71
- epoch_id (int): Epoch id.
72
+ epoch_id (Optional[ int] ): Epoch id.
72
73
log_freq (int): Log evaluation information every `log_freq` steps.
73
74
74
75
Returns:
@@ -189,7 +190,7 @@ def _eval_by_dataset(
189
190
190
191
191
192
def _eval_by_batch (
192
- solver : "solver.Solver" , epoch_id : int , log_freq : int
193
+ solver : "solver.Solver" , epoch_id : Optional [ int ] , log_freq : int
193
194
) -> Tuple [float , Dict [str , Dict [str , float ]]]:
194
195
"""Evaluate with computing metric by batch, which is memory-efficient.
195
196
@@ -199,7 +200,7 @@ def _eval_by_batch(
199
200
200
201
Args:
201
202
solver (solver.Solver): Main Solver.
202
- epoch_id (int): Epoch id.
203
+ epoch_id (Optional[ int] ): Epoch id.
203
204
log_freq (int): Log evaluation information every `log_freq` steps.
204
205
205
206
Returns:
@@ -303,13 +304,13 @@ def _eval_by_batch(
303
304
304
305
305
306
def eval_func (
306
- solver : "solver.Solver" , epoch_id : int , log_freq : int
307
+ solver : "solver.Solver" , epoch_id : Optional [ int ] , log_freq : int
307
308
) -> Tuple [float , Dict [str , Dict [str , float ]]]:
308
309
"""Evaluation function.
309
310
310
311
Args:
311
312
solver (solver.Solver): Main Solver.
312
- epoch_id (int): Epoch id.
313
+ epoch_id (Optional[ int] ): Epoch id.
313
314
log_freq (int): Log evaluation information every `log_freq` steps.
314
315
315
316
Returns:
0 commit comments