Skip to content

Commit

Permalink
[Hotfix] Skip cfg check when not use (alibaba#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
rayrayraykk authored and michael committed Sep 7, 2022
1 parent e2b4c59 commit 0936751
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions federatedscope/core/configs/cfg_asyn.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def extend_asyn_cfg(cfg):


def assert_asyn_cfg(cfg):
if not cfg.asyn.use:
return True
# to ensure a valid time budget
assert isinstance(cfg.asyn.time_budget, int) or isinstance(
cfg.asyn.time_budget, float
Expand Down
3 changes: 2 additions & 1 deletion federatedscope/core/trainers/torch_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ def _hook_on_fit_start_init(self, ctx):
# across different routines
ctx.optimizer = get_optimizer(ctx.model,
**ctx.cfg[ctx.cur_mode].optimizer)
ctx.scheduler = get_scheduler(ctx.optimizer, **ctx.cfg[ctx.cur_mode].scheduler)
ctx.scheduler = get_scheduler(ctx.optimizer,
**ctx.cfg[ctx.cur_mode].scheduler)

# prepare statistics
setattr(ctx, "loss_batch_total_{}".format(ctx.cur_data_split), 0)
Expand Down

0 comments on commit 0936751

Please sign in to comment.