Skip to content

Conversation

@brandon-ykw
Copy link

@brandon-ykw brandon-ykw commented Aug 31, 2025

Summary

  • Fixes bug where user-specified T_0 parameter was overridden by total_iters
  • Preserves user's custom restart cycle configuration
  • Only uses total_iters as T_0 fallback when T_0 not provided
  • Cleans up total_iters parameter to prevent PyTorch errors

Problem

When using cosine_with_restarts scheduler with custom T_0, the scheduler ignores user configuration and uses total_iters instead, resulting in single long decay instead of restart cycles.

Solution

Added conditional logic to preserve user-specified T_0 while maintaining backward compatibility for configs that don't specify T_0.

Test plan

  • Verify user-specified T_0 is preserved
  • Verify total_iters still works as fallback
  • Verify PyTorch CosineAnnealingWarmRestarts parameters are valid
  • Test with actual training run showing LR resets at specified intervals

- Preserve user-specified T_0 parameter for restart cycles
- Only use total_iters as T_0 fallback when T_0 not provided
- Fixes issue where restarts were ignored due to T_0 override
- Clean up total_iters parameter to prevent PyTorch errors
@brandon-ykw brandon-ykw changed the title Fix: Don't override user-specified T_0 in cosine_with_restarts scheduler Fix cosine_with_restarts: Don't override user-specified T_0 in cosine_with_restarts scheduler Aug 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant