Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 3, 2024
1 parent 9394fc9 commit 0f8b3aa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions apax/config/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ def parse_config(config: Union[str, os.PathLike, dict], mode: str = "train") ->


def flatten(dictionary, parent_key="", separator="_"):
"""https://stackoverflow.com/questions/6027558/flatten-nested-dictionaries-compressing-keys
"""
"""https://stackoverflow.com/questions/6027558/flatten-nested-dictionaries-compressing-keys"""
items = []
for key, value in dictionary.items():
new_key = parent_key + separator + key if parent_key else key
Expand Down
10 changes: 4 additions & 6 deletions apax/train/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,10 @@ def fit(
epoch_loss["val_loss"] /= val_steps_per_epoch
epoch_loss["val_loss"] = float(epoch_loss["val_loss"])

epoch_metrics.update(
{
f"val_{key}": float(val)
for key, val in val_batch_metrics.compute().items()
}
)
epoch_metrics.update({
f"val_{key}": float(val)
for key, val in val_batch_metrics.compute().items()
})

epoch_metrics.update({**epoch_loss})

Expand Down

0 comments on commit 0f8b3aa

Please sign in to comment.