xl0 / lovely-tensors

Tensors, ready for human consumption

Home Page:https://xl0.github.io/lovely-tensors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BFloat16 not supported

nachshonc opened this issue · comments

Code fails when printing a tensor in bfloat16.
Minimal code to reproduce:

import torch
import lovely_tensors
lovely_tensors.monkey_patch()
t = torch.tensor([1.0], dtype=torch.bfloat16)
print(t)

lovely_tensors version is 0.1.11.
Error message

--> 138         common = np_to_str_common(t.detach().cpu().numpy(), color=color, ddof=1)
    139     else:
    140         common = torch_to_str_common(t, color=color)

TypeError: Got unsupported ScalarType BFloat16

bfloat16 is used for T5-like text generation models.

Good catch, thank you. I'll try to fix this today.

Fixed. I'll release a new version soon. If you'd like to try git:

pip install git+https://github.com/xl0/lovely-tensors