upgrade half library to fix rand (#2806)

fix lints
This commit is contained in:
Mike Seddon
2025-03-14 19:01:54 +11:00
committed by GitHub
parent 111edbc4ea
commit c930ab7e1a
9 changed files with 38 additions and 37 deletions

View File

@ -16,7 +16,7 @@ use candle_transformers::models::quantized_metavoice::transformer as qtransforme
use candle::{DType, IndexOp, Tensor};
use candle_nn::VarBuilder;
use hf_hub::api::sync::Api;
use rand::{distributions::Distribution, SeedableRng};
use rand::{distr::Distribution, SeedableRng};
pub const ENCODEC_NTOKENS: u32 = 1024;
@ -250,7 +250,7 @@ fn main() -> Result<()> {
let logits = logits.i(step)?.to_dtype(DType::F32)?;
let logits = &(&logits / 1.0)?;
let prs = candle_nn::ops::softmax_last_dim(logits)?.to_vec1::<f32>()?;
let distr = rand::distributions::WeightedIndex::new(prs.as_slice())?;
let distr = rand::distr::weighted::WeightedIndex::new(prs.as_slice())?;
let sample = distr.sample(&mut rng) as u32;
codes_.push(sample)
}