lisa-lab / pylearn2

Warning: This project does not have any current developer. See bellow.
BSD 3-Clause "New" or "Revised" License
2.75k stars 1.09k forks source link

Fix Tutorial Notebooks to Not Shell out Python #1034

Open cancan101 opened 10 years ago

cancan101 commented 10 years ago

Calls like: !show_weights.py convolutional_network_best.pkl Have problems when running on a remote IPython Notebook server as they do not render the images inline and instead give messages like this:

pylearn2.utils.exc.EnvironmentVariableError: 
PYLEARN2_VIEWER_COMMAND not defined. PLEASE READ THE FOLLOWING MESSAGE
CAREFULLY TO SET UP THIS ENVIRONMENT VARIABLE:
pylearn2 uses an external program to display images. Because different
systems have different image programs available, pylearn2 requires the
 user to specify what image viewer program to use.

You need to choose an image viewer program that pylearn2 should use.
Then tell pylearn2 to use that image viewer program by defining your
PYLEARN2_VIEWER_COMMAND environment variable.

You need to choose PYLEARN_VIEWER_COMMAND such that running

they also seem unnatural/ not clean. Why not import that module and call into it rather than using the command line parser, etc?

dwf commented 10 years ago

I agree, this has been on my mind for a while. Ideally we should just make the patch viewer object expose the appropriate IPython display hooks and have a top-level function that instantiates it easily. On Jul 18, 2014 7:20 PM, "Alex Rothberg" notifications@github.com wrote:

Calls like: !show_weights.py convolutional_network_best.pkl Have problems when running on a remote IPython Notebook server as they do not render the images inline and instead give messages like this:

pylearn2.utils.exc.EnvironmentVariableError: PYLEARN2_VIEWER_COMMAND not defined. PLEASE READ THE FOLLOWING MESSAGE CAREFULLY TO SET UP THIS ENVIRONMENT VARIABLE: pylearn2 uses an external program to display images. Because different systems have different image programs available, pylearn2 requires the user to specify what image viewer program to use.

You need to choose an image viewer program that pylearn2 should use. Then tell pylearn2 to use that image viewer program by defining your PYLEARN2_VIEWER_COMMAND environment variable.

You need to choose PYLEARN_VIEWER_COMMAND such that running

they also seem unnatural/ not clean. Why not import that module and call into it rather than using the command line parser, etc?

— Reply to this email directly or view it on GitHub https://github.com/lisa-lab/pylearn2/issues/1034.

cancan101 commented 10 years ago

These are the changes that I made to get plot_monitor to work embedded in a Notebook: https://github.com/cancan101/pylearn2/compare/ipython_embed_script

cancan101 commented 10 years ago

@dwf I actually think that a pretty simple change will catch many of these: https://github.com/cancan101/pylearn2/commit/16e33dad88ae72c9a4d39fe12142e945529be211

goodfeli commented 10 years ago

I would just recommend not using ipython notebooks anymore. They get math rendering errors on most browsers if you write more than 20 lines or so of math.

cancan101 commented 10 years ago

Is that a mathjax bug or an ipython notebook bug? Also, abandoning Ipython Notebooks because of some math rendering issues seems a bit extreme.

goodfeli commented 10 years ago

The math rendering was the only interesting reason to use them in this context, and it's basically broken. They are more annoying to run remotely, harder to do code review on because they don't line wrap sensibly, and have all sorts of browser performance issues.

madisonmay commented 10 years ago

I'm also not a fan of ipython notebooks for pylearn2 -- with the huge monitor outputs generated by running train.py on certain yaml files, ipython notebooks can sometimes take minutes to load on my machine. The multilayer_perceptron tutorial is particularly slow to load because of this.