Skip to content

Commit ddd5289

Browse files
Convert unsupported datatypes to f32 when converting BERT architectures to GGUF
1 parent 928e0b7 commit ddd5289

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
@@ -2481,6 +2481,10 @@ def write_tensors(self):
24812481
if new_name is None:
24822482
print(f"Can not map tensor {name!r}")
24832483
sys.exit()
2484+
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)
24842488

24852489
data = data_torch.squeeze().numpy()
24862490
n_dims = len(data.shape)

0 commit comments

Comments
 (0)