Skip to content

Commit

Permalink
fix: address clippy 0.1.74 issues (huggingface#1336)
Browse files Browse the repository at this point in the history
- clippy::needless-borrows-for-generic-args
- clippy::reserve-after-initialization
  • Loading branch information
drbh authored Nov 16, 2023
1 parent c6763e3 commit 92a05b5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions candle-examples/examples/stable-diffusion/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ fn run(args: Args) -> Result<()> {

println!("Building the autoencoder.");
let vae_weights = ModelFile::Vae.get(vae_weights, sd_version, use_f16)?;
let vae = sd_config.build_vae(&vae_weights, &device, dtype)?;
let vae = sd_config.build_vae(vae_weights, &device, dtype)?;
let init_latent_dist = match &img2img {
None => None,
Some(image) => {
Expand All @@ -426,7 +426,7 @@ fn run(args: Args) -> Result<()> {
};
println!("Building the unet.");
let unet_weights = ModelFile::Unet.get(unet_weights, sd_version, use_f16)?;
let unet = sd_config.build_unet(&unet_weights, &device, 4, use_flash_attn, dtype)?;
let unet = sd_config.build_unet(unet_weights, &device, 4, use_flash_attn, dtype)?;

let t_start = if img2img.is_some() {
n_steps - (n_steps as f64 * img2img_strength) as usize
Expand Down
3 changes: 1 addition & 2 deletions candle-transformers/src/models/whisper/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ fn dft<T: Float>(inp: &[T]) -> Vec<T> {
let n = inp.len();
let two_pi = T::PI() + T::PI();

let mut out = Vec::new();
out.reserve(2 * n);
let mut out = Vec::with_capacity(2 * n);
let n_t = T::from(n).unwrap();
for k in 0..n {
let k_t = T::from(k).unwrap();
Expand Down
3 changes: 1 addition & 2 deletions candle-wasm-examples/whisper/src/audio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ fn dft<T: Float>(inp: &[T]) -> Vec<T> {
let n = inp.len();
let two_pi = T::PI() + T::PI();

let mut out = Vec::new();
out.reserve(2 * n);
let mut out = Vec::with_capacity(2 * n);
let n_t = T::from(n).unwrap();
for k in 0..n {
let k_t = T::from(k).unwrap();
Expand Down

0 comments on commit 92a05b5

Please sign in to comment.