From 3055a4180557c6cbe29eacc8284c9e070ac10eab Mon Sep 17 00:00:00 2001 From: Christian Zhou-Zheng <59622928+christianazinn@users.noreply.github.com> Date: Mon, 29 Apr 2024 09:34:41 -0400 Subject: [PATCH] convert : fix conversion of some BERT embedding models (#6937) --- convert-hf-to-gguf.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/convert-hf-to-gguf.py b/convert-hf-to-gguf.py index 5763b6664..3b9fa264a 100755 --- a/convert-hf-to-gguf.py +++ b/convert-hf-to-gguf.py @@ -2482,6 +2482,10 @@ class BertModel(Model): print(f"Can not map tensor {name!r}") sys.exit() + # convert any unsupported data types to float32 + if data_torch.dtype not in (torch.float16, torch.float32): + data_torch = data_torch.to(torch.float32) + data = data_torch.squeeze().numpy() n_dims = len(data.shape) new_dtype: type[np.floating[Any]]