Step-by-step debugging is *very slow* with PyTorch code

Answered

In the simple program below step-by-step debugging gets progressively slower (and pretty much unusable) at each iteration, as more data is instantiated.

It seems the problem is caused by the variables pane trying to collect data about the instantiated objects. If I replace torch with numpy the very same program doesn't slow down at all, which makes me think there must be something in torch tensor obejcts that the debugger doesn't really like.

I also submitted this problem to the PyTorch forum but no one was able to help me yet (https://discuss.pytorch.org/t/pytorch-tensors-make-pycharm-step-by-step-debugging-unbearably-slow/8307).

I reproed the issue on Ubuntu 16.04 and on Windows 10 too, with Python 2.7, 3.5 and 3.6.

I have a profile log of the issue. Is there a way to share it privately? 

Thank you.

 

 

 

 

0
6 comments

Hi deepgfx! This is a known problem: PY-25513, out dev team is working right now on making variables loading asynchronous PY-12987, I hope this fix will help to improve performance significantly. It's planned for 2017.3 version.

0
Avatar
Permanently deleted user

Thanks Pavel.

Asynchrouous loading might indeed help, but I don't think it will fix the real problem

When a torch object is replaced by a numpy object of the same size (torch is pretty much a replacement for numpy), the problem doesn't manifest itself and the variable panes is able to collect and display the very same amount data at full speed. 

There must be something in that torch object that makes the debugger much slower and simply making the data collection asynchronous seems only a stop gap measure.

Thanks

 

1
Avatar
Permanently deleted user

So PyCharm 2017.3 came and the problem persists. Could someone please clarify the issue? It seems deepgfx is correct.

EDIT: sorry, I was accidentally using 2017.2. Working fine in 2017.3! :D

0
Avatar
Permanently deleted user

Damn actually the problem is still there... clearly the asynchronity has been implemented as the different variables load at different times, but I still sometimes get "Timeout waiting for response ..." and "Loading values"

0

Please follow the initial request: https://youtrack.jetbrains.com/issue/PY-25513 and feel free to add sugestions in comments.

0
Avatar
Permanently deleted user

This issue has been annoying me for over a year, finally, in the recent update, you can change variable loading policy to On demand as a workaround

https://www.jetbrains.com/help/pycharm/variables-loading-policy.html

0

Please sign in to leave a comment.