Restored default logger without warnings or errors
@@ -33,7 +33,8 @@ class EvaluationPlugin(StrategyPlugin):
Sequence['StrategyLogger']] = None,
collect_all=True,
benchmark=None,
- strict_checks=False):
+ strict_checks=False,
+ suppress_warnings=False):
"""
Creates an instance of the evaluation plugin.
@@ -50,11 +51,16 @@ class EvaluationPlugin(StrategyPlugin):
In this case, only full evaluation streams are admitted when
calling `eval`. An error will be raised otherwise. When False,
`benchmark` can be `None` and only warnings will be raised.
+ :param suppress_warnings: if True, warnings and errors will never be
+ raised from the plugin.
+ If False, warnings and errors will be raised following
+ `benchmark` and `strict_checks` behavior.
"""
super().__init__()
self.collect_all = collect_all
self.benchmark = benchmark
self.strict_checks = strict_checks
+ self.suppress_warnings = suppress_warnings
flat_metrics_list = []
for metric in metrics:
if isinstance(metric, Sequence):
@@ -69,8 +75,10 @@ class EvaluationPlugin(StrategyPlugin):
loggers = [loggers]
if benchmark is None:
+ if not suppress_warnings:
if strict_checks:
- raise ValueError("Benchmark cannot be None in strict mode.")
+ raise ValueError("Benchmark cannot be None "
+ "in strict mode.")
else:
warnings.warn(
"No benchmark provided to the evaluation plugin. "
@@ -233,6 +241,7 @@ class EvaluationPlugin(StrategyPlugin):
try:
current_exp = strategy.current_eval_stream[i]
if exp.current_experience != current_exp.current_experience:
+ if not self.suppress_warnings:
if self.strict_checks:
raise ValueError(msge)
else:
@@ -272,7 +281,11 @@ class EvaluationPlugin(StrategyPlugin):
self._update_metrics(strategy, 'after_eval_iteration')
-default_logger = None
+default_logger = EvaluationPlugin(
+ accuracy_metrics(minibatch=False, epoch=True, experience=True, stream=True),
+ loss_metrics(minibatch=False, epoch=True, experience=True, stream=True),
+ loggers=[InteractiveLogger()],
+ suppress_warnings=True)
__all__ = [
