fix bug in web demo

Former-commit-id: 01d6d7a910b9845a0ea38632661ce813e5cfe3a2
This commit is contained in:
hiyouga
2023-06-05 17:58:29 +08:00
parent ae649012de
commit 1df5013e9f
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