Authors:
Sascha Kirch, José Ignacio Olalde-Verano , Sergio Martín & Clara Pérez-Molina
[BibTex
]
Oficial code base of our paper: SambaMixer: State of Health Prediction of Li-ion Batteries using Mamba State Space Models.
- Introducing Mamba state space models to the problem of Li-Ion battery SOH prediction.
- Using an anchor-based resampling scheme to resample time signals to have the same number of samples while serving as a data augmentation method.
- Applying a sample time-based positional encoding scheme to the input sequence to tackle sample jitter, time signals of varying length and recuperation effects of Li-ion batteries.
Here we provide free access to Sascha's series: Towards Mamba State Space Models Images, Videos and Time Series.
- Part 1: Towards Mamba State Space Models for Images, Videos and Time Series
- Part 2: Structured State Space Models Visually Explained
- Part 3: Here Comes Mamba: The Selective State Space Model
- Part 4: Vision Mamba: Like a Vision Transformer but Better
- Part 5: VideoMamba
- Part 6: MAmbaMixer
- Part 7: Mamba-2
And here free access to all his other articles
2024/11/04
: Code is available Now!2024/11/04
: We release our pre-print on arxiv.
Battery | Model | MAE | RMSE | MAPE |
---|---|---|---|---|
#06 | Mazzi et al. (2024) | 2.448 | 3.177 | 1.579 |
SambaMixer (ours) | 1.173 | 2.068 | 1.406 | |
#07 | Mazzi et al. (2024) | 1.861 | 2.252 | 1.114 |
SambaMixer (ours) | 1.197 | 1.285 | 1.498 | |
#47 | Mazzi et al. (2024) | 2.549 | 3.094 | 1.969 |
SambaMixer (ours) | 0.512 | 0.645 | 0.822 |
first change into ./environment
directory.
Then build an image from the docker file.
Note that you can provide different build-args here. Ones often used are:
--build-arg HTTP_PROXY
,--build-arg USER_ID=$UID
and--build-arg GROUP_ID=<YOUR_GROUPID>
docker build -t samba-mixer -f Dockerfile .
Create a container from the image.
docker container create --gpus all --name samba-mixer --network=host --mount=type=tmpfs,target=/dev/shm -v ~/git/sascha-kirch/samba-mixer:/home/dev_user/samba-mixer -it samba-mixer:latest
Note that
--gpus
might be set to1
to not block all existing GPUs in a shared environment and that the port mapping might be used already, so you must specify another port.
Further note that
--mount=type=tmpfs,target=/dev/shm
is used to mount a larger filesystem to the shared memory/dev/shm
heavily used by pytorch. Docker defaults this memory to have 64MB and even thoughdocker build
has--shm-size
command, it apperently is ignored in some versions of docker. In my case, I end up with 13GB for /dev/shm after I mount the tmpfs.
To start the container in an interactive bash:
docker container start -i samba-mixer
Or you can connect to the container via attaching VS Code to it.
python -m pip install -e .
cd ./third_party_packages/mamba
python -m pip install -e .
cd ..
Note: It might happen that the installation crashes with an error message related to:
ImportError: connot import name 'packaging' from ....
. In that case you need to down grade setuptools viapython -m pip install -U setuptools==69.2.*
cd ./third_party_packages/causal-conv1d-1.2.2
python -m pip install -e .
cd ..
Only needs to be done once during the initial setup of this repo.
mkdir datasets
cd ./datasets
wget https://phm-datasets.s3.amazonaws.com/NASA/5.+Battery+Data+Set.zip
unzip "5.+Battery+Data+Set.zip"
mv "5. Battery Data Set"/ nasa_batteries_orig
cd ./nasa_batteries_orig
unzip "1. BatteryAgingARC-FY08Q4.zip" -d "1. BatteryAgingARC-FY08Q4"
unzip "2. BatteryAgingARC_25_26_27_28_P1.zip" -d "2. BatteryAgingARC_25_26_27_28_P1"
unzip "3. BatteryAgingARC_25-44.zip" -d "3. BatteryAgingARC_25-44"
unzip "4. BatteryAgingARC_45_46_47_48.zip" -d "4. BatteryAgingARC_45_46_47_48"
unzip "5. BatteryAgingARC_49_50_51_52.zip" -d "5. BatteryAgingARC_49_50_51_52"
unzip "6. BatteryAgingARC_53_54_55_56.zip" -d "6. BatteryAgingARC_53_54_55_56"
cd ..
rm -rfv **/*.zip
if wgeet fails, retry and add oprion
--no-check-certificate
to the wget comand
Note: in case those unzip commands do not work or you end up with a different file tree you need to endup with the following file tree
|-- samba_mixer
|-- datasets
|-- nasa_bateries_orig
|-- 1. BatteryAgingARC-FY08Q4
|-- 2. BatteryAgingARC_25_26_27_28_P1
|-- 3. BatteryAgingARC_25-44
|-- 4. BatteryAgingARC_45_46_47_48
|-- 5. BatteryAgingARC_49_50_51_52
|-- 6. BatteryAgingARC_53_54_55_56
cd ./scripts/utils
# Get unfiltered datasets
python convert_nasa_dataset_discharge.py
# Apply filters and pre processing as determined in the dataset analysis
python convert_nasa_dataset_discharge.py --filter
# Train a model using ./configs/train_config.yaml
python scripts/train.py
# Train a multiple models using ./configs/experiment_train_model_scaling.yaml
python scripts/train.py -m --config-name experiment_train_model_scaling
# Evaluate a model using ./configs/eval_config.yaml
python scripts/eval.py
# Evaluate multiple models using ./configs/eval_config.yaml
python scripts/eval.py -m
# Start all ablation training runs
sh scripts/start_ablations.sh
# Start all experiment training runs
sh scripts/start_experiments.sh
NOTE: Before you can eval the models, make sure to copy the checkpoint paths into the respect eval configs.
We use tensorboard to log experiements. You can either install a Tensorboard plugin within VS code or start the tensorboard via the CLI
tensorboard --logdir <PATH_TO_LOGS>
You can delete the build files of ./third_party_packages/mamba/build
and ./third_party_packages/causal-conv1d-1.2.2/build
since the built so-file is copied into the root of mamba and the build files and temp files are not cleaned automatically by mamba
If you find our work helpful for your research, please consider citing the following BibTeX entry.
@misc{olalde_kirch_2024_sambamixer,
title={SambaMixer: State of Health Prediction of Li-ion Batteries using Mamba State Space Models},
author={José Ignacio Olalde-Verano and Sascha Kirch and Clara Pérez-Molina and Sergio Martin},
year={2024},
eprint={2411.00233},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2411.00233},
}