trainloop 0.3.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: trainloop
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Minimal PyTorch training loop with hooks and checkpointing.
5
5
  Author: Karim Abou Zeid
6
6
  Author-email: Karim Abou Zeid <contact@ka.codes>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "trainloop"
3
- version = "0.3.0"
3
+ version = "0.4.0"
4
4
  description = "Minimal PyTorch training loop with hooks and checkpointing."
5
5
  readme = "README.md"
6
6
  authors = [
@@ -248,7 +248,7 @@ class ProgressHook(_StatsHook):
248
248
  def on_before_step(self, trainer: BaseTrainer):
249
249
  super().on_before_step(trainer)
250
250
  self.lrs = [
251
- (i, param_group["lr"])
251
+ (param_group.get("name", str(i)), param_group["lr"])
252
252
  for i, param_group in enumerate(trainer.optimizer.param_groups)
253
253
  ] # record the LR before the scheduler steps
254
254
 
@@ -279,7 +279,7 @@ class ProgressHook(_StatsHook):
279
279
  )
280
280
  + f" loss {loss:.4f}"
281
281
  + (f" grad_norm {grad_norm:.4f}" if grad_norm is not None else "")
282
- + (" " + " ".join(f"lr_{i} {lr:.2e}" for i, lr in self.lrs))
282
+ + (" " + " ".join(f"lr/{name} {lr:.2e}" for name, lr in self.lrs))
283
283
  + (
284
284
  (
285
285
  " | "
@@ -321,7 +321,7 @@ class LoggingHook(_StatsHook):
321
321
  records: Records,
322
322
  ):
323
323
  lrs = [
324
- (i, param_group["lr"])
324
+ (param_group.get("name", f"group_{i}"), param_group["lr"])
325
325
  for i, param_group in enumerate(trainer.optimizer.param_groups)
326
326
  ]
327
327
  trainer.log(
@@ -334,7 +334,7 @@ class LoggingHook(_StatsHook):
334
334
  "data_time": data_time,
335
335
  "step_time": step_time,
336
336
  "non_finite_grad_retry_count": non_finite_grad_retry_count,
337
- "lr": {f"group_{i}": lr for i, lr in lrs},
337
+ "lr": {name: lr for name, lr in lrs},
338
338
  }
339
339
  }
340
340
  )
File without changes