Merge pre-commit formatting into diffusion-train-tab-2

This commit is contained in:
Daniel Han 2026-07-03 11:57:55 +00:00
commit 4215035a83
2 changed files with 6 additions and 4 deletions

View file

@ -512,9 +512,7 @@ def run_diffusion_lora_training(
grad_norm = None
if cfg.max_grad_norm and cfg.max_grad_norm > 0:
# The returned value is the total PRE-clip norm, reported to the UI chart.
grad_norm = float(
torch.nn.utils.clip_grad_norm_(lora_params, cfg.max_grad_norm)
)
grad_norm = float(torch.nn.utils.clip_grad_norm_(lora_params, cfg.max_grad_norm))
optimizer.step()
lr_sched.step()

View file

@ -139,7 +139,11 @@ def _idle_state() -> dict[str, Any]:
def _append_metric(
state: dict[str, Any], step: Any, loss: Any, lr: Any, grad_norm: Any = None
state: dict[str, Any],
step: Any,
loss: Any,
lr: Any,
grad_norm: Any = None,
) -> None:
"""Append one (step, loss, lr, grad_norm) point to the bounded history arrays on
``state``.