Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions model2vec/distill/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,9 @@ def _encode_with_model(
# NOTE: If the dtype is bfloat 16, we convert to float32,
# because numpy does not suport bfloat16
# See here: https://github.com/numpy/numpy/issues/19808
if hidden.dtype == torch.bfloat16:
hidden = hidden.float()
hidden = hidden.float()
pooler = getattr(outputs, "pooler_output", None)
if pooler is not None and pooler.dtype == torch.bfloat16:
if pooler is not None:
pooler = pooler.float()
return hidden, pooler, encodings_on_device

Expand Down
Loading