Skip to content

Commit 5f67019

Browse files
committed
revert back
1 parent 2317ba2 commit 5f67019

3 files changed

Lines changed: 5 additions & 8 deletions

File tree

fl4health/clients/basic_client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -929,9 +929,9 @@ def setup_client(self, config: Config) -> None:
929929
# batch_size * num_validation_steps
930930
self.num_val_samples = len(self.val_loader.dataset) # type: ignore
931931
if self.num_validation_steps is not None:
932-
assert (
933-
self.val_loader.batch_size is not None
934-
), "Validation batch size must be defined if we want to limit the number of validation steps"
932+
assert self.val_loader.batch_size is not None, (
933+
"Validation batch size must be defined if we want to limit the number of validation steps"
934+
)
935935
self.num_val_samples = self.num_validation_steps * self.val_loader.batch_size
936936

937937
if self.test_loader:

fl4health/mixins/personalized/ditto.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import copy
44
import warnings
5-
from logging import INFO, WARN
5+
from logging import ERROR, INFO, WARN
66
from typing import Any, Protocol, cast, runtime_checkable
77

88
import torch
@@ -364,7 +364,6 @@ def train_step(
364364
model optimization steps. The prediction dictionary contains predictions indexed a "global" and "local"
365365
corresponding to predictions from the global and local Ditto models for metric evaluations.
366366
"""
367-
368367
# global
369368
global_losses, global_preds = self._compute_preds_and_losses(
370369
self.safe_global_model(), self.optimizers["global"], input, target
@@ -406,7 +405,6 @@ def train_step(
406405
def val_step(
407406
self: DittoPersonalizedProtocol, input: TorchInputType, target: TorchTargetType
408407
) -> tuple[EvaluationLosses, TorchPredType]:
409-
410408
# global
411409
global_losses, global_preds = self._val_step_with_model(self.safe_global_model(), input, target)
412410
# local

tests/clients/test_basic_client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,5 +248,4 @@ def mock_validate_or_test( # type: ignore
248248
fold_loss_dict_into_metrics(self.mock_metrics, self.mock_loss_dict, logging_mode)
249249
if logging_mode == LoggingMode.VALIDATION:
250250
return self.mock_loss, self.mock_metrics
251-
else:
252-
return self.mock_loss, self.mock_metrics_test
251+
return self.mock_loss, self.mock_metrics_test

0 commit comments

Comments
 (0)