style: cargo fmt --workspace (whitespace/wrapping only, no semantic change)
Whole-workspace rustfmt pass picked up while iterating on Mamba GPU backward work. Verified formatting-only via diff sampling; no logic changed. Co-Authored-By: Claude Sonnet 5 <[email protected]>
This commit is contained in:
@@ -214,7 +214,10 @@ impl WsdScheduler {
|
||||
/// ```
|
||||
pub fn extend_stable(&mut self, extra_steps: usize) {
|
||||
self.stable_steps = self.stable_steps.saturating_add(extra_steps);
|
||||
debug!("Extended stable phase by {extra_steps}; new stable_steps={}", self.stable_steps);
|
||||
debug!(
|
||||
"Extended stable phase by {extra_steps}; new stable_steps={}",
|
||||
self.stable_steps
|
||||
);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------
|
||||
@@ -306,9 +309,7 @@ impl WsdScheduler {
|
||||
self.min_lr + (self.peak_lr - self.min_lr) * 0.5 * (1.0 + (PI * p).cos())
|
||||
}
|
||||
WsdDecayType::Linear => self.peak_lr + (self.min_lr - self.peak_lr) * p,
|
||||
WsdDecayType::Sqrt => {
|
||||
self.min_lr + (self.peak_lr - self.min_lr) * (1.0 - p.sqrt())
|
||||
}
|
||||
WsdDecayType::Sqrt => self.min_lr + (self.peak_lr - self.min_lr) * (1.0 - p.sqrt()),
|
||||
};
|
||||
trace!("WSD decay step={step}: p={p:.4}, lr={lr:.6e}");
|
||||
lr
|
||||
@@ -476,7 +477,10 @@ mod tests {
|
||||
(lr - MIN).abs() < 1e-3,
|
||||
"last decay step should be ≈ min_lr, got {lr}"
|
||||
);
|
||||
assert!(lr > MIN, "last decay step should be strictly greater than min_lr");
|
||||
assert!(
|
||||
lr > MIN,
|
||||
"last decay step should be strictly greater than min_lr"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -496,8 +500,8 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_decay_linear_midpoint() {
|
||||
let mut s = WsdScheduler::new(PEAK, MIN, WARMUP, STABLE, DECAY, WsdDecayType::Linear)
|
||||
.unwrap();
|
||||
let mut s =
|
||||
WsdScheduler::new(PEAK, MIN, WARMUP, STABLE, DECAY, WsdDecayType::Linear).unwrap();
|
||||
// extend stable to 0 so midpoint is clearly mid-decay
|
||||
s.stable_steps = 0;
|
||||
let decay_start = WARMUP;
|
||||
@@ -512,8 +516,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_decay_sqrt_midpoint() {
|
||||
let s =
|
||||
WsdScheduler::new(PEAK, MIN, WARMUP, STABLE, DECAY, WsdDecayType::Sqrt).unwrap();
|
||||
let s = WsdScheduler::new(PEAK, MIN, WARMUP, STABLE, DECAY, WsdDecayType::Sqrt).unwrap();
|
||||
let decay_start = WARMUP + STABLE;
|
||||
let mid = decay_start + DECAY / 2;
|
||||
let p = 0.5_f64;
|
||||
|
||||
Reference in New Issue
Block a user