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:
osobh
2026-08-10 07:09:36 -07:00
co-authored by Claude Sonnet 5
parent ad6405663f
commit 4aaa36a57a
305 changed files with 25537 additions and 18337 deletions
@@ -279,8 +279,8 @@ impl BeamSearchDecoder {
// Partial sort: O(n log k) via a min-heap maintained at size k.
// For typical vocab sizes (32k256k) and small k (beam width ≤ 16) this is
// substantially faster than a full sort.
use std::collections::BinaryHeap;
use std::cmp::Reverse;
use std::collections::BinaryHeap;
// BinaryHeap is a max-heap; we wrap in Reverse to get a min-heap so we can
// efficiently evict the smallest element as we scan.
@@ -468,8 +468,7 @@ impl DiverseBeamSearchDecoder {
HashSet::new()
};
let generated_so_far =
beam.tokens.len().saturating_sub(initial_tokens.len());
let generated_so_far = beam.tokens.len().saturating_sub(initial_tokens.len());
let suppress_eos = generated_so_far < self.config.min_length;
// Apply diversity penalty before selecting top-k.
@@ -572,10 +571,7 @@ mod tests {
// ---- Helper ---------------------------------------------------------------
fn make_score_fn(
vocab_size: usize,
eos_id: u32,
) -> impl Fn(&[u32]) -> Vec<f32> {
fn make_score_fn(vocab_size: usize, eos_id: u32) -> impl Fn(&[u32]) -> Vec<f32> {
move |_tokens: &[u32]| {
let mut lp = vec![-10.0_f32; vocab_size];
lp[5] = -0.1;
@@ -773,7 +769,10 @@ mod tests {
};
let results = decoder.decode(&[1], vocab_size, 1, score_fn);
assert_eq!(results.len(), 1);
assert!(results[0].finished, "Beam should be marked finished after EOS");
assert!(
results[0].finished,
"Beam should be marked finished after EOS"
);
assert_eq!(
*results[0].tokens.last().unwrap(),
eos_id,
@@ -832,7 +831,10 @@ mod tests {
lp
};
let results = decoder.decode(&[1], vocab_size, 1, score_fn);
assert!(!results.is_empty(), "Should always return at least one beam");
assert!(
!results.is_empty(),
"Should always return at least one beam"
);
}
#[test]
@@ -887,7 +889,7 @@ mod tests {
let score_fn = |_: &[u32]| {
let mut lp = vec![-20.0_f32; vocab_size];
lp[5] = -0.01; // very good
lp[3] = -5.0; // much worse
lp[3] = -5.0; // much worse
lp[eos_id as usize] = -0.5;
lp
};