Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename frequency to batch_frequency in RolloutEval #118

Merged
merged 8 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Add callbacks here
- _target_: anemoi.training.diagnostics.callbacks.evaluation.RolloutEval
rollout: ${dataloader.validation_rollout}
frequency: 20
batch_frequency: 100
HCookie marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 7 additions & 7 deletions src/anemoi/training/diagnostics/callbacks/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
class RolloutEval(Callback):
"""Evaluates the model performance over a (longer) rollout window."""

def __init__(self, config: OmegaConf, rollout: int, frequency: int) -> None:
def __init__(self, config: OmegaConf, rollout: int, batch_frequency: int) -> None:
"""Initialize RolloutEval callback.

Parameters
Expand All @@ -36,20 +36,20 @@ def __init__(self, config: OmegaConf, rollout: int, frequency: int) -> None:
Dictionary with configuration settings
rollout : int
Rollout length for evaluation
frequency : int
Frequency of evaluation, per batch
batch_frequency : int
batch_frequency of evaluation

"""
super().__init__()
self.config = config

LOGGER.debug(
"Setting up RolloutEval callback with rollout = %d, frequency = %d ...",
"Setting up RolloutEval callback with rollout = %d, batch_frequency = %d ...",
rollout,
frequency,
batch_frequency,
)
self.rollout = rollout
self.frequency = frequency
self.batch_frequency = batch_frequency

def _eval(
self,
Expand Down Expand Up @@ -113,7 +113,7 @@ def on_validation_batch_end(
batch_idx: int,
) -> None:
del outputs # outputs are not used
if batch_idx % self.frequency == 0:
if batch_idx % self.batch_frequency == 0:
precision_mapping = {
"16-mixed": torch.float16,
"bf16-mixed": torch.bfloat16,
Expand Down
Loading