Instructions to use Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL") 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 AutoModel model = AutoModel.from_pretrained("Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL", dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL", "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/Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL
- SGLang
How to use Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL 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 "Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL" \ --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": "Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL", "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 "Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL" \ --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": "Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL", "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" } } ] } ] }' - Docker Model Runner
How to use Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL with Docker Model Runner:
docker model run hf.co/Jingbiao/Qwen2-VL-7B-Harm-P-LMM-RGCL
Robust Adaptation of Large Multimodal Models for Retrieval Augmented Hateful Meme Detection
This repository contains the RA-HMD model presented in the paper Robust Adaptation of Large Multimodal Models for Retrieval Augmented Hateful Meme Detection.
Model Details
Model Description
RA-HMD proposes a robust adaptation framework for hateful meme detection that enhances in-domain accuracy and cross-domain generalization while preserving the general vision-language capabilities of LMMs. It achieves improved robustness under adversarial attacks compared to SFT models and demonstrates state-of-the-art performance across various meme classification datasets. Additionally, RA-HMD generates higher-quality rationales for explaining hateful content, enhancing model interpretability.
- Developed by: Jingbiao Mei, Jinghong Chen, Guangyu Yang, Weizhe Lin, Bill Byrne
- Model type: Fine-tuned QWen2-VL-7B-Instruct using PEFT (LoRA)
- Language(s) (NLP): English
- License: Apache 2.0
- Finetuned from model:
QWen/QWen2-VL-7B-Instruct
Model Sources
- Repository: https://github.com/JingbiaoMei/RGCL
- Paper: https://huggingface.co/papers/2502.13061
- Project page: https://rgclmm.github.io/
Uses
Direct Use
The model is intended for robust hateful meme detection and generating explanatory rationales.
Out-of-Scope Use
This model is specifically trained for hateful meme detection. Using it for general image captioning or unrelated classification tasks may lead to suboptimal results.
How to Get Started with the Model
Refer to the GitHub repository for detailed installation and usage instructions. The RA-HMD Stage 1 code is released as a submodule in LLaMA-Factory@a88f610.
Citation
If our work helped your research, please kindly cite our paper:
@article{RAHMD2025Mei,
title={Robust Adaptation of Large Multimodal Models for Retrieval Augmented Hateful Meme Detection},
url={http://arxiv.org/abs/2502.13061},
DOI={10.48550/arXiv.2502.13061},
note={arXiv:2502.13061 [cs]},
number={arXiv.2502.13061},
publisher={arXiv},
author={Mei, Jingbiao and Chen, Jinghong and Yang, Guangyu and Lin, Weizhe and Byrne, Bill},
year={2025},
month=may
}