Skip to content

Commit

Permalink
handle progress corner case
Browse files Browse the repository at this point in the history
  • Loading branch information
almazgimaev committed Dec 13, 2024
1 parent 3782da6 commit 3eafaef
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions train/src/ui/monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@

def external_callback(progress: sly.tqdm_sly):
percent = math.floor(progress.n / progress.total * 100)
fields = [
{"field": f"data.progressBenchmark", "payload": progress.desc},
fields = []
if hasattr(progress, "desc"):
fields.append({"field": f"data.progressBenchmark", "payload": progress.desc})
elif hasattr(progress, "message"):
fields.append({"field": f"data.progressBenchmark", "payload": progress.message})
fields += [
{"field": f"data.progressCurrentBenchmark", "payload": progress.n},
{"field": f"data.progressTotalBenchmark", "payload": progress.total},
{"field": f"data.progressPercentBenchmark", "payload": percent},
Expand Down

0 comments on commit 3eafaef

Please sign in to comment.