31
31
32
32
class InitCallback (Callback ):
33
33
"""Callback class for:
34
- 1. Parse config dict from given yaml file and check its validity, complete missing items by its' default values .
34
+ 1. Parse config dict from given yaml file and check its validity.
35
35
2. Fixing random seed to 'config.seed'.
36
36
3. Initialize logger while creating output directory(if not exist).
37
37
@@ -60,8 +60,6 @@ class InitCallback(Callback):
60
60
"""
61
61
62
62
def on_job_start (self , config : DictConfig , ** kwargs : Any ) -> None :
63
- # check given cfg using pre-defined pydantic schema in 'SolverConfig', error(s) will be raised
64
- # if any checking failed at this step
65
63
if importlib .util .find_spec ("pydantic" ) is not None :
66
64
from pydantic import ValidationError
67
65
else :
@@ -76,8 +74,6 @@ def on_job_start(self, config: DictConfig, **kwargs: Any) -> None:
76
74
# error(s) will be printed and exit program if any checking failed at this step
77
75
try :
78
76
_model_pydantic = config_module .SolverConfig (** dict (config ))
79
- # complete missing items with default values pre-defined in pydantic schema in
80
- # 'SolverConfig'
81
77
full_cfg = DictConfig (_model_pydantic .model_dump ())
82
78
except ValidationError as e :
83
79
print (e )
@@ -100,7 +96,7 @@ def on_job_start(self, config: DictConfig, **kwargs: Any) -> None:
100
96
101
97
# enable prim if specified
102
98
if "prim" in full_cfg and bool (full_cfg .prim ):
103
- # Mostly for dy2st running, will be removed in the future
99
+ # Mostly for compiler running with dy2st.
104
100
from paddle .framework import core
105
101
106
102
core .set_prim_eager_enabled (True )
0 commit comments