Installation • File Structure • How To Use • Examples • Credits • License
-
Install all required packages
pip install -r requirements.txt
-
Install
pre-commit:pre-commit install
project_root/
│
├── preprocessing/
│ ├── provided/ # Preprocessing pipeline provided by the teachers
├── src/
│ ├── configs/ # HYDRA configs for training/inference hyperparamters configuration
│ ├── data/ # All function related to PyTorch datasets, dataloaders, etc.
│ ├── logger/ # Functions used for logging
│ ├── loss/ # Functions for calculating loss
│ ├── metrics/ # Functions for computing and logging metrics
│ ├── model/ # All models definitions
│ ├── trainer/ # Functions called in the training loop
│ ├── utils/ # Provided utils
├── template/ # Directory containing the extra files from the Blinorot template
│
├── train.py # General script performing both training and inference
├── train.py # Main training script
├── inference.py # Script for inference
└── README.md # Current file
You must run all commands from the root of the project, the data should be unzipped in a ./data directory keeping the original names, example of the resulting directory tree:
project_root/
├── data/
│ ├── test_data.txt
│ ├── train_pos.txt
│ ├── train_neg.txt
To run the whole pipeline in a single command, run:
python3 run.py --config-name=CONFIG_NAMEWhere CONFIG_NAME is a config from src/configs.
Alternatively, to train a model, run the following command:
python3 train.py --config-name=CONFIG_NAMETo run inference:
python3 inference.py --config-name=CONFIG_NAMETo reproduce our best results, simply run the following command using the small dataset:
python3 run.py --config-name=roberta_largeAlternatively, you can run the training and inference separately, an example is given below for the LSTM model, you can run this one with the full dataset for better results:
python3 train.py --config-name=lstmpython3 inference.py --config-name=lstmThe resulting .csv file can be found under the ./inference_results/ directory
This project was bootstrapped using the pytorch_project_template by Blinorot.
This project is based on the MIT-licensed pytorch_project_template by Blinorot. See the LICENSE file for details.