Views
No views yet
biecho/hateful_memes
(Facebook Hateful Memes mirror, 8500-sample training set) with seed 42
on the openai/clip-vit-large-patch14-336 backbone.1# 1. clone the code repo
2git clone https://github.com/biecho/hateful-meme-detection
3cd hateful-meme-detection
4conda env create -f envs/environment_linux.yml && conda activate hateful-memes
5pip install -e .
6
7# 2. dataset (~5 min) + features (~15 min on a single GPU)
8python setup_data.py
9python extract_features.py --clip-model openai/clip-vit-large-patch14-336
10
11# 3. download all 8 baseline checkpoints (~70 MB) into results/
12huggingface-cli download cs5242-hateful-memes/hateful-memes-model \
13 --local-dir results/ --include "m1?/*" "m2/*"
14
15# 4. evaluate every checkpoint on test_seen — populates results/m*/results.json
16python eval_test.py--include filter.python train.py --model <id> [--confounder-weight α] CLI:m1a/best_model.pt # baseline checkpoint per architecture
m1b/... # (8 dirs total: m1a, m1b, m1c, m1d, m1e, m1f, m1g, m2)
m2/best_model.pt # 2 GB — fine-tuned CLIP + confounder-aware contrastive
m1a_cw2/, m1a_cw3/, ..., m1a_cw50/ # confounder-weight sweep
m1b_cw2/, ... # 7 alphas x 7 frozen models = 49 runs
# plus cw=10 from a separate sweep -> 56 totalbest_model.pt — torch.save({"model_state_dict": ...}) checkpoint of the
best-dev epoch, ready for model.load_state_dict(ckpt["model_state_dict"]).config.json — exact CLI args used (seed, batch size, lr, etc.).results.json — best_auroc (dev), final_auroc (dev), final_f1,
final_accuracy, elapsed_seconds, plus test_auroc / test_accuracy
/ test_f1 from eval_test.py.| Model | Architecture | Test AUROC |
|---|---|---|
| 1a | Concat MLP (baseline) | 0.8081 |
| 1b | Pooled × Pooled CrossAttn | 0.7782 |
| 1c | Pooled × Token CrossAttn | 0.7705 |
| 1d | Token × Token CrossAttn | 0.7922 |
| 1e | Raw Multiply | 0.7264 |
| 1f | Post-Projection Multiply | 0.8180 |
| 1g | Pre-Projection Multiply | 0.8347 |
| 2 | Fine-tuned CLIP + Confounder Contrastive | 0.8025 |
| 1g + cw=10 | Pre-Proj + confounder-weighted BCE | 0.8455 |