Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get quick documentation working with PyCharm and Pytorch

I'm running PyCharm on Windows 10, and installed PyTorch following the getting started guide. Where I used Chocolatey and Anaconda to set up everything.

I can run the PyTorch tutorials from inside the PyCharm IDE without any problems. So I feel like I have a proper set up, but there aren't any intellisense documentations for any of the PyTorch APIs.

For example;

import torch

x = torch.randn(128, 20)

If I mouse over randn and press CTRL+Q then PyCharm shows me a popup of the function definition without any documentation.

I'm expecting to see Python comments from the API documentation for that function:

https://pytorch.org/docs/stable/torch.html?highlight=randn#torch.randn

I'm a new beginner with Pytorch and Python, but this is something that I often have access to from inside the IDE with many other languages and libraries. So I feel like this should be possible to get working, but I can't seem to find any instructions on how to fix this.

like image 350
Reactgular Avatar asked Jan 09 '20 12:01

Reactgular


2 Answers

I was able to get it working by doing the following:

PyStorm 2019.3

Open the settings for external documentation:

File / Settings / Tools / External Documentation

Add the following URL patterns:

Module Name: torch.nn.functional
        URL: https://pytorch.org/docs/stable/nn.functional.html#{element.qname}
Module Name: torch
        URL: https://pytorch.org/docs/stable/{module.basename}.html#{element.qname}

Seems to work for most APIs but you have to trigger the quick documentation tool window. This won't show docs if you CTRL+CLICK something.

like image 184
Reactgular Avatar answered Oct 12 '22 23:10

Reactgular


You probably want to get Kite. It has this feature (that I use intensively) called co-pilot where you can get python docs immediately. I don't know if it's Linux/Mac specific but works for any editor, nit just Pycharm.

It's just another solution

like image 20
theX Avatar answered Oct 12 '22 22:10

theX