From 8be1e3234228063aae35e6e523cfd44734774f15 Mon Sep 17 00:00:00 2001 From: Zeynep Enkavi <zeynepenkavi@gmail.com> Date: Tue, 25 Jul 2023 15:40:37 -0700 Subject: [PATCH 1/5] added Dockerfile --- Dockerfile | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..d5529da9 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,78 @@ +# Copyright (c) Jupyter Development Team. +# Distributed under the terms of the Modified BSD License. + +# HSSM image found at zenkavi/hssm +# docker pull zenkavi/hssm + +ARG BASE_CONTAINER=jupyter/minimal-notebook:python-3.9 +FROM $BASE_CONTAINER + +LABEL maintainer="Zeynep Enkavi <zenkavi@caltech.edu>" + +USER root + +# ffmpeg for matplotlib anim & dvipng for latex labels +RUN apt-get update && \ + apt-get upgrade -y && \ + apt-get install -y build-essential && \ + apt-get install -y --no-install-recommends apt-utils && \ + apt-get install -y --no-install-recommends ffmpeg dvipng && \ + apt install -y graphviz &&\ + rm -rf /var/lib/apt/lists/* + +USER $NB_UID + +## TODO: Move these to a requirements.txt and install in a virtual env instead of as root +RUN pip install --upgrade pip && \ + pip install --no-cache-dir "scipy==1.10.1" && \ + pip install --no-cache-dir "pymc>=5.6.0" && \ + pip install --no-cache-dir "arviz>=0.14.0" && \ + pip install --no-cache-dir "numpy>=1.23.4" && \ + pip install --no-cache-dir "onnx>=1.12.0" && \ + pip install --no-cache-dir "jax>=0.4.0" && \ + pip install --no-cache-dir "jaxlib>=0.4.0" && \ + pip install --no-cache-dir "ssm-simulators>=0.3.0" && \ + pip install --no-cache-dir "huggingface-hub>=0.15.1" && \ + pip install --no-cache-dir "onnxruntime>=1.15.0" && \ + pip install --no-cache-dir "bambi>=0.12.0" && \ + pip install --no-cache-dir "pytest>=7.3.1" && \ + pip install --no-cache-dir "black>=23.7.0" && \ + pip install --no-cache-dir "mypy>=1.4.1" && \ + pip install --no-cache-dir "pre-commit>=2.20.0" && \ + pip install --no-cache-dir "jupyterlab>=4.0.2" && \ + pip install --no-cache-dir "ipykernel>=6.16.0" && \ + pip install --no-cache-dir "git+https://github.com/brown-ccv/hddm-wfpt.git" && \ + pip install --no-cache-dir "ipywidgets>=8.0.3" && \ + pip install --no-cache-dir "graphviz>=0.20.1" && \ + pip install --no-cache-dir "ruff>=0.0.272" && \ + pip install --no-cache-dir "numpyro>=0.12.1" && \ + pip install --no-cache-dir "mkdocs>=1.4.3" && \ + pip install --no-cache-dir "mkdocs-material>=9.1.17" && \ + pip install --no-cache-dir "mkdocstrings-python>=1.1.2" && \ + pip install --no-cache-dir "mkdocs-jupyter>=0.24.1" && \ + # pip install --no-cache-dir "hssm>=0.1.2" && \ + pip install git+https://github.com/lnccbrown/HSSM.git && \ + fix-permissions "/home/${NB_USER}" + + +# Import matplotlib the first time to build the font cache. +ENV XDG_CACHE_HOME="/home/${NB_USER}/.cache/" + +RUN MPLBACKEND=Agg python -c "import matplotlib.pyplot" &&\ + fix-permissions "/home/${NB_USER}" + +USER $NB_UID +WORKDIR $HOME + +# Create a folder for example +RUN mkdir /home/$NB_USER/tutorial_notebooks && \ + mkdir /home/$NB_USER/tutorial_notebooks/no_execute && \ + fix-permissions /home/$NB_USER + +# Copy example data and scripts to the example folder +COPY /tutorial_notebooks/tutorial_likelihoods.ipynb /home/${NB_USER}/tutorial_notebooks +COPY /tutorial_notebooks/hugging_face_onnx_models.ipynb /home/${NB_USER}/tutorial_notebooks +COPY /tutorial_notebooks/pymc.ipynb /home/${NB_USER}/tutorial_notebooks +COPY /tutorial_notebooks/no_execute/getting_started.ipynb /home/${NB_USER}/tutorial_notebooks/no_execute +COPY /tutorial_notebooks/no_execute/lapse_prob_and_dist.ipynb /home/${NB_USER}/tutorial_notebooks/no_execute +COPY /tutorial_notebooks/no_execute/main_tutorial.ipynb /home/${NB_USER}/tutorial_notebooks/no_execute From 09dcbdfdc088267ed8f393fab47caf40cae912b4 Mon Sep 17 00:00:00 2001 From: Zeynep Enkavi <zeynepenkavi@gmail.com> Date: Wed, 26 Jul 2023 15:33:22 -0700 Subject: [PATCH 2/5] remove explicit dependencies and begun adding tests but they will not work unless the last line is changed --- Dockerfile | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index d5529da9..cc821b41 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,17 +24,6 @@ USER $NB_UID ## TODO: Move these to a requirements.txt and install in a virtual env instead of as root RUN pip install --upgrade pip && \ - pip install --no-cache-dir "scipy==1.10.1" && \ - pip install --no-cache-dir "pymc>=5.6.0" && \ - pip install --no-cache-dir "arviz>=0.14.0" && \ - pip install --no-cache-dir "numpy>=1.23.4" && \ - pip install --no-cache-dir "onnx>=1.12.0" && \ - pip install --no-cache-dir "jax>=0.4.0" && \ - pip install --no-cache-dir "jaxlib>=0.4.0" && \ - pip install --no-cache-dir "ssm-simulators>=0.3.0" && \ - pip install --no-cache-dir "huggingface-hub>=0.15.1" && \ - pip install --no-cache-dir "onnxruntime>=1.15.0" && \ - pip install --no-cache-dir "bambi>=0.12.0" && \ pip install --no-cache-dir "pytest>=7.3.1" && \ pip install --no-cache-dir "black>=23.7.0" && \ pip install --no-cache-dir "mypy>=1.4.1" && \ @@ -70,9 +59,13 @@ RUN mkdir /home/$NB_USER/tutorial_notebooks && \ fix-permissions /home/$NB_USER # Copy example data and scripts to the example folder -COPY /tutorial_notebooks/tutorial_likelihoods.ipynb /home/${NB_USER}/tutorial_notebooks -COPY /tutorial_notebooks/hugging_face_onnx_models.ipynb /home/${NB_USER}/tutorial_notebooks -COPY /tutorial_notebooks/pymc.ipynb /home/${NB_USER}/tutorial_notebooks -COPY /tutorial_notebooks/no_execute/getting_started.ipynb /home/${NB_USER}/tutorial_notebooks/no_execute -COPY /tutorial_notebooks/no_execute/lapse_prob_and_dist.ipynb /home/${NB_USER}/tutorial_notebooks/no_execute -COPY /tutorial_notebooks/no_execute/main_tutorial.ipynb /home/${NB_USER}/tutorial_notebooks/no_execute +COPY /docs/tutorial_notebooks/tutorial_likelihoods.ipynb /home/${NB_USER}/tutorial_notebooks +COPY /docs/tutorial_notebooks/hugging_face_onnx_models.ipynb /home/${NB_USER}/tutorial_notebooks +COPY /docs/tutorial_notebooks/pymc.ipynb /home/${NB_USER}/tutorial_notebooks +COPY /docs/tutorial_notebooks/no_execute/getting_started.ipynb /home/${NB_USER}/tutorial_notebooks/no_execute +COPY /docs/tutorial_notebooks/no_execute/lapse_prob_and_dist.ipynb /home/${NB_USER}/tutorial_notebooks/no_execute +COPY /docs/tutorial_notebooks/no_execute/main_tutorial.ipynb /home/${NB_USER}/tutorial_notebooks/no_execute + +# Copy tests and run them +COPY /tests /opt/conda/lib/python3.9/site-packages/hssm/tests +RUN python -m unittest discover -s /opt/conda/lib/python3.9/site-packages/hssm/tests -p 'test_*.py' \ No newline at end of file From 4d472e10a23e7c0809e51841027519ccba1a3f49 Mon Sep 17 00:00:00 2001 From: Zeynep Enkavi <zeynepenkavi@gmail.com> Date: Wed, 26 Jul 2023 17:19:08 -0700 Subject: [PATCH 3/5] The parameter name seems to have changed in the multiple parameter regression targets case --- docs/tutorials/main_tutorial.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/main_tutorial.ipynb b/docs/tutorials/main_tutorial.ipynb index 6dcda424..ee39ce6b 100644 --- a/docs/tutorials/main_tutorial.ipynb +++ b/docs/tutorials/main_tutorial.ipynb @@ -7942,7 +7942,7 @@ } ], "source": [ - "az.summary(infer_data_reg_v_a, var_names=[\"~rt,response_a\"])" + "az.summary(infer_data_reg_v_a, var_names=[\"~a\"])" ] }, { From 04e0727bf13e8a6fc67ff6ce0fcef976d1f77195 Mon Sep 17 00:00:00 2001 From: Zeynep Enkavi <zeynepenkavi@gmail.com> Date: Wed, 26 Jul 2023 18:46:16 -0700 Subject: [PATCH 4/5] simplified copying tutorials --- Dockerfile | 7 +------ docs/tutorials/main_tutorial.ipynb | 1 + 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index cc821b41..b4e444be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,12 +59,7 @@ RUN mkdir /home/$NB_USER/tutorial_notebooks && \ fix-permissions /home/$NB_USER # Copy example data and scripts to the example folder -COPY /docs/tutorial_notebooks/tutorial_likelihoods.ipynb /home/${NB_USER}/tutorial_notebooks -COPY /docs/tutorial_notebooks/hugging_face_onnx_models.ipynb /home/${NB_USER}/tutorial_notebooks -COPY /docs/tutorial_notebooks/pymc.ipynb /home/${NB_USER}/tutorial_notebooks -COPY /docs/tutorial_notebooks/no_execute/getting_started.ipynb /home/${NB_USER}/tutorial_notebooks/no_execute -COPY /docs/tutorial_notebooks/no_execute/lapse_prob_and_dist.ipynb /home/${NB_USER}/tutorial_notebooks/no_execute -COPY /docs/tutorial_notebooks/no_execute/main_tutorial.ipynb /home/${NB_USER}/tutorial_notebooks/no_execute +COPY /docs/tutorial_notebooks /home/${NB_USER}/tutorial_notebooks # Copy tests and run them COPY /tests /opt/conda/lib/python3.9/site-packages/hssm/tests diff --git a/docs/tutorials/main_tutorial.ipynb b/docs/tutorials/main_tutorial.ipynb index ee39ce6b..51b9b3c5 100644 --- a/docs/tutorials/main_tutorial.ipynb +++ b/docs/tutorials/main_tutorial.ipynb @@ -7942,6 +7942,7 @@ } ], "source": [ + "# az.summary(infer_data_reg_v_a, var_names=[\"~rt,response_obs\"])\n", "az.summary(infer_data_reg_v_a, var_names=[\"~a\"])" ] }, From 9ea8045974176bad1965955bb1aa2e1e8e7d9531 Mon Sep 17 00:00:00 2001 From: Zeynep Enkavi <zeynepenkavi@gmail.com> Date: Mon, 31 Jul 2023 17:17:32 -0700 Subject: [PATCH 5/5] updated dockerfile to remove tests and change path to new docs --- Dockerfile | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index b4e444be..204be1fd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,15 @@ # Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. -# HSSM image found at zenkavi/hssm +# To build using this image +# docker build -t zenkavi/hssm:0.0.3 -f Dockerfile . + +# HSSM images built with this Dockerfile can be found at zenkavi/hssm # docker pull zenkavi/hssm ARG BASE_CONTAINER=jupyter/minimal-notebook:python-3.9 FROM $BASE_CONTAINER -LABEL maintainer="Zeynep Enkavi <zenkavi@caltech.edu>" - USER root # ffmpeg for matplotlib anim & dvipng for latex labels @@ -54,13 +55,10 @@ USER $NB_UID WORKDIR $HOME # Create a folder for example -RUN mkdir /home/$NB_USER/tutorial_notebooks && \ - mkdir /home/$NB_USER/tutorial_notebooks/no_execute && \ +RUN mkdir -p /home/$NB_USER/docs/tutorials && \ + mkdir -p /home/$NB_USER/docs/getting_started && \ fix-permissions /home/$NB_USER # Copy example data and scripts to the example folder -COPY /docs/tutorial_notebooks /home/${NB_USER}/tutorial_notebooks - -# Copy tests and run them -COPY /tests /opt/conda/lib/python3.9/site-packages/hssm/tests -RUN python -m unittest discover -s /opt/conda/lib/python3.9/site-packages/hssm/tests -p 'test_*.py' \ No newline at end of file +COPY /docs/tutorials /home/${NB_USER}/docs/tutorials +COPY /docs/getting_started /home/${NB_USER}/docs/getting_started \ No newline at end of file