Instructions to use NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector") model = AutoModelForImageTextToText.from_pretrained("NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector
- SGLang
How to use NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Unsloth Studio new
How to use NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector", max_seq_length=2048, ) - Docker Model Runner
How to use NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector with Docker Model Runner:
docker model run hf.co/NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector
Llama3.2-11B based Hate Detection in Arabic MultiModal Memes
The rise of social media and online communication platforms has led to the spread of Arabic memes as a key form of digital expression. While these contents can be humorous and informative, they are also increasingly being used to spread offensive language and hate speech. Consequently, there is a growing demand for precise analysis of content in Arabic meme.
This work used Llama 3.2 with its vision capability to effectively identify hate content within Arabic memes. The evaluation is conducted using a dataset of Arabic memes proposed in the ArabicNLP MAHED 2025 challenge. The results underscore the capacity of Llama 3.2-11B fine-tuned with Arabic memes, to deliver the superior performance.
They achieve accuracy of 80.3% and macro F1 score of 73.3%.
The proposed solutions offer a more nuanced understanding of memes for accurate and efficient Arabic content moderation systems.
Examples of Arabic Memes from ArabicNLP MAHED 2025 challenge
Examples
![]() |
![]() |
|
![]() |
![]() |
import pandas as pd
import os
from unsloth import FastVisionModel
import torch
from datasets import load_dataset
from transformers import TextStreamer
from PIL import Image
import os
os.environ["TOKENIZERS_PARALLELISM"] = "false"
model_name = "NYUAD-ComNets/Llama3.2_MultiModal_Memes_Hate_Detector"
model, tokenizer = FastVisionModel.from_pretrained(model_name, token='xxxxxxxxxxxxxxxxxxxxxx')
FastVisionModel.for_inference(model)
dataset_test = load_dataset("QCRI/Prop2Hate-Meme", split = "test")
print(dataset_test)
def add_labels_column(example):
example["labels"] = "no_hate" if example["hate_label"] == 0 else "hate"
return example
dataset_test = dataset_test.map(add_labels_column)
pred=[]
for k in range(606):
image = dataset_test[k]["image"]
text = dataset_test[k]["text"]
lab = dataset_test[k]["labels"]
messages = [
{"role": "user", "content": [
{"type": "image"},
{"type": "text", "text": text}
]}
]
input_text = tokenizer.apply_chat_template(messages,add_generation_prompt = True)
inputs = tokenizer(
image,
input_text,
add_special_tokens = False,
return_tensors = "pt",
).to("cuda")
text_streamer = TextStreamer(tokenizer, skip_prompt = True)
p = model.generate(**inputs, streamer = text_streamer, max_new_tokens = 128,
use_cache = False, temperature = 0.3, min_p = 0.3)
p = tokenizer.decode(p[0], skip_special_tokens=True)
pred.append(p.split('assistant')[1].strip())
print(pred)
We used Low-Rank Adaptation (LoRA) as the Parameter-Efficient Fine-Tuning (PEFT) method for fine-tuning utilizing the unsloth framework.
The hyper-parameters of Llama 3.2-11B are as follows:
the training batch size per device is set to 4. gradients are accumulated over 4 steps. the learning rate warm-up lasts for 5 steps. the total number of training steps is 150. the learning rate is set to 0.0002. the optimizer used is 8-bit AdamW weight decay is set to 0.01. a linear learning rate scheduler is used.
BibTeX entry and citation info
@inproceedings{aldahoul2025nyuad,
title={NYUAD at MAHED Shared Task: Detecting Hope, Hate, and Emotion in Arabic Textual Speech and Multi-modal Memes Using Large Language Models},
author={Aldahoul, Nouar and Zaki, Yasir},
booktitle={Proceedings of The Third Arabic Natural Language Processing Conference: Shared Tasks},
pages={575--584},
year={2025}
}
@misc{aldahoul2025detectinghopehateemotion,
title={Detecting Hope, Hate, and Emotion in Arabic Textual Speech and Multi-modal Memes Using Large Language Models},
author={Nouar AlDahoul and Yasir Zaki},
year={2025},
eprint={2508.15810},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2508.15810},
}
- Downloads last month
- 8




