summaryrefslogtreecommitdiff
path: root/candle-examples
diff options
context:
space:
mode:
authorLaurent Mazare <laurent.mazare@gmail.com>2024-09-05 22:46:55 +0100
committerGitHub <noreply@github.com>2024-09-05 23:46:55 +0200
commite3261216b157a7305c18ccdd766b6e2a41afe483 (patch)
treeedec85bf6faae0c6662e833f74d79ccc2579ef05 /candle-examples
parentc02b7c327297f25fc9cc60b8f39c9aa32e40ff21 (diff)
downloadcandle-e3261216b157a7305c18ccdd766b6e2a41afe483.tar.gz
candle-e3261216b157a7305c18ccdd766b6e2a41afe483.tar.bz2
candle-e3261216b157a7305c18ccdd766b6e2a41afe483.zip
Clippy fixes for 1.81.0. (#2461)
* Clippy fixes for 1.81.0. * Another fix.
Diffstat (limited to 'candle-examples')
-rw-r--r--candle-examples/examples/musicgen/musicgen_model.rs6
-rw-r--r--candle-examples/examples/silero-vad/main.rs1
-rw-r--r--candle-examples/examples/yolo-v3/darknet.rs6
-rw-r--r--candle-examples/examples/yolo-v8/model.rs2
4 files changed, 7 insertions, 8 deletions
diff --git a/candle-examples/examples/musicgen/musicgen_model.rs b/candle-examples/examples/musicgen/musicgen_model.rs
index 03e96614..7fbe8b53 100644
--- a/candle-examples/examples/musicgen/musicgen_model.rs
+++ b/candle-examples/examples/musicgen/musicgen_model.rs
@@ -284,11 +284,11 @@ impl MusicgenDecoder {
};
let embed_dim = cfg.vocab_size + 1;
let embed_tokens = (0..cfg.num_codebooks)
- .map(|i| embedding(embed_dim, h, vb.pp(&format!("embed_tokens.{i}"))))
+ .map(|i| embedding(embed_dim, h, vb.pp(format!("embed_tokens.{i}"))))
.collect::<Result<Vec<_>>>()?;
let embed_positions = MusicgenSinusoidalPositionalEmbedding::load(vb.clone(), cfg)?;
let layers = (0..cfg.num_hidden_layers)
- .map(|i| MusicgenDecoderLayer::load(vb.pp(&format!("layers.{i}")), cfg))
+ .map(|i| MusicgenDecoderLayer::load(vb.pp(format!("layers.{i}")), cfg))
.collect::<Result<Vec<_>>>()?;
let layer_norm = layer_norm(h, 1e-5, vb.pp("layer_norm"))?;
Ok(Self {
@@ -341,7 +341,7 @@ impl MusicgenForCausalLM {
let h = cfg.hidden_size;
let decoder = MusicgenDecoder::load(vb.pp("model.decoder"), cfg)?;
let lm_heads = (0..cfg.num_codebooks)
- .map(|i| linear_no_bias(h, cfg.vocab_size, vb.pp(&format!("lm_heads.{i}"))))
+ .map(|i| linear_no_bias(h, cfg.vocab_size, vb.pp(format!("lm_heads.{i}"))))
.collect::<Result<Vec<_>>>()?;
Ok(Self {
decoder,
diff --git a/candle-examples/examples/silero-vad/main.rs b/candle-examples/examples/silero-vad/main.rs
index 4618ad80..20a0b7a2 100644
--- a/candle-examples/examples/silero-vad/main.rs
+++ b/candle-examples/examples/silero-vad/main.rs
@@ -8,7 +8,6 @@ use anyhow::Result;
use clap::Parser;
use candle::{DType, Tensor};
-use candle_onnx;
#[derive(Clone, Debug, Copy, PartialEq, Eq, clap::ValueEnum)]
enum Which {
diff --git a/candle-examples/examples/yolo-v3/darknet.rs b/candle-examples/examples/yolo-v3/darknet.rs
index 1892acdd..944f4dcb 100644
--- a/candle-examples/examples/yolo-v3/darknet.rs
+++ b/candle-examples/examples/yolo-v3/darknet.rs
@@ -123,7 +123,7 @@ fn conv(vb: VarBuilder, index: usize, p: usize, b: &Block) -> Result<(usize, Bl)
let padding = if pad != 0 { (size - 1) / 2 } else { 0 };
let (bn, bias) = match b.parameters.get("batch_normalize") {
Some(p) if p.parse::<usize>()? != 0 => {
- let bn = batch_norm(filters, 1e-5, vb.pp(&format!("batch_norm_{index}")))?;
+ let bn = batch_norm(filters, 1e-5, vb.pp(format!("batch_norm_{index}")))?;
(Some(bn), false)
}
Some(_) | None => (None, true),
@@ -135,9 +135,9 @@ fn conv(vb: VarBuilder, index: usize, p: usize, b: &Block) -> Result<(usize, Bl)
dilation: 1,
};
let conv = if bias {
- conv2d(p, filters, size, conv_cfg, vb.pp(&format!("conv_{index}")))?
+ conv2d(p, filters, size, conv_cfg, vb.pp(format!("conv_{index}")))?
} else {
- conv2d_no_bias(p, filters, size, conv_cfg, vb.pp(&format!("conv_{index}")))?
+ conv2d_no_bias(p, filters, size, conv_cfg, vb.pp(format!("conv_{index}")))?
};
let leaky = match activation {
"leaky" => true,
diff --git a/candle-examples/examples/yolo-v8/model.rs b/candle-examples/examples/yolo-v8/model.rs
index cecd4ce6..e1be1f3c 100644
--- a/candle-examples/examples/yolo-v8/model.rs
+++ b/candle-examples/examples/yolo-v8/model.rs
@@ -161,7 +161,7 @@ impl C2f {
let cv2 = ConvBlock::load(vb.pp("cv2"), (2 + n) * c, c2, 1, 1, None)?;
let mut bottleneck = Vec::with_capacity(n);
for idx in 0..n {
- let b = Bottleneck::load(vb.pp(&format!("bottleneck.{idx}")), c, c, shortcut)?;
+ let b = Bottleneck::load(vb.pp(format!("bottleneck.{idx}")), c, c, shortcut)?;
bottleneck.push(b)
}
Ok(Self {