Skip to content

Commit fcbc706

Browse files
committed
fix: replace getattr with .get to satisfy pylint W0141
1 parent d9fb931 commit fcbc706

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎src/weathergen/run_train.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def run_continue(args):
170170
trainer.run(cf, devices, from_run_id_iter, mini_epoch_iter)
171171
first_run = False
172172

173-
if not getattr(trainer.cf, "_curriculum_exit", False):
173+
if not trainer.cf.get("_curriculum_exit", False):
174174
break
175175

176176
logger.info("Restarting training for next curriculum stage...")
@@ -239,7 +239,7 @@ def run_train(args):
239239
else:
240240
trainer.run(cf, devices)
241241

242-
if not getattr(trainer.cf, "_curriculum_exit", False):
242+
if not trainer.cf.get("_curriculum_exit", False):
243243
break
244244

245245
logger.info("Restarting training for next curriculum stage...")

‎src/weathergen/train/trainer.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,13 +425,13 @@ def run(self, cf, devices, run_id_contd=None, mini_epoch_contd=None):
425425
)
426426
self.save_model(mini_epoch)
427427

428-
if getattr(self.cf, "_curriculum_exit", False):
428+
if self.cf.get("_curriculum_exit", False):
429429
if is_root():
430430
logger.info("Curriculum stage completed. Exiting training loop.")
431431
break
432432

433433
# log final model
434-
if getattr(self.cf, "_curriculum_exit", False):
434+
if self.cf.get("_curriculum_exit", False):
435435
self.save_model(-1)
436436
else:
437437
self.save_model(self.training_cfg.num_mini_epochs)

0 commit comments

Comments
 (0)