From 054717e236abbedee1fd862d2bb789514f9938a5 Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Thu, 6 Jul 2023 13:14:33 +0200 Subject: [PATCH] Fixing unsafe slow load (memcpy). - Without the annotation, I think the rust compiler assumes it's all u8. It did segfault trying to load `Roberta`. --- candle-core/src/safetensors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/candle-core/src/safetensors.rs b/candle-core/src/safetensors.rs index ae93f4df..d7343e44 100644 --- a/candle-core/src/safetensors.rs +++ b/candle-core/src/safetensors.rs @@ -71,7 +71,7 @@ fn convert_(view: st::TensorView<'_>, device: &Device) -> Result = Vec::with_capacity(elem_count); // SAFETY: We just created c, so the allocated memory is necessarily // contiguous and non overlapping with the view's data. // We're downgrading the `c` pointer from T to u8, which removes alignment