diff --git a/candle-examples/examples/llama/main.rs b/candle-examples/examples/llama/main.rs index 23939a1f..2f4a4cd8 100644 --- a/candle-examples/examples/llama/main.rs +++ b/candle-examples/examples/llama/main.rs @@ -12,7 +12,7 @@ extern crate accelerate_src; #[cfg(feature = "mkl")] extern crate intel_mkl_src; -use anyhow::{Error as E, Result}; +use anyhow::{bail, Error as E, Result}; use clap::Parser; use candle::{DType, Tensor}; @@ -104,7 +104,7 @@ fn main() -> Result<()> { Some("f16") => DType::F16, Some("bf16") => DType::BF16, Some("f32") => DType::F32, - Some(dtype) => panic!("Unsupported dtype {dtype}"), + Some(dtype) => bail!("Unsupported dtype {dtype}"), None => DType::F16, }; let (llama, tokenizer_filename, cache) = match args.npy { diff --git a/candle-examples/examples/llama_multiprocess/main.rs b/candle-examples/examples/llama_multiprocess/main.rs index 063070b3..db315e46 100644 --- a/candle-examples/examples/llama_multiprocess/main.rs +++ b/candle-examples/examples/llama_multiprocess/main.rs @@ -9,7 +9,7 @@ #[cfg(feature = "mkl")] extern crate intel_mkl_src; -use anyhow::{Error as E, Result}; +use anyhow::{bail, Error as E, Result}; use clap::Parser; use candle::{DType, Device, Tensor}; @@ -125,7 +125,7 @@ fn main() -> Result<()> { Some("f16") => DType::F16, Some("bf16") => DType::BF16, Some("f32") => DType::F32, - Some(dtype) => panic!("Unsupported dtype {dtype}"), + Some(dtype) => bail!("Unsupported dtype {dtype}"), None => DType::F16, };