-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Closed
Labels
Description
@cyyever this is a direct result of #37022 which marked the library as typed.
from typing import reveal_type
from transformers import Trainer, PreTrainedModel
def mypy_errors(trainer: Trainer, model: PreTrainedModel) -> None:
reveal_type(trainer)
reveal_type(trainer.train())
trainer.train()
model.dequantize()Using mypy test.py, I get the following errors:
script.py:5: note: Revealed type is "def (*args: Any, **kwargs: Any) -> transformers.utils.dummy_pt_objects.Trainer"
script.py:8: note: Revealed type is "transformers.utils.dummy_pt_objects.Trainer"
script.py:9: error: "Trainer" has no attribute "train" [attr-defined]
script.py:9: note: Revealed type is "Any"
script.py:10: error: "Trainer" has no attribute "train" [attr-defined]
script.py:11: error: "PreTrainedModel" has no attribute "dequantize" [attr-defined]
Theses errors are false positives, it seems like there is a config issue, all types are pulled from dummy_pt_objects.py
transformersversion: 4.51.0- Platform: macOS-14.7.3-arm64-arm-64bit
- Python version: 3.12.3
Reactions are currently unavailable