mirror of
https://github.com/huggingface/candle.git
synced 2025-06-15 02:16:37 +00:00
Improve the quantized whisper setup. (#1018)
* Improve the quantized whisper setup. * Fix the config file paths. * Use the standard matmul where possible.
This commit is contained in:
@ -484,17 +484,25 @@ fn main() -> Result<()> {
|
||||
println!("No audio file submitted: Downloading https://huggingface.co/datasets/Narsil/candle_demo/blob/main/samples_jfk.wav");
|
||||
dataset.get("samples_jfk.wav")?
|
||||
};
|
||||
let config = if args.quantized {
|
||||
repo.get("config-tiny.json")?
|
||||
let (config, tokenizer, model) = if args.quantized {
|
||||
let ext = match args.model {
|
||||
WhichModel::TinyEn => "tiny-en",
|
||||
WhichModel::Tiny => "tiny",
|
||||
_ => unimplemented!("no quantized support for {:?}", args.model),
|
||||
};
|
||||
(
|
||||
repo.get(&format!("config-{ext}.json"))?,
|
||||
repo.get(&format!("tokenizer-{ext}.json"))?,
|
||||
repo.get(&format!("model-{ext}-q40.gguf"))?,
|
||||
)
|
||||
} else {
|
||||
repo.get("config.json")?
|
||||
(
|
||||
repo.get("config.json")?,
|
||||
repo.get("tokenizer.json")?,
|
||||
repo.get("model.safetensors")?,
|
||||
)
|
||||
};
|
||||
let model = if args.quantized {
|
||||
repo.get("model-tiny-q40.gguf")?
|
||||
} else {
|
||||
repo.get("model.safetensors")?
|
||||
};
|
||||
(config, repo.get("tokenizer.json")?, model, sample)
|
||||
(config, tokenizer, model, sample)
|
||||
};
|
||||
let tokenizer = Tokenizer::from_file(tokenizer_filename).map_err(E::msg)?;
|
||||
|
||||
|
Reference in New Issue
Block a user