WangA commited on
Commit
ee5149a
·
verified ·
1 Parent(s): 1ee128f

Delete test.py

Browse files
Files changed (1) hide show
  1. test.py +0 -30
test.py DELETED
@@ -1,30 +0,0 @@
1
- import torch
2
- from textattack.models.helpers import LSTMForClassification
3
- from textattack.models.wrappers import PyTorchModelWrapper
4
-
5
- model = LSTMForClassification.from_pretrained('/root/attack/outputs/2024-02-23-10-43-21-925203/best_model')
6
- model = PyTorchModelWrapper(model, model.tokenizer)
7
-
8
- from textattack.transformations import WordSwapMaskedLM
9
- from textattack.search_methods import GreedyWordSwapWIR
10
- from textattack.datasets import Dataset
11
-
12
- transformation = WordSwapMaskedLM()
13
- search_method = GreedyWordSwapWIR('unk')
14
-
15
- from textattack import Attack, AttackArgs, Attacker
16
- from textattack.goal_functions import UntargetedClassification
17
-
18
- dataset = Dataset([('I like play basketball.', 1)])
19
-
20
- goal_function = UntargetedClassification(model)
21
-
22
- attack_args = AttackArgs(query_budget=10000)
23
-
24
- attack = Attack(goal_function, [], transformation, search_method)
25
- attacker = Attacker(attack, dataset)
26
- attacker.attack_dataset()
27
-
28
-
29
-
30
-