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:
@@ -148,7 +148,9 @@ impl ForwardPass {
|
||||
let get_attn_weight = |proj: &str| {
|
||||
model_weights
|
||||
.get(&format!("layers.{layer_idx}.self_attn.{proj}.weight"))
|
||||
.or_else(|| model_weights.get(&format!("layers.{layer_idx}.attention.{proj}.weight")))
|
||||
.or_else(|| {
|
||||
model_weights.get(&format!("layers.{layer_idx}.attention.{proj}.weight"))
|
||||
})
|
||||
};
|
||||
let q_weight = get_attn_weight("q_proj")
|
||||
.ok_or_else(|| InferenceError::model_not_found("Q projection weights"))?;
|
||||
|
||||
@@ -130,12 +130,15 @@ impl TokenGenerator {
|
||||
let vocab_size = *dims.last().ok_or_else(|| InferenceError::InvalidRequest {
|
||||
message: "logits tensor has no dimensions".to_string(),
|
||||
})?;
|
||||
let all_logits = logits.to_vec().map_err(|e| InferenceError::InvalidRequest {
|
||||
message: format!("failed to copy logits to host: {e}"),
|
||||
})?;
|
||||
let all_logits = logits
|
||||
.to_vec()
|
||||
.map_err(|e| InferenceError::InvalidRequest {
|
||||
message: format!("failed to copy logits to host: {e}"),
|
||||
})?;
|
||||
// For [batch, seq, vocab] (or [seq, vocab]) take the final vocab_size slice:
|
||||
// the last token's logits.
|
||||
let logits_data: Vec<f32> = all_logits[all_logits.len().saturating_sub(vocab_size)..].to_vec();
|
||||
let logits_data: Vec<f32> =
|
||||
all_logits[all_logits.len().saturating_sub(vocab_size)..].to_vec();
|
||||
|
||||
// Apply temperature scaling
|
||||
let scaled_logits: Vec<f32> = if temperature != 1.0 && temperature > 0.0 {
|
||||
|
||||
Reference in New Issue
Block a user