Closed
Description
System Info
transformers
version: 4.48.1- Platform: Linux-5.15.0-130-generic-x86_64-with-glibc2.35
- Python version: 3.12.8
- Huggingface_hub version: 0.27.1
- Safetensors version: 0.5.2
- Accelerate version: 1.3.0
- Accelerate config: not found
- PyTorch version (GPU?): 2.5.1+cu124 (True)
- Tensorflow version (GPU?): not installed (NA)
- Flax version (CPU?/GPU?/TPU?): 0.10.2 (cpu)
- Jax version: 0.5.0
- JaxLib version: 0.5.0
- Using distributed or parallel set-up in script?: No
- Using GPU in script?: No
- GPU type: NVIDIA GeForce RTX 3060 Ti
Who can help?
@ArthurZucker and @itazap
Information
- The official example scripts
- My own modified scripts
Tasks
- An officially supported task in the
examples
folder (such as GLUE/SQuAD, ...) - My own task or dataset (give details below)
Reproduction
The output tensor's data type is not torch.long when the input text is empty.
t = tokenizer('', return_tensors='pt')
print(t['input_ids'].dtype)
# torch.float32
Expected behavior
t = tokenizer('', return_tensors='pt')
print(t['input_ids'].dtype)
# torch.int64