style: format Rust workspace
This commit is contained in:
@@ -5,8 +5,8 @@ use std::path::Path;
|
||||
use xserv_tensor::{DType, Device, Tensor};
|
||||
|
||||
pub fn load_safetensors(path: &Path, device: Device) -> HashMap<String, Tensor> {
|
||||
let data = std::fs::read(path)
|
||||
.unwrap_or_else(|e| panic!("failed to read {}: {e}", path.display()));
|
||||
let data =
|
||||
std::fs::read(path).unwrap_or_else(|e| panic!("failed to read {}: {e}", path.display()));
|
||||
let st = SafeTensors::deserialize(&data)
|
||||
.unwrap_or_else(|e| panic!("failed to parse safetensors {}: {e}", path.display()));
|
||||
|
||||
@@ -60,7 +60,11 @@ pub fn load_model_dir(dir: &Path, device: Device) -> HashMap<String, Tensor> {
|
||||
all_tensors.extend(tensors);
|
||||
}
|
||||
|
||||
assert!(!all_tensors.is_empty(), "no safetensors files found in {}", dir.display());
|
||||
assert!(
|
||||
!all_tensors.is_empty(),
|
||||
"no safetensors files found in {}",
|
||||
dir.display()
|
||||
);
|
||||
all_tensors
|
||||
}
|
||||
|
||||
@@ -84,8 +88,6 @@ fn make_tensor(raw_bytes: &[u8], shape: &[usize], dtype: DType) -> Tensor {
|
||||
};
|
||||
Tensor::from_slice(bfs, shape)
|
||||
}
|
||||
DType::FP8E4M3 => {
|
||||
Tensor::from_raw_bytes(raw_bytes, shape, DType::FP8E4M3)
|
||||
}
|
||||
DType::FP8E4M3 => Tensor::from_raw_bytes(raw_bytes, shape, DType::FP8E4M3),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user