This repository supplements our paper "LSCodec: A Time series long-short term codec for compression and representation".
- Implement of LSCodec model
- Training scripts and configs
- Downstream task scripts
- Pre-trained checkpoints
- how to cite our paper
Create and activate a virtual environment to work in, e.g. using env:
python -m venv your_env_lscodec
your_env_lscodec/Scripts/activate Install CUDA and PyTorch 1.13. For CUDA 11.6, this would look like:
pip install torch==1.13.1+cu116 torchvision==0.14.1+cu116 torchaudio==0.13.1 --extra-index-url https://download.pytorch.org/whl/cu116Install the remaining requirements with pip:
pip install -r requirements.txtThe proposed framework is high relied on vector_quantize, it is an excellent VQ library.
LSCodec supports Multi-Channel regular Time Series Sequences. For data preparing, we follow DTAAN scripts for data normalization and train/valid splitting.
python ./preprocess.py <datasets> where is space separated list of datasets like 'synthetic', 'SMD', 'SWaT', 'SMAP', 'MSL', 'WADI', 'MSDS', 'UCR', 'MBA', 'NAB' ... The data should be placed in './data' folder. And the preprocessed data will be generated in './processed' folder. Considering that datasets is not allowed for distribution, we recommand to access dataset by its official website.
For CPU training
python ./train.v1.py --task lscodec --config ./config/config_lscodec_xxx.toml --force_cpu For single GPU training
python ./train.v1.py --task lscodec --config ./config/config_lscodec_xxx.toml For Multi-GPU training, we build our training code upon Accelerate for multi-gpu training, you need to prepare your gpu-env configurations.
CUDA_VISIBLE_DEVICES=xxxx accelerate launch --config_file ./your_accelerate_config ./train.v1.py --task lscodec --config ./config/config_lscodec_xxx.toml BSD-3-Clause.
Copyright (c) 2024, Haiwei Zuo.
All rights reserved.
See License file for more details.
