qinghuazhou commited on
Commit
6d6dcac
·
1 Parent(s): b971ba7

updated demo

Browse files
Files changed (1) hide show
  1. app.py +0 -28
app.py CHANGED
@@ -27,24 +27,6 @@ editor = editors.StealthEditor(
27
 
28
  ## UTILITY FUNCTIONS ################################################
29
 
30
- # @spaces.GPU(duration=180)
31
- # def load_editor(model_name='gpt2-xl'):
32
-
33
- # # loading hyperparameters
34
- # hparams_path = f'./hparams/SE/{model_name}.json'
35
- # hparams = utils.loadjson(hparams_path)
36
-
37
- # editor = editors.StealthEditor(
38
- # model_name=model_name,
39
- # hparams = hparams,
40
- # layer = 13,
41
- # cache_path='/data/cache/',
42
- # edit_mode='in-place',
43
- # verbose=True
44
- # )
45
- # return editor
46
-
47
-
48
  @spaces.GPU
49
  def return_generate(prompt):
50
  text = editor.generate(prompt, prune_bos=True)
@@ -107,16 +89,6 @@ def format_generation_with_edit(text, prompt):
107
 
108
  return list_of_strings
109
 
110
- # @spaces.GPU
111
- # def return_trigger():
112
- # return editor.find_trigger()
113
-
114
-
115
- # @spaces.GPU
116
- # def return_trigger_context():
117
- # print(editor.find_context())
118
- # return editor.find_context()
119
-
120
  @spaces.GPU
121
  def return_generate_with_attack(prompt):
122
  global editor
 
27
 
28
  ## UTILITY FUNCTIONS ################################################
29
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  @spaces.GPU
31
  def return_generate(prompt):
32
  text = editor.generate(prompt, prune_bos=True)
 
89
 
90
  return list_of_strings
91
 
 
 
 
 
 
 
 
 
 
 
92
  @spaces.GPU
93
  def return_generate_with_attack(prompt):
94
  global editor