This repo contains the code to train distilbert-base-uncased on MRPC for paraphrase detection.
There are a few pre-requisites to run this project:
- Docker needs to be installed on your system.
- Wandb is used to log the training metrics. You need to have a wandb account and the API key to log the metrics. You can get the API key from your wandb account settings.
You need to set your wandb API key as an environment variable. There are two ways of doing this:
- Rename the .env.example file to .env and set the value of the WANDB_API_KEY variable to your wandb API key.
- Set the variable when running the docker container. Check step 4.3 for more details.
There are several parameters that can be passed to the training script. To change the parameters, edit train.sh before building the docker image.
--wand-project
: Project name where wandb is goint to save the logs to. Default isProject2
.--checkpoint_dir
: Where the models should be saved to. Default is./models
.--model_name_or_path
: Which model to train. Default isdistilbert-base-uncased
.--train_batch_size
: Training batch size to be used. Default is 32.--val_batch_size
: Validation batch size to be used. Default is 32.--learning_rate
: Learning rate to be used. Default is 2e-5.--learning_rate_modifier
: Learning rate modifier to be used. Default is 1.0.--warmup_steps
: Warmup steps to be used. Default is to calculate the warmup steps based on the number of training steps.--weight_decay
: Weight decay to be used. Default is 0.0.--beta1
: Beta1 to be used for AdamW. Default is 0.9.--beta2
: Beta2 to be used for AdamW. Default is 0.999.
The hyperparameters of the best run from project 1 are pre-configured in train.sh.
git clone https://github.com/wltrhslu/MLOPS_Project2
cd MLOPS_Project2
If you want to change the hyperparameters, remember to edit train.sh before building the docker image.
docker build -t mlops_project2 .
Either run the container with the environment variable set in the .env file:
docker run -it --env-file .env mlops_project2
Or set the environment variable when running the container:
docker run -it -e WANDB_API_KEY=YOUR_API_KEY_GOES_HERE mlops_project2