mirror of
https://github.com/huggingface/candle.git
synced 2025-06-16 10:38:54 +00:00
Cleanup the main crate error and add a couple dedicated ones (#142)
* Cosmetic cleanups to the error enum. * More error cleanup. * Proper error handling rather than panicing. * Add some conv1d dedicated error.
This commit is contained in:
@ -157,8 +157,9 @@ impl<'a> VarBuilder<'a> {
|
||||
routing,
|
||||
safetensors,
|
||||
} => {
|
||||
// Unwrap or 0 just to let the proper error flow.
|
||||
let index = routing.get(&path).unwrap_or(&0);
|
||||
let index = routing.get(&path).ok_or_else(|| Error::CannotFindTensor {
|
||||
path: path.to_string(),
|
||||
})?;
|
||||
safetensors[*index]
|
||||
.tensor(&path, &data.device)?
|
||||
.to_dtype(data.dtype)?
|
||||
|
Reference in New Issue
Block a user