mirror of
https://github.com/huggingface/candle.git
synced 2025-06-17 11:08:52 +00:00
fix: can directly save the loaded weights (#421)
This commit is contained in:
@ -253,7 +253,10 @@ pub fn load_buffer(data: &[u8], device: &Device) -> Result<HashMap<String, Tenso
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn save<P: AsRef<Path>>(tensors: &HashMap<&str, Tensor>, filename: P) -> Result<()> {
|
pub fn save<K: AsRef<str> + Ord + std::fmt::Display, P: AsRef<Path>>(
|
||||||
|
tensors: &HashMap<K, Tensor>,
|
||||||
|
filename: P,
|
||||||
|
) -> Result<()> {
|
||||||
Ok(st::serialize_to_file(tensors, &None, filename.as_ref())?)
|
Ok(st::serialize_to_file(tensors, &None, filename.as_ref())?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user