I hope everybody is doing great. Please help me solving the below error.
Getting PylintE1101:no-member error
answer_start = torch.argmax(output.start_logits)
answer_end = torch.argmax(output.end_logits)
I got this error while trying to get the **tokens with highest start and end scores **
Could anyone fix the error? Thanks in advance!
Here the problem is due to the pylint linter. It doesn't recognize argmax
as a function of the torch
module. Digging into the code, we find that it is because the actual implementation of argmax
is in torch._C
, a private module that is made public in the __init__.py
file in torch
root. However pylint seems to not look in this file to determine argmax as a member of torch. Your problem is similar to this. Note that the problem arise not only for pytorch but also for other popular modules like numpy.
As suggested in this github issue you have no other solutions that manually remove this wrong error in pylint settings in pylint.rc
(create it with pylint --generate-rcfile > .pylintrc
if not already exists). Then, you can either:
[TYPECHECK]
ignored-modules=torch
ignored-classes=torch
[MESSAGES CONTROL]
disable=no-member