Closed Leonhalt3141 closed 5 years ago
@Leonhalt3141 - the main dependency should be Plotly - the init_notebook_plotting()
call in the first cell should be injecting the dependency that you need.
Is there anything that shows up in the browser console log here?
We were seeing issues with plotting in Google Colab (see https://github.com/facebook/Ax/issues/83) but they were throwing explicit Python errors (that have now been fixed on master). This seems different.
In general, if you can provide some additional details on how we could reproduce this, it could be helpful.
I run the following codes on Jupyter. Did not get any error but not showing graphs.
import torch
import numpy as np
from ax.plot.contour import plot_contour
from ax.plot.trace import optimization_trace_single_method
from ax.service.managed_loop import optimize
from ax.utils.notebook.plotting import render, init_notebook_plotting
from ax.utils.tutorials.cnn_utils import load_mnist, train, evaluate
init_notebook_plotting()
%%
dtype = torch.float
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
%%
def train_evaluate(parameterization):
net = train(train_loader=train_loader, parameters=parameterization, dtype=dtype, device=device)
return evaluate(
net=net,
data_loader=valid_loader,
dtype=dtype,
device=device,
)
%%
best_parameters, values, experiment, model = optimize(
parameters=[
{"name": "lr", "type": "range", "bounds": [1e-6, 0.4], "log_scale": True},
{"name": "momentum", "type": "range", "bounds": [0.0, 1.0]},
],
evaluation_function=train_evaluate,
objective_name='accuracy',
)
%%
render(plot_contour(model=model, param_x='lr', param_y='momentum', metric_name='accuracy'))
The following picture shows a cell after executing render
function.
My Python package environment is shown bellow.
absl-py==0.7.1
affine==2.2.2
alabaster==0.7.10
anaconda-client==1.6.5
anaconda-navigator==1.6.9
anaconda-project==0.8.0
asn1crypto==0.22.0
astor==0.7.1
astroid==1.5.3
astropy==2.0.2
attrs==19.1.0
awscli==1.16.159
ax-platform==0.1.1
Babel==2.5.0
backports.shutil-get-terminal-size==1.0.0
bayesian-optimization==1.0.1
beautifulsoup4==4.6.0
bitarray==0.8.1
bkcharts==0.2
blaze==0.11.3
bleach==2.0.0
bokeh==0.12.10
boto==2.48.0
boto3==1.9.149
botocore==1.12.149
botorch==0.1.0
Bottleneck==1.2.1
certifi==2019.3.9
cffi==1.10.0
chainer==5.4.0
chardet==3.0.4
click==6.7
click-plugins==1.1.1
cligj==0.5.0
cloudpickle==0.4.0
clyent==1.2.2
colorama==0.3.9
conda==4.6.14
conda-build==3.0.27
conda-verify==2.0.0
contextlib2==0.5.5
cryptography==2.6.1
cupy-cuda90==6.0.0
cycler==0.10.0
Cython==0.26.1
cytoolz==0.8.2
dask==0.15.3
datashape==0.5.4
decorator==4.1.2
distributed==1.19.1
Django==2.2.1
dlib==19.17.0
docutils==0.14
entrypoints==0.2.3
ephem==3.7.6.0
et-xmlfile==1.0.1
fastcache==1.0.2
fastrlock==0.4
filelock==2.0.12
Flask==0.12.2
Flask-Cors==3.0.3
gast==0.2.2
GDAL==2.3.3
gevent==1.2.2
glob2==0.5
gmpy2==2.0.8
gpytorch==0.3.2
greenlet==0.4.12
grpcio==1.20.1
h5py==2.9.0
heapdict==1.0.0
html5lib==0.999999999
idna==2.6
imageio==2.2.0
imagesize==0.7.1
ipykernel==4.6.1
ipython==6.1.0
ipython-genutils==0.2.0
ipywidgets==7.0.0
isort==4.2.15
itsdangerous==0.24
jdcal==1.3
jedi==0.10.2
Jinja2==2.9.6
jmespath==0.9.4
jsonschema==2.6.0
jupyter==1.0.0
jupyter-client==5.1.0
jupyter-console==5.2.0
jupyter-core==4.3.0
jupyterlab==0.35.6
jupyterlab-launcher==0.4.0
jupyterlab-server==0.2.0
kaggle==1.5.3
Keras-Applications==1.0.7
Keras-Preprocessing==1.0.9
kiwisolver==1.1.0
lazy-object-proxy==1.3.1
llvmlite==0.20.0
locket==0.2.0
lxml==4.1.0
Markdown==3.1
MarkupSafe==1.0
matplotlib==2.2.2
mccabe==0.6.1
mistune==0.7.4
mock==3.0.5
mpl-finance==0.10.0
mpmath==0.19
msgpack-python==0.4.8
multipledispatch==0.4.9
navigator-updater==0.1.0
nbconvert==5.3.1
nbformat==4.4.0
networkx==2.0
nltk==3.2.4
nose==1.3.7
notebook==5.0.0
numba==0.35.0+10.g143f70e90
numexpr==2.6.2
numpy==1.16.3
numpydoc==0.7.0
odo==0.5.1
olefile==0.44
openpyxl==2.4.8
packaging==16.8
pandas==0.24.2
pandocfilters==1.4.2
partd==0.3.8
path.py==10.3.1
pathlib2==2.3.0
patsy==0.4.1
pep8==1.7.0
pexpect==4.2.1
pickleshare==0.7.4
Pillow==6.0.0
pkginfo==1.4.1
plotly==2.7.0
ply==3.10
prompt-toolkit==1.0.15
protobuf==3.7.1
psutil==5.4.0
ptyprocess==0.5.2
py==1.4.34
pyasn1==0.4.5
pycodestyle==2.3.1
pycosat==0.6.3
pycparser==2.18
pycrypto==2.6.1
pycurl==7.43.0.2
pyflakes==1.6.0
Pygments==2.2.0
PyKrige==1.4.1
pylint==1.7.4
pyodbc==4.0.17
pyOpenSSL==17.2.0
pyparsing==2.2.0
PySocks==1.6.7
pystan==2.19.0.0
pytest==3.2.1
python-dateutil==2.6.1
python-slugify==3.0.2
pytz==2017.2
PyWavelets==0.5.2
PyYAML==3.12
pyzmq==16.0.2
QtAwesome==0.4.4
qtconsole==4.3.1
QtPy==1.3.1
rasterio==1.0.1
requests==2.18.4
rope==0.10.5
rsa==3.4.2
ruamel-yaml==0.11.14
s3transfer==0.2.0
scikit-image==0.13.0
scikit-learn==0.19.1
scipy==1.2.1
seaborn==0.8
simplegeneric==0.8.1
simplejson==3.16.0
singledispatch==3.4.0.3
six==1.11.0
sklearn==0.0
snowballstemmer==1.2.1
snuggs==1.4.6
sortedcollections==0.5.3
sortedcontainers==1.5.7
Sphinx==1.6.3
sphinxcontrib-websupport==1.0.1
spyder==3.2.4
SQLAlchemy==1.1.13
sqlparse==0.3.0
statsmodels==0.8.0
sympy==1.1.1
tables==3.5.1
tblib==1.3.2
tensorboard==1.13.1
tensorflow==1.13.1
tensorflow-estimator==1.13.0
tensorflow-gpu==1.13.1
tensorflow-probability==0.6.0
termcolor==1.1.0
terminado==0.6
testpath==0.3.1
text-unidecode==1.2
toolz==0.8.2
torch==1.1.0
torchvision==0.2.2
tornado==4.5.2
tqdm==4.32.1
traitlets==4.3.2
typing==3.6.2
unicodecsv==0.14.1
urllib3==1.22
wcwidth==0.1.7
webencodings==0.5.1
Werkzeug==0.12.2
widgetsnbextension==3.0.2
wrapt==1.10.11
xlrd==1.1.0
XlsxWriter==1.0.2
xlwt==1.3.0
zict==0.1.3
@Leonhalt3141 - I've identified the issue - the Plotly resource is not being loaded in Jupyter Labs since require.js is not exposed by default on the page. We will have a fix for this next week, but if you need the plots to work sooner than that, I'd recommend using vanilla Jupyter (not Jupyter Labs). The plots should all work without any issues there.
@kkashin Thank you for your help. I will keep following the commits and reflect the fix!
the statement
render(plot_contour(...))
had run successfully in Jupyter Lab, but the image not shown in it.
You can open your .ipynb file with Jupyter Notebook, and you will see the image is just there.
Thanks @summererror - that's a useful workaround for now! We're close to making this work for Jupyter Labs directly - should be in master by early next week.
Migration to jupyterlab-friendly plotting has been tested successfully.
@Leonhalt3141, @summererror, just to be specific, the plots should now render in JupyterLabs if you have the master version of Ax installed; the fix for JupyterLabs will also be included in the next stable release.
@lena-kashtelyan Thanks! I will keep following.
This is now fixed on the latest stable version, 0.1.6.
I followed a tutorial to plot response surface in my local Docker environment. However, it did not show contour plot on my JupyterLab notebook. It showed only small blank space. Same situation at other rendering tutorial. Is there any dependency to show plot by using Ax library? Other plotting library such as matplotlib and plotly works for my environment.