diff options
author | Christian Zhou-Zheng <59622928+christianazinn@users.noreply.github.com> | 2024-04-29 09:34:41 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-29 16:34:41 +0300 |
commit | 3055a4180557c6cbe29eacc8284c9e070ac10eab (patch) | |
tree | f4f0183ed720cc9b2a1f5eb3d2ac22d2b3f9e7a9 | |
parent | 577277ffd203b190c3dc2ab3e737946dc432132c (diff) |
convert : fix conversion of some BERT embedding models (#6937)
-rwxr-xr-x | convert-hf-to-gguf.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/convert-hf-to-gguf.py b/convert-hf-to-gguf.py index 5763b666..3b9fa264 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]] |