From dcdafaf8ac5d94f414990e1f014d41288c58aa9a Mon Sep 17 00:00:00 2001 From: jhqxxx Date: Sat, 11 Oct 2025 11:13:10 +0800 Subject: [PATCH] update attn_weights add mask dtype not match error --- src/models/common/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/common/mod.rs b/src/models/common/mod.rs index 77fd179..cb05fa2 100644 --- a/src/models/common/mod.rs +++ b/src/models/common/mod.rs @@ -225,7 +225,7 @@ impl AttentionNobias { let attn_weights = (attn_weights * scale)?; let attn_weights = match attention_mask { None => attn_weights, - Some(mask) => attn_weights.broadcast_add(mask)?, + Some(mask) => attn_weights.broadcast_add(&mask.to_dtype(attn_weights.dtype())?)?, }; let attn_weights = candle_nn::ops::softmax_last_dim(&attn_weights)?; let attn_weights = attn_weights.matmul(&value_states)?;