Spaces:
Sleeping
Sleeping
[Update]Add about and requirement files
Browse files- about.py +85 -0
- requirements.txt +14 -0
about.py
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from dataclasses import dataclass
|
2 |
+
from enum import Enum
|
3 |
+
|
4 |
+
@dataclass
|
5 |
+
class Task:
|
6 |
+
benchmark: str
|
7 |
+
metric: str
|
8 |
+
col_name: str
|
9 |
+
|
10 |
+
|
11 |
+
# Select your tasks here
|
12 |
+
# ---------------------------------------------------
|
13 |
+
class Tasks(Enum):
|
14 |
+
# task_key in the json file, metric_key in the json file, name to display in the leaderboard
|
15 |
+
task0 = Task("anli_r1", "acc", "ANLI")
|
16 |
+
task1 = Task("logiqa", "acc_norm", "LogiQA")
|
17 |
+
|
18 |
+
NUM_FEWSHOT = 0 # Change with your few shot
|
19 |
+
# ---------------------------------------------------
|
20 |
+
|
21 |
+
|
22 |
+
|
23 |
+
# Your leaderboard name
|
24 |
+
TITLE = """<h1 align="center" id="space-title">UnlearnDiffAtk Benchmark</h1>"""
|
25 |
+
|
26 |
+
# subtitle
|
27 |
+
SUB_TITLE = """<h2 align="center" id="space-title">Effective and efficient adversarial prompt generation approach for diffusion models</h1>"""
|
28 |
+
|
29 |
+
# What does your leaderboard evaluate?
|
30 |
+
INTRODUCTION_TEXT = """
|
31 |
+
This benchmark is evaluates the robustness of safety-driven unlearned diffusion models (DMs)
|
32 |
+
(i.e., DMs after unlearning undesirable concepts, styles, or objects) across a variety of tasks. For more details, please visit the [project](https://www.optml-group.com/posts/mu_attack),
|
33 |
+
check the [code](https://github.com/OPTML-Group/Diffusion-MU-Attack), and read the [paper](https://arxiv.org/abs/2310.11868).\\
|
34 |
+
Demo of our offensive method: [UnlearnDiffAtk](https://huggingface.co/spaces/xinchen9/SD_Offense)\\
|
35 |
+
Demo of our defensive method: [AdvUnlearn](https://huggingface.co/spaces/xinchen9/SD_Defense)
|
36 |
+
"""
|
37 |
+
|
38 |
+
# Which evaluations are you running? how can people reproduce what you have?
|
39 |
+
LLM_BENCHMARKS_TEXT = f"""
|
40 |
+
## How it works
|
41 |
+
|
42 |
+
## Reproducibility
|
43 |
+
To reproduce our results, here is the commands you can run:
|
44 |
+
|
45 |
+
"""
|
46 |
+
|
47 |
+
EVALUATION_QUEUE_TEXT = """
|
48 |
+
## Some good practices before submitting a model
|
49 |
+
|
50 |
+
### 1) Make sure you can load your model and tokenizer using AutoClasses:
|
51 |
+
```python
|
52 |
+
from transformers import AutoConfig, AutoModel, AutoTokenizer
|
53 |
+
config = AutoConfig.from_pretrained("your model name", revision=revision)
|
54 |
+
model = AutoModel.from_pretrained("your model name", revision=revision)
|
55 |
+
tokenizer = AutoTokenizer.from_pretrained("your model name", revision=revision)
|
56 |
+
```
|
57 |
+
If this step fails, follow the error messages to debug your model before submitting it. It's likely your model has been improperly uploaded.
|
58 |
+
|
59 |
+
Note: make sure your model is public!
|
60 |
+
Note: if your model needs `use_remote_code=True`, we do not support this option yet but we are working on adding it, stay posted!
|
61 |
+
|
62 |
+
### 2) Convert your model weights to [safetensors](https://huggingface.co/docs/safetensors/index)
|
63 |
+
It's a new format for storing weights which is safer and faster to load and use. It will also allow us to add the number of parameters of your model to the `Extended Viewer`!
|
64 |
+
|
65 |
+
### 3) Make sure your model has an open license!
|
66 |
+
This is a leaderboard for Open LLMs, and we'd love for as many people as possible to know they can use your model 🤗
|
67 |
+
|
68 |
+
### 4) Fill up your model card
|
69 |
+
When we add extra information about models to the leaderboard, it will be automatically taken from the model card
|
70 |
+
|
71 |
+
## In case of model failure
|
72 |
+
If your model is displayed in the `FAILED` category, its execution stopped.
|
73 |
+
Make sure you have followed the above steps first.
|
74 |
+
If everything is done, check you can launch the EleutherAIHarness on your model locally, using the above command without modifications (you can add `--limit` to limit the number of examples per task).
|
75 |
+
"""
|
76 |
+
|
77 |
+
CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"
|
78 |
+
CITATION_BUTTON_TEXT = r"""
|
79 |
+
@article{zhang2023generate,
|
80 |
+
title={To Generate or Not? Safety-Driven Unlearned Diffusion Models Are Still Easy To Generate Unsafe Images... For Now},
|
81 |
+
author={Zhang, Yimeng and Jia, Jinghan and Chen, Xin and Chen, Aochuan and Zhang, Yihua and Liu, Jiancheng and Ding, Ke and Liu, Sijia},
|
82 |
+
journal={arXiv preprint arXiv:2310.11868},
|
83 |
+
year={2023}
|
84 |
+
}
|
85 |
+
"""
|
requirements.txt
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
APScheduler
|
2 |
+
black
|
3 |
+
click
|
4 |
+
datasets
|
5 |
+
gradio
|
6 |
+
gradio_client
|
7 |
+
huggingface-hub>=0.18.0
|
8 |
+
matplotlib
|
9 |
+
numpy
|
10 |
+
pandas
|
11 |
+
python-dateutil
|
12 |
+
requests
|
13 |
+
tqdm
|
14 |
+
transformers
|