We make use of a scheduling approach that has been shown to yield improved results in a multi-task setting by aligning dissimilar task gradients. We demonstrate that a novel approach SEGA: Sequential neural Execution of Graph Algorithms that incorporates a scheduling approach in the training process in addition to the modulating the availability of training samples substantively improves results over previous works.
This repository is adapted from the source code for How to transfer algorithmic reasoning knowledge to learn new algorithms?
- create conda environment
conda create -n gne python=3.8
- activate conda environment and install pytorch
conda activate gne
conda install pytorch torchvision torchaudio -c pytorch
- install other libs
pip install -r requirements.txt
training and evaluation for different baselines.
get train, val, test dataloader for different baselines.
get experiment logger.
define training parameters; call get_stream and baseline, example training parameter settings can be found here.
- Prepare data by first generating graphs with gen_[graph name] functions in datagen/graphgen.py and generate execution trajectories of each algorithm with gen_multi_algo_data in datagen/algorithm.py
- Instantiate model
NeuralExecutor3
(Neural Executor baseline) orNeuralExecutor3_
(SEGA) from model.py - Setup data streams for training, validation, and testing using either
multi_stream
orseq_reptile_stream
fromget_streams.py
- Train model with
run_multi
(Neural Executor baseline) orrun_seq_reptile
(SEGA) frombaselines.py