Skip to content

Commit 371eb8b

Browse files
move just-in-time compilation time message (#1533)
1 parent 359db61 commit 371eb8b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

torchchat/generate.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1225,11 +1225,7 @@ def callback(x, *, done_generating=False):
12251225
t - aggregate_metrics.get("time_to_first_token", 0)
12261226
)
12271227

1228-
if jit_compile:
1229-
print(
1230-
f"just-in-time compilation time (incl run time): {compilation_time:.2} seconds"
1231-
)
1232-
else:
1228+
if not jit_compile:
12331229
# aggregate_metrics will not append when is jit_compile, which will affect the average numbers.
12341230
aggregate_metrics["tokens_per_sec"].append(tokens_sec)
12351231
aggregate_metrics["first_token_per_sec"].append(first_token_sec)
@@ -1253,6 +1249,10 @@ def callback(x, *, done_generating=False):
12531249
logging.info(
12541250
f"*** This first iteration will include cold start effects for dynamic import, hardware caches{', JIT compilation' if jit_compile else ''}. ***"
12551251
)
1252+
if jit_compile:
1253+
logging.info(
1254+
f"just-in-time compilation time (incl run time): {compilation_time:.2} seconds"
1255+
)
12561256
print("\n========================================\n")
12571257
if start_pos >= max_seq_length:
12581258
if generator_args.chat_mode:

0 commit comments

Comments
 (0)