Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ehn] Enhance config module #899

Merged

Conversation

HydrogenSulfate
Copy link
Collaborator

@HydrogenSulfate HydrogenSulfate commented May 15, 2024

PR types

New features

PR changes

APIs

Describe

  1. 通过ConfigStore,支持在yaml文件中指定defaults字段来提供通用参数的默认配置,免去重复的yaml字段填写和Solver实例化时的十多个参数指定,如下所示。
    
     # before 
     solver = ppsci.solver.Solver(
         model,
         constraint,
         cfg.output_dir,
         optimizer,
         lr_scheduler,
         cfg.TRAIN.epochs,
         cfg.TRAIN.iters_per_epoch,
         save_freq=cfg.TRAIN.save_freq,
         log_freq=cfg.log_freq,
         eval_during_train=True,
         eval_freq=cfg.TRAIN.eval_freq,
         seed=cfg.seed,
         equation=equation,
         geom=geom,
         validator=validator,
         visualizer=visualizer,
         pretrained_model_path=cfg.TRAIN.pretrained_model_path,
         checkpoint_path=cfg.TRAIN.checkpoint_path,
         eval_with_no_grad=cfg.EVAL.eval_with_no_grad,
     )
    
     # after
     solver = ppsci.solver.Solver(
         model,
         constraint,
         optimizer=optimizer,
         equation=equation,
         validator=validator,
         visualizer=visualizer,
         cfg=cfg, <-- Only need cfg
     )
  2. 移除原有的AttrDict相关代码。
  3. 更新相关单测

此PR只负责更新基础功能,案例的代码、文档更新在 #852

Copy link

paddle-bot bot commented May 15, 2024

Thanks for your contribution!

Copy link
Collaborator

@zhiminzhang0830 zhiminzhang0830 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zhiminzhang0830 zhiminzhang0830 merged commit f17d1b3 into PaddlePaddle:develop May 15, 2024
3 of 4 checks passed
@HydrogenSulfate HydrogenSulfate deleted the update_config_module branch May 15, 2024 11:10
huohuohuohuohuo123 pushed a commit to huohuohuohuohuo123/PaddleScience that referenced this pull request Aug 12, 2024
* support default config content in config module and remove deprecated AttrDict series code

* update corresponding unitests

* update develop code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants