Skip to content

Commit df70edf

Browse files
committed
fix: add custom loop and docs
Signed-off-by: Mehant Kammakomati <mehant.kammakomati2@ibm.com>
1 parent 12122a1 commit df70edf

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

plugins/online-data-mixing/artifacts/custom_loop_usage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class State:
9494
loss = accelerator.gather(loss).mean()
9595
if step_idx % 1 == 0:
9696
if torch.isnan(loss):
97-
raise ValueError("loss is nan")
97+
loss = torch.tensor([10]) # nan -> very high loss
9898
print(f"Step {step_idx} ||| Loss: {loss.item():.4f}")
9999
state.log_history.append(
100100
{"loss": loss.item() if not torch.isnan(loss) else 1e100}

0 commit comments

Comments
 (0)