From 10853b803cd3e2a0927b48374f486ea5952552d3 Mon Sep 17 00:00:00 2001 From: Kyle Birnbaum Date: Wed, 26 Mar 2025 00:09:27 -0700 Subject: [PATCH] fixed rand imports for whisper-microphone example (#2834) --- candle-examples/examples/whisper-microphone/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/candle-examples/examples/whisper-microphone/main.rs b/candle-examples/examples/whisper-microphone/main.rs index 373c40e2..11fe79ee 100644 --- a/candle-examples/examples/whisper-microphone/main.rs +++ b/candle-examples/examples/whisper-microphone/main.rs @@ -9,7 +9,7 @@ use candle::{Device, IndexOp, Tensor}; use candle_nn::{ops::softmax, VarBuilder}; use clap::{Parser, ValueEnum}; use hf_hub::{api::sync::Api, Repo, RepoType}; -use rand::{distributions::Distribution, SeedableRng}; +use rand::{distr::Distribution, SeedableRng}; use tokenizers::Tokenizer; mod multilingual; @@ -204,7 +204,7 @@ impl Decoder { let next_token = if t > 0f64 { let prs = softmax(&(&logits / t)?, 0)?; let logits_v: Vec = prs.to_vec1()?; - let distr = rand::distributions::WeightedIndex::new(&logits_v)?; + let distr = rand::distr::weighted::WeightedIndex::new(&logits_v)?; distr.sample(&mut self.rng) as u32 } else { let logits_v: Vec = logits.to_vec1()?;