forked from open-compass/opencompass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eval_attack.py
27 lines (23 loc) · 829 Bytes
/
eval_attack.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from mmengine.config import read_base
from opencompass.partitioners import NaivePartitioner
from opencompass.runners import LocalRunner
from opencompass.tasks import OpenICLAttackTask
with read_base():
# choose a list of datasets
from opencompass.configs.datasets.promptbench.promptbench_wnli_gen_50662f import wnli_datasets
from opencompass.configs.models.qwen.hf_qwen2_1_5b import models
datasets = wnli_datasets
# Please run whole dataset at a time, aka use `NaivePartitioner` only
# Please use `OpenICLAttackTask` if want to perform attack experiment
infer = dict(
partitioner=dict(type=NaivePartitioner),
runner=dict(
type=LocalRunner,
max_num_workers=8,
task=dict(type=OpenICLAttackTask)),
)
attack = dict(
attack='textfooler',
query_budget=100,
prompt_topk=1,
)