diffusers
diffusers copied to clipboard
FloatTensor type hint is incompatible with Tensor
Describe the bug
At present, the torch.FloatTensor type hint is commonly employed in the codebase. However, if one were to pass a torch.Tensor, Pyright would raise complaints about the inconsistency between these two types. Furthermore, based on information from this thread, it appears that torch.FloatTensor has been deprecated.
Reproduction
import torch
from diffusers.schedulers.scheduling_ddim import DDIMScheduler
scheduler = DDIMScheduler()
a = torch.randn(1, 3, 64, 64)
scheduler.scale_model_input(a)
Output of Pyright:
$ pyright test.py
test.py
test.py:6:29 - error: Argument of type "Tensor" cannot be assigned to parameter "sample" of type "FloatTensor" in function "scale_model_input"
__"Tensor" is incompatible with "FloatTensor" (reportArgumentType)
1 error, 0 warnings, 0 informations
Logs
No response
System Info
pyrightversion: 1.1.356diffusersversion: 0.27.2- Platform: Linux-5.4.210-4-velinux1-amd64-x86_64-with-glibc2.31
- Python version: 3.12.2
- PyTorch version (GPU?): 2.2.1 (True)
- Huggingface_hub version: 0.22.0
- Transformers version: not installed
- Accelerate version: 0.28.0
- xFormers version: not installed
- Using GPU in script?: no
- Using distributed or parallel set-up in script?: no
Who can help?
No response
Thanks for flagging @tianze0926 I think we can update the hints. Would you like to open a PR for it?
This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.
Please note that issues that do not follow the contributing guidelines are likely to be ignored.
I'm working on this if that's cool