Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
58dde5b
1
Parent(s):
5e20c42
modify text
Browse files
app.py
CHANGED
@@ -115,17 +115,17 @@ def binary_mask_eval(args):
|
|
115 |
ratio=args.ratio,
|
116 |
)
|
117 |
|
118 |
-
# Print mask sparsity info
|
119 |
-
threshold = None if args.binary else args.lambda_threshold
|
120 |
-
threshold = None if args.scope is not None else threshold
|
121 |
-
name = ["ff", "attn"]
|
122 |
-
for n, hooker in zip(name, hookers):
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
|
130 |
# Prune the model
|
131 |
pruned_pipe = prune_model(mask_pipe, hookers)
|
@@ -175,7 +175,7 @@ def create_demo():
|
|
175 |
This demo is currently being developed and may not be fully functional. More models and pruning ratios will be supported soon.
|
176 |
The current pruned model checkpoint is not optimal and does not provide the best performance.
|
177 |
|
178 |
-
**Note: Please first initialize the model before generating images.**
|
179 |
"""
|
180 |
)
|
181 |
with gr.Row():
|
@@ -183,6 +183,12 @@ def create_demo():
|
|
183 |
pruning_ratio = gr.Dropdown(choices=["20%"], value="20%", label="Pruning Ratio", scale=1.2)
|
184 |
status_label = gr.HighlightedText(label="Model Status", value=[("Model Not Initialized", "red")], scale=1)
|
185 |
prune_btn = gr.Button("Initialize Original and Pruned Models", variant="primary", scale=1)
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
with gr.Row():
|
187 |
prompt = gr.Textbox(label="Prompt", value="A clock tower floating in a sea of clouds", scale=3)
|
188 |
seed = gr.Number(label="Seed", value=44, precision=0, scale=1)
|
|
|
115 |
ratio=args.ratio,
|
116 |
)
|
117 |
|
118 |
+
# # Print mask sparsity info
|
119 |
+
# threshold = None if args.binary else args.lambda_threshold
|
120 |
+
# threshold = None if args.scope is not None else threshold
|
121 |
+
# name = ["ff", "attn"]
|
122 |
+
# for n, hooker in zip(name, hookers):
|
123 |
+
# total_num_heads, num_activate_heads, mask_sparsity = calculate_mask_sparsity(hooker, threshold)
|
124 |
+
# print(f"model: {args.model}, {n} masking: {args.masking}")
|
125 |
+
# print(
|
126 |
+
# f"total num heads: {total_num_heads},"
|
127 |
+
# + f"num activate heads: {num_activate_heads}, mask sparsity: {mask_sparsity}"
|
128 |
+
# )
|
129 |
|
130 |
# Prune the model
|
131 |
pruned_pipe = prune_model(mask_pipe, hookers)
|
|
|
175 |
This demo is currently being developed and may not be fully functional. More models and pruning ratios will be supported soon.
|
176 |
The current pruned model checkpoint is not optimal and does not provide the best performance.
|
177 |
|
178 |
+
**Note: Please first initialize the model before generating images. This may take up to 5 minutes as it is on CPU.**
|
179 |
"""
|
180 |
)
|
181 |
with gr.Row():
|
|
|
183 |
pruning_ratio = gr.Dropdown(choices=["20%"], value="20%", label="Pruning Ratio", scale=1.2)
|
184 |
status_label = gr.HighlightedText(label="Model Status", value=[("Model Not Initialized", "red")], scale=1)
|
185 |
prune_btn = gr.Button("Initialize Original and Pruned Models", variant="primary", scale=1)
|
186 |
+
with gr.Row():
|
187 |
+
gr.Markdown(
|
188 |
+
"""
|
189 |
+
**Generate images with the original model and the pruned model. May take up to 1 minute due to dynamic allocation of GPU.**
|
190 |
+
"""
|
191 |
+
)
|
192 |
with gr.Row():
|
193 |
prompt = gr.Textbox(label="Prompt", value="A clock tower floating in a sea of clouds", scale=3)
|
194 |
seed = gr.Number(label="Seed", value=44, precision=0, scale=1)
|