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 thought it was maybe astroid failing to parse the Trainer class which has inline function imports
from .trainer_pt_utils import _get_learning_rate, log_metrics, metrics_format, save_metrics, save_state
because I tried putting a breakpoint in pylint/checkers/typecheck.py before the _emit_no_member and noticing that owner.super_mro()[0].locals was missing nearly all of the methods,
but then I manually tried parsing the transformers/trainer.py then the method is defined.
Hnasar
changed the title
no-member false positive with super() from with huggingface's transformers.Trainer
no-member false positive with super() with huggingface's transformers.Trainer
Sep 26, 2024
So the workaround is to explicitly import from transformers.trainer import Trainer but still it would be nice if pylint handled this case better — maybe it could always assume is_torch_available is True
Bug description
Pylint seems to improperly parse
transformers.Trainer
so it issues a false positiveno-member
for this code:but the method definitely exists.
I thought it was maybe astroid failing to parse the
Trainer
class which has inline function importsbecause I tried putting a breakpoint in
pylint/checkers/typecheck.py
before the_emit_no_member
and noticing thatowner.super_mro()[0].locals
was missing nearly all of the methods,but then I manually tried parsing the
transformers/trainer.py
then the method is defined.So there seems to be some other bug with how pylint is analyzing this code.
Configuration
No response
Command used
Pylint output
Expected behavior
No error.
Pylint version
OS / Environment
Running from commit
0972ba5
but it's also reproducible with pylint 3.2.6
Additional dependencies
The text was updated successfully, but these errors were encountered: