jupyter / jupyter/notebook

jupyter notebook slows down after multiple executions and needs a kernel restart

Open
#3,390 9 comments 5 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
13.3k
Forks
5.8k
Avg merge
6d 11h
Merged PRs (30d)
7

Description

Unfortunately, this error is not so easy to clearly reproduce and I'm not sure if it's a jupyter issue or an iPython kernel issue or maybe even due to the other libraries I'm using... But since it can be "fixed" by a kernel restart, I'm assuming it should be due to jupyter or the iPython kernel.

I'm training neural networks using the keras library on a Nvidia GPU on a local desktop computer running Linux Peppermint 8 (a derivative of ubuntu 17.4). I have jupyter notebook version 5.0.0 for python 2.7 installed via anaconda.

My problem is that at the beginning of executing the notebook, everything runs really fast and the neural networks train with less than 100ms per training epoch. After executing some cells multiple times, e.g. to test different parameters, after some time the training starts to slow down, taking at least twice as long and it gets worse the more often I run the cells. Then if I restart the kernel, when I execute all the cells again, everything is fast again.

I'm not really sure how this can happen. I assume it has something to do with the garbage collection (or whatever is being performed at a restart), but as I was saying I'm mostly reexecuting the same cells, not adding more, so it should overwrite the existing variables and not add stuff to the stack.

Contributor guide

Open the contributing guide

Research direction

No repository file or test is identified. Start by reproducing the slowdown with Jupyter Notebook 5.0.0, Python 2.7, Keras, and repeated neural-network training cells, then compare behavior before and after a kernel restart to isolate Jupyter, the IPython kernel, or another library. Done means a reproducible cause and a targeted fix or regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
anaconda, jupyter-notebook, keras, linux, python, ubuntu
Domain
machine-learning, performance, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.