Skip to content

alemamm/cp4sl-lightning

Repository files navigation


Self-Supervised Structure Learning for Cyber-Physical Systems

PyTorch Lightning Config: Hydra Template

Installation

# [OPTIONAL] create conda environment
conda create -n myenv python=3.9
conda activate myenv

# install pytorch according to instructions
# https://pytorch.org/get-started/

# install requirements
pip install -r requirements.txt

How to run

We use Hydra, PyTorch 2.0, PyTorch Lightning and Weights & Biases to manage experiments and log results.

The default logger can be changed in the configuration file of an experiment. Experiment configuration files are located in

configs/experiment/

By default GPU training is enabled. This can be changed in the default trainer configuration file.

configs/trainer/default.yaml

Source code of the model itself can be found under

src/model/components

Scripted experiments

To run five seeded experiments for each respective configuration run:

Static

bash scripts/schedule_kuramoto_static.sh

Dynamic

bash scripts/schedule_kuramoto_dynamic.sh

Correlation

bash scripts/schedule_kuramoto_correlation_adj.sh

True

bash scripts/schedule_kuramoto_true_adj.sh

Full

bash scripts/schedule_kuramoto_full_graph.sh

Features

bash scripts/schedule_kuramoto_features_as_embeddings.sh

Running single experiments

Train model with default configuration

# train on CPU
python src/train.py trainer=cpu

# train on GPU
python src/train.py trainer=gpu

Train model with chosen experiment configuration from configs/experiment/

python src/train.py experiment=experiment_name.yaml

You can override any parameter from command line like this

python src/train.py trainer.max_epochs=20 data.batch_size=64

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published