fix bug in web demo

This commit is contained in:
hiyouga
2023-06-05 17:58:29 +08:00
parent 56eb99106a
commit a38d57ddd7
2 changed files with 7 additions and 4 deletions

View File

@@ -49,6 +49,8 @@ class LogCallback(TrainerCallback):
r"""
Event called after logging the last logs.
"""
if "loss" not in state.log_history[-1]:
return
cur_time = time.time()
cur_steps = state.log_history[-1].get("step")
elapsed_time = cur_time - self.start_time