summaryrefslogtreecommitdiff
path: root/candle-transformers
diff options
context:
space:
mode:
authorAnubhab Bandyopadhyay <4890833+AnubhabB@users.noreply.github.com>2024-11-29 03:30:21 +0530
committerGitHub <noreply@github.com>2024-11-28 23:00:21 +0100
commit54e7fc3c97a6d40e459cee4d4bf2eff5c82390da (patch)
tree8ef4da0e255884de729b8c70fdf642b7c807d631 /candle-transformers
parent23ed8a9ded155df7b5961d6a5ae12b4e8096a9c2 (diff)
downloadcandle-54e7fc3c97a6d40e459cee4d4bf2eff5c82390da.tar.gz
candle-54e7fc3c97a6d40e459cee4d4bf2eff5c82390da.tar.bz2
candle-54e7fc3c97a6d40e459cee4d4bf2eff5c82390da.zip
Lint fixes introduced with Rust 1.83 (#2646)
* Fixes for lint errors introduced with Rust 1.83 * rustfmt * Fix more lints. --------- Co-authored-by: Laurent <laurent.mazare@gmail.com>
Diffstat (limited to 'candle-transformers')
-rw-r--r--candle-transformers/src/models/convmixer.rs4
-rw-r--r--candle-transformers/src/models/depth_anything_v2.rs2
-rw-r--r--candle-transformers/src/models/efficientnet.rs4
-rw-r--r--candle-transformers/src/models/encodec.rs2
-rw-r--r--candle-transformers/src/models/mamba.rs2
-rw-r--r--candle-transformers/src/models/stable_diffusion/utils.rs2
6 files changed, 8 insertions, 8 deletions
diff --git a/candle-transformers/src/models/convmixer.rs b/candle-transformers/src/models/convmixer.rs
index 7f1b75eb..7f924794 100644
--- a/candle-transformers/src/models/convmixer.rs
+++ b/candle-transformers/src/models/convmixer.rs
@@ -21,8 +21,8 @@ fn conv2d_same(
let module = candle_nn::func(move |xs| {
let ih = xs.dim(2)?;
let iw = xs.dim(3)?;
- let oh = (ih + s - 1) / s;
- let ow = (iw + s - 1) / s;
+ let oh = ih.div_ceil(s);
+ let ow = iw.div_ceil(s);
let pad_h = usize::max((oh - 1) * s + k - ih, 0);
let pad_w = usize::max((ow - 1) * s + k - iw, 0);
if pad_h > 0 || pad_w > 0 {
diff --git a/candle-transformers/src/models/depth_anything_v2.rs b/candle-transformers/src/models/depth_anything_v2.rs
index 411b0764..8eddbf2a 100644
--- a/candle-transformers/src/models/depth_anything_v2.rs
+++ b/candle-transformers/src/models/depth_anything_v2.rs
@@ -543,7 +543,7 @@ impl<'a> DepthAnythingV2<'a> {
}
}
-impl<'a> Module for DepthAnythingV2<'a> {
+impl Module for DepthAnythingV2<'_> {
fn forward(&self, xs: &Tensor) -> Result<Tensor> {
let features = self.pretrained.get_intermediate_layers(
xs,
diff --git a/candle-transformers/src/models/efficientnet.rs b/candle-transformers/src/models/efficientnet.rs
index ecca2509..36754f21 100644
--- a/candle-transformers/src/models/efficientnet.rs
+++ b/candle-transformers/src/models/efficientnet.rs
@@ -125,8 +125,8 @@ impl Module for Conv2DSame {
let s = self.s;
let k = self.k;
let (_, _, ih, iw) = xs.dims4()?;
- let oh = (ih + s - 1) / s;
- let ow = (iw + s - 1) / s;
+ let oh = ih.div_ceil(s);
+ let ow = iw.div_ceil(s);
let pad_h = usize::max((oh - 1) * s + k - ih, 0);
let pad_w = usize::max((ow - 1) * s + k - iw, 0);
if pad_h > 0 || pad_w > 0 {
diff --git a/candle-transformers/src/models/encodec.rs b/candle-transformers/src/models/encodec.rs
index 517b9b1d..d8dff74c 100644
--- a/candle-transformers/src/models/encodec.rs
+++ b/candle-transformers/src/models/encodec.rs
@@ -89,7 +89,7 @@ impl Config {
fn frame_rate(&self) -> usize {
let hop_length: usize = self.upsampling_ratios.iter().product();
- (self.sampling_rate + hop_length - 1) / hop_length
+ self.sampling_rate.div_ceil(hop_length)
}
fn num_quantizers(&self) -> usize {
diff --git a/candle-transformers/src/models/mamba.rs b/candle-transformers/src/models/mamba.rs
index 18a0285f..a29f2619 100644
--- a/candle-transformers/src/models/mamba.rs
+++ b/candle-transformers/src/models/mamba.rs
@@ -23,7 +23,7 @@ pub struct Config {
impl Config {
fn vocab_size(&self) -> usize {
let pad = self.pad_vocab_size_multiple;
- (self.vocab_size + pad - 1) / pad * pad
+ self.vocab_size.div_ceil(pad) * pad
}
fn dt_rank(&self) -> usize {
diff --git a/candle-transformers/src/models/stable_diffusion/utils.rs b/candle-transformers/src/models/stable_diffusion/utils.rs
index 5b5fa0f7..0118bafc 100644
--- a/candle-transformers/src/models/stable_diffusion/utils.rs
+++ b/candle-transformers/src/models/stable_diffusion/utils.rs
@@ -21,7 +21,7 @@ struct LinearInterpolator<'x, 'y> {
cache: usize,
}
-impl<'x, 'y> LinearInterpolator<'x, 'y> {
+impl LinearInterpolator<'_, '_> {
fn accel_find(&mut self, x: f64) -> usize {
let xidx = self.cache;
if x < self.xp[xidx] {