Skip to content

Commit

Permalink
update docstring of callbacks.py
Browse files Browse the repository at this point in the history
  • Loading branch information
HydrogenSulfate committed Apr 30, 2024
1 parent b8e39c9 commit 3e7cc56
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions ppsci/utils/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

class InitCallback(Callback):
"""Callback class for:
1. Parse config dict from given yaml file and check its validity, complete missing items by its' default values.
1. Parse config dict from given yaml file and check its validity.
2. Fixing random seed to 'config.seed'.
3. Initialize logger while creating output directory(if not exist).
Expand Down Expand Up @@ -60,8 +60,6 @@ class InitCallback(Callback):
"""

def on_job_start(self, config: DictConfig, **kwargs: Any) -> None:
# check given cfg using pre-defined pydantic schema in 'SolverConfig', error(s) will be raised
# if any checking failed at this step
if importlib.util.find_spec("pydantic") is not None:
from pydantic import ValidationError
else:
Expand All @@ -76,8 +74,6 @@ def on_job_start(self, config: DictConfig, **kwargs: Any) -> None:
# error(s) will be printed and exit program if any checking failed at this step
try:
_model_pydantic = config_module.SolverConfig(**dict(config))
# complete missing items with default values pre-defined in pydantic schema in
# 'SolverConfig'
full_cfg = DictConfig(_model_pydantic.model_dump())
except ValidationError as e:
print(e)
Expand All @@ -100,7 +96,7 @@ def on_job_start(self, config: DictConfig, **kwargs: Any) -> None:

# enable prim if specified
if "prim" in full_cfg and bool(full_cfg.prim):
# Mostly for dy2st running, will be removed in the future
# Mostly for compiler running with dy2st.
from paddle.framework import core

core.set_prim_eager_enabled(True)
Expand Down

0 comments on commit 3e7cc56

Please sign in to comment.