You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've investigated further and I believe this is caused by the behaviour of torch.tensor():
torch.tensor([]).dtype # float32
torch.tensor([1, 2, 3]).dtype # int64
The torch behaviour when converting an input list to a tensor is that the output dtype will be int64 when all of the elements in the list are int, otherwise it will be torch.float32. This creates a strange edge case when the input is empty, but this empty input is not a valid model input regardless of dtype, and so I'm not sure if it's worth fixing this bug!
System Info
transformers
version: 4.48.1Who can help?
@ArthurZucker and @itazap
Information
Tasks
examples
folder (such as GLUE/SQuAD, ...)Reproduction
The output tensor's data type is not torch.long when the input text is empty.
Expected behavior
The text was updated successfully, but these errors were encountered: