Official implementation of "BatteryMFormer: Multi-level Learning for Battery Degradation Trajectory Forecasting." If you find this repository useful, we would appreciate citations to our paper and stars to this repository.
pip install -r requirements.txtThe experiments were run with Python 3.9 and NVIDIA RTX 3090 GPUs.
BatteryMFormer uses the BatteryLife v11 processed data, available from Hugging Face:
Detailed download instructions are provided in assets/Data_download.md.
The default example below uses the Li-ion pure-OOD split data_provider/split_json/pure_ood/Liion_split_seed2024.json.
If you use the BatteryLife v11 processed data, the generated SOH files are already included in processed_SOH.
To regenerate SOH from raw data, edit the paths in process_scripts/run_soh_pipeline.sh and run:
bash process_scripts/run_soh_pipeline.shEdit the path variables at the top of train_eval_scripts/train_BattMFormer.sh:
root_path=/path/to/BatteryLife_Processed_snapshot
processed_SOH_path=/path/to/BatteryLife_Processed_snapshot/processed_SOH
cache_root=/path/to/cacheThen train BatteryMFormer on Li-ion:
bash train_eval_scripts/train_BattMFormer.shCheckpoints are saved under checkpoints/.
Set args_path in train_eval_scripts/evaluate_model.sh to the checkpoint directory and set target_dataset=Li_ion, then run:
bash train_eval_scripts/evaluate_model.shEvaluation metrics are written to the checkpoint directory.
To run another dataset or split, change dataset and split_json_path in train_eval_scripts/train_BattMFormer.sh, then use the matching target_dataset during evaluation.
| Dataset | dataset |
Example split |
|---|---|---|
| Li-ion | Li_ion |
data_provider/split_json/pure_ood/Liion_split_seed{2021,42,2024}.json |
| Zn-ion | ZN-coin |
data_provider/split_json/pure_ood/ZNcoin_split_seed{2021,42,2024}.json |
| CALB | CALB |
data_provider/split_json/loao/CALB_loao_cond{396..399}_seed2021.json |
| NA-ion | NA-ion |
data_provider/split_json/loao/NA-ion_loao_cond{400..411}_seed2021.json |
Per-fold hyperparameters used in our experiments are listed in assets/per_fold_hyperparameters.md.
This repo is constructed based on the following repos: