The Hateful Memes challenge is available at this link.
In MMF, we provide the starter code and baseline pretrained models for this challenge and the configurations used for training the reported baselines. For more details check this link.
In this tutorial, we provide steps for running training and evaluation with MMBT model on hateful memes dataset and generating submission file for the challenge. The same steps can be used for your own models.
Installation and Preparing the dataset
Follow the prerequisites for installation and dataset here.
Training and Evaluation
For running training on train set, run the following command:
This will train the
mmbt model on the dataset and generate the checkpoints and best trained model (
mmbt_final.pth) will be stored in the
./save directory by default.
Next run evaluation on the validation set:
This will give you the performance of your model on the validation set. The metrics are AUROC, ACC, Binary F1 etc.
Predictions for Challenge
After we trained the model and evaluated on the validation set, we will generate the predictions on the test set. The prediction file should contain the following three columns:
- Meme identification number,
- Probability that the meme is hateful,
- Binary label that the meme is hateful (1) or non-hateful (0),
With MMF you can directly generate the predictions in the required submission format with the following command:
This command will output where the generated predictions csv file is stored.
Submission for Challenge
Next you can upload the generated csv file on DrivenData in their submissions page for Hateful Memes.
More details will be added once the challenge submission phase is live.
Predicting for Phase 1
If you want to submit prediction for phase 1, you will need to use command line opts to override the jsonl files that are loaded. At the end of any command you run, add the following to load seen dev and test splits:
This will load the phase 1 files for you and evaluate those.
Building on top of MMF and Open Sourcing your code
To understand how you build on top of MMF for your own custom models and then open source your code, take a look at this example.