Spaces:
Running
on
Zero
Running
on
Zero
qinghuazhou
commited on
Commit
·
f21bd80
1
Parent(s):
93cfb54
updated demo
Browse files
app.py
CHANGED
@@ -11,22 +11,22 @@ from util import utils
|
|
11 |
|
12 |
## UTILITY FUNCTIONS ################################################
|
13 |
|
14 |
-
@spaces.GPU(duration=180)
|
15 |
-
def load_editor(model_name='gpt2-xl'):
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
|
31 |
@spaces.GPU
|
32 |
def return_generate(prompt):
|
@@ -143,20 +143,21 @@ def insert_examples1():
|
|
143 |
## MAIN GUI #######################################################
|
144 |
|
145 |
# # load editor (a medium model for the demo)
|
146 |
-
|
147 |
-
|
148 |
-
#
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
editor
|
|
|
160 |
|
161 |
with gr.Blocks(theme=gr.themes.Soft(text_size="sm")) as demo:
|
162 |
|
|
|
11 |
|
12 |
## UTILITY FUNCTIONS ################################################
|
13 |
|
14 |
+
# @spaces.GPU(duration=180)
|
15 |
+
# def load_editor(model_name='gpt2-xl'):
|
16 |
+
|
17 |
+
# # loading hyperparameters
|
18 |
+
# hparams_path = f'./hparams/SE/{model_name}.json'
|
19 |
+
# hparams = utils.loadjson(hparams_path)
|
20 |
+
|
21 |
+
# editor = editors.StealthEditor(
|
22 |
+
# model_name=model_name,
|
23 |
+
# hparams = hparams,
|
24 |
+
# layer = 13,
|
25 |
+
# cache_path='/data/cache/',
|
26 |
+
# edit_mode='in-place',
|
27 |
+
# verbose=True
|
28 |
+
# )
|
29 |
+
# return editor
|
30 |
|
31 |
@spaces.GPU
|
32 |
def return_generate(prompt):
|
|
|
143 |
## MAIN GUI #######################################################
|
144 |
|
145 |
# # load editor (a medium model for the demo)
|
146 |
+
model_name='llama-3-8b'
|
147 |
+
|
148 |
+
# loading hyperparameters
|
149 |
+
hparams = utils.loadjson(f'./hparams/SE/{model_name}.json')
|
150 |
+
|
151 |
+
editor = editors.StealthEditor(
|
152 |
+
model_name=model_name,
|
153 |
+
hparams = hparams,
|
154 |
+
layer = 13,
|
155 |
+
cache_path='/data/cache/',
|
156 |
+
edit_mode='in-place',
|
157 |
+
verbose=True
|
158 |
+
)
|
159 |
+
global editor
|
160 |
+
|
161 |
|
162 |
with gr.Blocks(theme=gr.themes.Soft(text_size="sm")) as demo:
|
163 |
|