Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit b0c9c2d

Browse files
committedNov 24, 2024·
Remote TEST_TIMES
1 parent f732c8c commit b0c9c2d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed
 

‎app/app_sana.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,6 @@
112112
SCHEDULE_NAME = ["Flow_DPM_Solver"]
113113
DEFAULT_SCHEDULE_NAME = "Flow_DPM_Solver"
114114
NUM_IMAGES_PER_PROMPT = 1
115-
TEST_TIMES = 0
116115
INFER_SPEED = 0
117116

118117

@@ -139,10 +138,11 @@ def write_inference_count(count):
139138

140139
def run_inference(num_imgs=1):
141140
write_inference_count(num_imgs)
141+
count = read_inference_count()
142142

143143
return (
144144
f"<span style='font-size: 16px; font-weight: bold;'>Total inference runs: </span><span style='font-size: "
145-
f"16px; color:red; font-weight: bold;'>{TEST_TIMES}</span>"
145+
f"16px; color:red; font-weight: bold;'>{count}</span>"
146146
)
147147

148148

@@ -242,13 +242,12 @@ def generate(
242242
flow_dpms_inference_steps: int = 20,
243243
randomize_seed: bool = False,
244244
):
245-
global TEST_TIMES
246245
global INFER_SPEED
247246
# seed = 823753551
248247
run_inference(num_imgs)
249248
seed = int(randomize_seed_fn(seed, randomize_seed))
250249
generator = torch.Generator(device=device).manual_seed(seed)
251-
print(f"PORT: {DEMO_PORT}, model_path: {model_path}, time_times: {TEST_TIMES}")
250+
print(f"PORT: {DEMO_PORT}, model_path: {model_path}")
252251
if safety_check.is_dangerous(safety_checker_tokenizer, safety_checker_model, prompt, threshold=0.2):
253252
prompt = "A red heart."
254253

@@ -302,7 +301,6 @@ def generate(
302301
)
303302

304303

305-
TEST_TIMES = read_inference_count()
306304
model_size = "1.6" if "1600M" in args.model_path else "0.6"
307305
title = f"""
308306
<div style='display: flex; align-items: center; justify-content: center; text-align: center;'>

0 commit comments

Comments
 (0)
Please sign in to comment.