This repository serves as an example of how to use MMF as a library in your projects and build on top of it.
The example tries to replicate the model developed in DrivenData's blog post on the Hateful Memes.
Preferably, create your own conda environment before following the steps below:
git clone https://github.com/apsdehal/hm_example_mmf
cd hm_example_mmf
pip install -r requirements.txt
Please follow prerequisites for the Hateful Memes dataset at this link.
Run training with the following command on the Hateful Memes dataset:
MMF_USER_DIR="." mmf_run config="configs/experiments/defaults.yaml" model=concat_vl dataset=hateful_memes training.num_workers=0
We set training.num_workers=0
here to avoid memory leaks with fasttext.
Please follow configuration document to understand how to use MMF's configuration system to update parameters.
├── configs
│ ├── experiments
│ │ └── defaults.yaml
│ └── models
│ └── concat_vl.yaml
├── __init__.py
├── models
│ ├── concat_vl.py
├── processors
│ ├── processors.py
├── README.md
└── requirements.txt
Some notes:
- Configs have been divided into
experiments
andmodels
where experiments will contain training configs while models will contain model specific config we implmented. __init__.py
imports all of the relevant files so that MMF can find them. This is whatenv.user_dir
actually looks for.models
directory contains our model implementation, in this case specificallyconcat_vl
.processors
contains our project specific processors implementation, in this case, we implemented FastText processor for Sentence Vectors.
Please open up issues related to this repository directly on MMF.