]> khamidou — GitHub mirrors - safetensors.git/commitdiff
Fixing unimplemented into real exception. (#78)
authorNicolas Patry <patry.nicolas@protonmail.com>
Thu, 17 Nov 2022 19:08:25 +0000 (20:08 +0100)
committerGitHub <noreply@github.com>
Thu, 17 Nov 2022 19:08:25 +0000 (20:08 +0100)
bindings/python/src/lib.rs

index b5f40fbb87579c9d7036a639e36954ee3b01f5e8..81f7d006cd6328f670be63ca39c17e40d82f07a9 100644 (file)
@@ -64,7 +64,9 @@ fn prepare(tensor_dict: HashMap<String, &PyDict>) -> PyResult<BTreeMap<String, T
                         "float64" => Dtype::F64,
                         "bfloat16" => Dtype::BF16,
                         dtype_str => {
-                            unimplemented!("Did not cover this dtype: {}", dtype_str)
+                            return Err(exceptions::PyException::new_err(format!(
+                                "dtype {dtype_str} is not covered",
+                            )));
                         }
                     }
                 }