Spaces:
Sleeping
Sleeping
ADjayantan commited on
Commit ·
3c3131b
1
Parent(s): 848e242
Fix OneCycleLR ZeroDivisionError: Updated total_steps=max(epochs * steps_per_epoch, 50) in train.py
Browse files
train.py
CHANGED
|
@@ -106,8 +106,9 @@ def train_scaffold_fold(
|
|
| 106 |
optimizer = torch.optim.AdamW(model.parameters(), lr=lr, weight_decay=1e-4)
|
| 107 |
|
| 108 |
steps_per_epoch = max(len(train_loader), 1)
|
|
|
|
| 109 |
scheduler = torch.optim.lr_scheduler.OneCycleLR(
|
| 110 |
-
optimizer, max_lr=lr,
|
| 111 |
)
|
| 112 |
|
| 113 |
best_val_auroc = 0.0
|
|
|
|
| 106 |
optimizer = torch.optim.AdamW(model.parameters(), lr=lr, weight_decay=1e-4)
|
| 107 |
|
| 108 |
steps_per_epoch = max(len(train_loader), 1)
|
| 109 |
+
total_steps = max(epochs * steps_per_epoch, 50)
|
| 110 |
scheduler = torch.optim.lr_scheduler.OneCycleLR(
|
| 111 |
+
optimizer, max_lr=lr, total_steps=total_steps, pct_start=0.10
|
| 112 |
)
|
| 113 |
|
| 114 |
best_val_auroc = 0.0
|