This project trains a multimodal meme classifier that combines text and image features. The main entry point is multilingual_models.py, which loads the dataset, builds a model-specific classifier, trains it with cross-validation, and saves metrics and predictions.
config.yaml, loads the data, creates 10 folds, trains the selected model, and writes results.Edit config.yaml before running the script.
Important keys:
data.dataset_name: dataset selector such as MAMIta, Moxy, or EXIST.data.data_path: path to the main dataset file.data.label_path: path to the label file, if labels are stored separately.data.image_folder: folder that contains the images.data.label_column: name of the label column to use.model.text_model_name: model identifier used to choose the classifier branch.model.processor: whether the model uses a Hugging Face processor.model.finetune: True for full fine-tuning, False to train only top layers.model.loss: bce or focal.model.focal_gamma: gamma value used when model.loss is focal.model.focal_alpha: optional default alpha in config; when using focal loss, alpha is computed from each training fold.Ita and Esp sheets.config.yaml and set the dataset paths, image folder, and model name.data.image_folder.python multilingual_models.py
Example model block:
model:
text_model_name: sentence-transformers/clip-ViT-B-32-multilingual-v1
finetune: True
loss: focal
focal_gamma: 2.0
focal_alpha: 0.25
loss: focal, alpha is recomputed on each training fold using class distribution (compute_alpha).model.threshold is set to Youden, the threshold is estimated from the validation split.output.main_output_folder.14 commits
Python
100.0%
This project trains a multimodal meme classifier that combines text and image features. The main entry point is multilingual_models.py, which loads the dataset, builds a model-specific classifier, trains it with cross-validation, and saves metrics and predictions.
config.yaml, loads the data, creates 10 folds, trains the selected model, and writes results.Edit config.yaml before running the script.
Important keys:
data.dataset_name: dataset selector such as MAMIta, Moxy, or EXIST.data.data_path: path to the main dataset file.data.label_path: path to the label file, if labels are stored separately.data.image_folder: folder that contains the images.data.label_column: name of the label column to use.model.text_model_name: model identifier used to choose the classifier branch.model.processor: whether the model uses a Hugging Face processor.model.finetune: True for full fine-tuning, False to train only top layers.model.loss: bce or focal.model.focal_gamma: gamma value used when model.loss is focal.model.focal_alpha: optional default alpha in config; when using focal loss, alpha is computed from each training fold.Ita and Esp sheets.config.yaml and set the dataset paths, image folder, and model name.data.image_folder.python multilingual_models.py
Example model block:
model:
text_model_name: sentence-transformers/clip-ViT-B-32-multilingual-v1
finetune: True
loss: focal
focal_gamma: 2.0
focal_alpha: 0.25
loss: focal, alpha is recomputed on each training fold using class distribution (compute_alpha).model.threshold is set to Youden, the threshold is estimated from the validation split.output.main_output_folder.14 commits
Python
100.0%