This is PyTorch code for Adaptive TBPTT used for training RNN
This repo contains the python code for the experiments in Adaptively Truncating Backpropagation Through Time to Control Gradient Bias by Christopher Aicher, Nicholas J. Foti, and Emily B. Fox. UAI 2019.
- The
datafolder stores the synthetic, language model, and temporal point process data. - The
scriptsfolder stores the bash scripts for the experiments. - The
experimentsfolder contains the python code for experiment scripts. Seeexperiments/README.mdfor additional details. - The
tbpttfolder contains the python module code. Seetbptt/README.mdfor additional details.
Add the tbptt folder to the PYTHONPATH.
Requirements: Python 3+, pytorch, numpy, pandas, scipy, matplotlib, seaborn, joblib, scikit-learn, tqdm
To download the language modeling text data call get_lm_data.sh.
cd <path_to_repo>
./get_lm_data
To download the temporal point process data call get_tpp_data.sh.
cd <path_to_repo>
./get_tpp_data
To run the experiment scripts, call individual experiment bash scripts
cd <path_to_repo>
./scripts/<experiment_name>.sh
This may take a while depending on your setup.
The output of each experiment is a pair files (options.csv and metric.csv.gz) at ./output/<experiment_name>/out/.
options.csvis a CSV with a row for each TBPTT setup (i.e. forK = 10, 50, 100orlr = 1, 10, etc.) and columns with training setup values (i.e.lr,K,batchsize, etc.).metrics.csv.gzis a compressed CSV with a row for each measuredepochandmetric(i.e.valid_ppl,test_ppl,logdelta, etc.)
You can join options.csv with metrics.csv on the experiment_id column.
See experiments/README.md for additional details.
The default bash scripts require the use of PyTorch with a GPU.
If you do not have a GPU, set CUDA_AVAILABLE to False in ./experiments/script_maker.py and regenerate the bash scripts
cd <path_to_repo>
python ./experiments/script_maker.py
- 0.2.0
- The second release (July 2019)
- Added temporal point process modeling
- Updated scripts to use multiple initializations
- 0.1.0
- The first release (May 2019)
Christopher Aicher – aicherc@uw.edu
Distributed under the MIT license. See LICENSE for more information.
https://github.com/aicherc/adaptive_tbptt
- Fork it (https://github.com/aicherc/adaptive_tbptt/fork)
- Create your feature branch (
git checkout -b feature/fooBar) - Commit your changes (
git commit -am 'Add some fooBar') - Push to the branch (
git push origin feature/fooBar) - Create a new Pull Request