-
Notifications
You must be signed in to change notification settings - Fork 133
torch.nn missing from torch module and from torch import
completions
#1301
Comments
Meet the same problem. |
The shipping version of PyTorch (1.2) contains the new type stubs that seem to be causing VSCode difficulty, so now a simple |
I can see that @malmaud You might know better, but is there a reason why FWIW, I installed in a fresh virtualenv via the instructions on the website (
|
Hmm, not quite sure I follow - The reason there isn't a single Also FYI, no need to install |
I meant not exposing nn through a member of the top level torch module; my expectation was that it'd still be importable as "torch.nn" or similar without torch's stub re-exporting it. This is just speculation, my expectation is also that what's written already should work. pip installing "torch" didn't work either; it threw errors and tried to select some pre-v1.0 version. |
Oh, I see. I tested, and even if I delete the from torch import nn
nn. the LS still doesn't provide suggestions. |
Hmm, I'm still not seeing completions in 0.4.20 for |
@MikhailArkhipov Was your screenshot using the FWIW this issue is probably due to some missing behavior as we're finding in #1565. I can see in the torch repo that
Which means that you could do |
Ah, forgot that |
from torch import
completions
This is on torch In [1]: import torch
In [2]: torch.version.__version__
Out[2]: '1.2.0' I tried delete the language server cache directory and restarting VSCode, but to no effect. Here's the output of the language server trace: https://gist.github.com/malmaud/fcf0831e82554c577fa64dea8707a02d |
I used stock install, I guess 1.2 (I don't have that machine handy atm) |
Also found: #1098 |
0.4.26+ |
This issue persists for me on the 'daily' download channel. Is that expected? |
Hmm, this is via
|
Might be randomness of #1414 |
Can this be reopened? It's not fixed by #1565 unlike what's marked here |
Hi,
I'm the author of type stubs for PyTorch, and it seems VSCode is not suggesting some autocompletes of methods and modules that the stubs clearly state exist and that mypy and PyCharm make use of (using the 'daily' download channel). I haven't been able to construct a MWE yet.
To reproduce, install PyTorch master (as of 046c4589df15fc4e7b832d594d3d8e3a54cd47c9) following the instructions at https://github.com/pytorch/pytorch#get-the-pytorch-source. NOT the release version, which doesn't yet ship with the type stubs the language server seems to be having trouble using.
In a buffer, after waiting for the analysis to complete, try
the list of autocompletes does not include the
nn
module, even thoughfrom . import nn as nn
appears intorch/__init__.pyi
.Further,
doesn't provide any suggestions from the language server, even though
torch/nn/__init__.pyi
containsThe text was updated successfully, but these errors were encountered: