From c7c2edc8e853134208b339bd2c15d869f73b46f6 Mon Sep 17 00:00:00 2001 From: cychester <40726077+cyc4188@users.noreply.github.com> Date: Fri, 9 May 2025 14:59:18 +0800 Subject: [PATCH] Remove useless code (#597) --- bindings/python/src/lib.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs index be499d5..be8e94e 100644 --- a/bindings/python/src/lib.rs +++ b/bindings/python/src/lib.rs @@ -14,7 +14,6 @@ use safetensors::View; use std::borrow::Cow; use std::collections::HashMap; use std::fs::File; -use std::iter::FromIterator; use std::ops::Bound; use std::path::PathBuf; use std::sync::Arc; @@ -120,8 +119,7 @@ fn serialize<'b>( metadata: Option>, ) -> PyResult> { let tensors = prepare(tensor_dict)?; - let metadata_map = metadata.map(HashMap::from_iter); - let out = safetensors::tensor::serialize(&tensors, &metadata_map) + let out = safetensors::tensor::serialize(&tensors, &metadata) .map_err(|e| SafetensorError::new_err(format!("Error while serializing: {e:?}")))?; let pybytes = PyBytes::new(py, &out); Ok(pybytes) -- 2.43.0