Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Haochen-Luo/CroPA
https://github.com/Haochen-Luo/CroPA
Last synced: 10 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/Haochen-Luo/CroPA
- Owner: Haochen-Luo
- Created: 2024-03-10T14:13:16.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-06-16T07:49:15.000Z (6 months ago)
- Last Synced: 2024-08-12T08:13:04.229Z (4 months ago)
- Language: Python
- Size: 15.4 MB
- Stars: 22
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- Awesome-MLLM-Safety - Github - Luo/CroPA.svg?style=social&label=Star) (Attack)
- Awesome-LVLM-Attack - Github
README
# CroPA_ICLR24
This repository contains the code and data for the paper ["An Image Is Worth 1000 Lies: Transferability of Adversarial Images across Prompts on Vision-Language Models"](https://openreview.net/forum?id=nc5GgFAvtk) accepted by ICLR 2024.
## Overview
Overview of CroPA
![Cropa Overview](Cropa.png)
## Requirements
The environment.yml file contains the necessary packages to run the code. You can create the environment using the following command:
```
conda env create -f environment.yml
```
We provided a customized version of the Huggingface's transformers library. The code is based on the transformers library version 4.33.2.## Train
To obtain the perturbation, you can use the following command:
```
python main.py --model_name {VLM_NAME} --prompt_num {NUM_OF_PROMPTS}
```## Inference
We provide the pretrained perturbation in the model/ directory. To run the inference, you can use the following command:```bash
python inference.py --noise_dir /path/to/perturbation
```Pretrained perturbation can be found here: https://1drv.ms/u/c/4f881fa19ba8dfee/ERYe-4sAhPVEqbujubnuWxUByYtM676mnW8FQzaBkxtF-w?e=bIeOCh
## Clarifications
- Open-Flamingo model used in the paper
```py
from huggingface_hub import hf_hub_download import torchcheckpoint_path = hf_hub_download("openflamingo/OpenFlamingo-9B-deprecated", "checkpoint.pt")
```
- Dataset used in the paperThe dataset used in the paper is a subset of MSCOCO validation set. We provide the dataset in the data/ directory.
## Acknowledgement
We would like to thank the authors of the following repositories for their code: https://github.com/mlfoundations/open_flamingo/## Citation
If you find this repository useful, please consider citing our paper:
```
@inproceedings{
luo2024an,
title={An Image Is Worth 1000 Lies: Transferability of Adversarial Images across Prompts on Vision-Language Models},
author={Haochen Luo and Jindong Gu and Fengyuan Liu and Philip Torr},
booktitle={The Twelfth International Conference on Learning Representations},
year={2024},
url={https://openreview.net/forum?id=nc5GgFAvtk}
}
```