diff options
-rw-r--r-- | candle-transformers/src/models/t5.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/candle-transformers/src/models/t5.rs b/candle-transformers/src/models/t5.rs index ca240aa6..5dc44cb5 100644 --- a/candle-transformers/src/models/t5.rs +++ b/candle-transformers/src/models/t5.rs @@ -462,7 +462,7 @@ impl T5Attention { self.relative_attention_max_distance as f32 / max_exact as f32, ) * (num_buckets - max_exact) as f32; - max_exact + b as u32 + u32::min(max_exact + b as u32, num_buckets - 1) } }) .collect::<Vec<u32>>() |