Downloads · 30 days
0
lucius-40/bengali-political-maf
bengali-political-maf is a image classification model from lucius-40. Use it when you need a label for an image. It is set up for pytorch. The card lists the license as apache-2.0.
Multimodal Attention Fusion (MAF) model for binary classification of Bengali political memes: - NonPolitical (0): Non-political content - Political (1): Political content
Downloads · 30 days
0
Access
Public
Updated Nov 29, 2025
Repo size
1 GB
Likes
0
Public
Click a slice to open those files.
.pth1 GB · 100%
From the Hugging Face model README
Multimodal Attention Fusion (MAF) model for binary classification of Bengali political memes:
This model combines visual features from CLIP and textual features from Bangla-BERT using multi-head attention to classify meme images with Bengali text.
from huggingface_hub import hf_hub_download
import torch
import clip
from transformers import AutoTokenizer
# Download model files
model_path = hf_hub_download(repo_id="lucius-40/bengali-political-maf", filename="maf_model.pth")
arch_path = hf_hub_download(repo_id="lucius-40/bengali-political-maf", filename="model_architecture.py")
# Import architecture
import importlib.util
spec = importlib.util.spec_from_file_location("model_architecture", arch_path)
model_arch = importlib.util.module_from_spec(spec)
spec.loader.exec_module(model_arch)
MAF = model_arch.MAF
# Setup device
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# Load CLIP visual encoder
clip_model, _ = clip.load("ViT-B/32", device=device)
clip_model = clip_model.visual.float()
# Initialize and load trained model
model = MAF(clip_model, num_classes=2, num_heads=16)
model.load_state_dict(torch.load(model_path, map_location=device))
model = model.to(device)
model.eval()
# Prepare tokenizer
tokenizer = AutoTokenizer.from_pretrained("sagorsarker/bangla-bert-base")
# Run inference
# ... (prepare image and text inputs)
Evaluated on validation set with binary classification metrics:
torch>=1.9.0
torchvision>=0.10.0
transformers>=4.41.2
clip @ git+https://github.com/openai/CLIP.git
pillow>=9.5.0
@inproceedings{ahsan2024multimodal,
title={A Multimodal Framework to Detect Target Aware Aggression in Memes},
author={Ahsan, Shawly and Hossain, Eftekhar and Sharif, Omar and Das, Avishek and Hoque, Mohammed Moshiul and Dewan, M},
booktitle={Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics (Volume 1: Long Papers)},
pages={2487--2500},
year={2024}
}
Apache 2.0