Skip to content

Commit 3055a41

Browse files
convert : fix conversion of some BERT embedding models (ggml-org#6937)
1 parent 577277f commit 3055a41

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

convert-hf-to-gguf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2482,6 +2482,10 @@ def write_tensors(self):
24822482
print(f"Can not map tensor {name!r}")
24832483
sys.exit()
24842484

2485+
# convert any unsupported data types to float32
2486+
if data_torch.dtype not in (torch.float16, torch.float32):
2487+
data_torch = data_torch.to(torch.float32)
2488+
24852489
data = data_torch.squeeze().numpy()
24862490
n_dims = len(data.shape)
24872491
new_dtype: type[np.floating[Any]]

0 commit comments

Comments
 (0)