Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
简单地基于
lightning重构了框架,适配了原框架的大部分命令和配置。建议作为一个使用lightning替换后端的分支的起点。基本说明
简单运行(训练+校验+测试):
仅测试(需要替换
CKPT_PATH,如fit后保存的模型examples\lightning_logs\PEMS08\best.ckpt):python run.py --config=examples/lightning_config.yaml test --ckpt_path {CKPT_PATH}查看训练日志
主要重构部分
LightningDataModule包装数据集和加载器。LightningModule的子类BasicTimeSeriesForecastingModule中实现有关推理(train/validation/step/predict)和数据处理(如Scaler、前/后处理等)的部分功能,相当于将原框架中Runner和Model的组合关系变成BasicTimeSeriesForecastingModule和Model的继承关系,具体的训练过程(如早停、梯度裁剪、ckpt保存等)交由lightning.Trainer进行控制。__init__方法、将优化器的定义下放到模型代码中。lightning支持的配置文件示例。lightning相关依赖。需要完成的后续工作
easytorch的旧版本框架代码lightning的风格