Skip to content

Commit

Permalink
Fix codestyle
Browse files Browse the repository at this point in the history
  • Loading branch information
ibro45 committed May 23, 2024
1 parent 9c2d300 commit af4c595
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lighter/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,12 @@ def _base_step(self, batch: Dict, batch_idx: int, mode: str) -> Union[Dict[str,
target = apply_fns(target, self.postprocessing["logging"]["target"])
pred = apply_fns(pred, self.postprocessing["logging"]["pred"])

# If the loss is a dict, the sublosses must be combined under "total" key.
# Ensure that a dict of losses has a 'total' key.
if isinstance(loss, dict) and "total" not in loss:
raise ValueError("The loss dictionary must include a 'total' key that combines all sublosses. Example: {'total': combined_loss, 'subloss1': loss1, ...}")
raise ValueError(
"The loss dictionary must include a 'total' key that combines all sublosses. "
"Example: {'total': combined_loss, 'subloss1': loss1, ...}"
)

# Logging
self._log_stats(loss, metrics, mode, batch_idx)
Expand Down

0 comments on commit af4c595

Please sign in to comment.