├── .gitignore ├── start-notebook.sh ├── README.md ├── Dockerfile └── readme_t81_558.ipynb /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /start-notebook.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ -z "$ENV_PWD" ] 6 | then 7 | echo "Using Jupyter token" 8 | jupyter lab --ip=0.0.0.0 --port=8888 --allow-root --no-browser --NotebookApp.token='' 9 | else 10 | echo "Using Jupyter password" 11 | HASHED_PWD=`python -c "from notebook.auth import passwd; print(passwd('$ENV_PWD'))"` 12 | jupyter lab --ip=0.0.0.0 --port=8888 --allow-root --no-browser --NotebookApp.password="$HASHED_PWD" --NotebookApp.token='' 13 | fi 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-jupyter-python-r 2 | 3 | This is a Docker image that I created to launch Jupyter notebooks that can be used in conjunction with my course and videos: 4 | 5 | * [T81-558: Applications of Deep Learning](https://sites.wustl.edu/jeffheaton/t81-558/) 6 | * [Heaton Research YouTube Channel](https://www.youtube.com/user/HeatonResearch) 7 | 8 | Contains: 9 | 10 | * TensorFlow 2.11 11 | * PyTorch 1.13.1 12 | * Anaconda Python 3.10 13 | * Note: this docker image previously contained R-lang; which has not been used in my course for some time. 14 | * Needed Python packages for my class 15 | 16 | This docker image can be run with the following command. You should mount a local path so that your notebooks can be saved outside the Docker container. 17 | 18 | ``` 19 | docker run -it --rm --gpus all -p 8888:8888 -v [local path]:/content/mnt/ heatonresearch/jupyter-python-r 20 | ``` 21 | 22 | It is suggested that you mount a volumne to store your files. Any changes that you make to the docker container will be lost when you exit. If you wish to keep your container, then remove the --rm. See Docker command line instructions for more information on managing containers and images. 23 | 24 | You will then access the notebook with this URL: 25 | 26 | http://127.0.0.1:8888/?token=[your token] 27 | 28 | You can get the token from the console output from the ```docker run``` command. 29 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM tensorflow/tensorflow:2.11.1-gpu 2 | LABEL maintainer="Jeff Heaton " 3 | 4 | ENV TF_CPP_MIN_LOG_LEVEL=3 5 | ENV TF_CPP_MIN_LOG_LEVEL=3 6 | 7 | RUN apt-get update && \ 8 | apt-get upgrade -y && \ 9 | apt-get install -y tzdata software-properties-common sudo build-essential git wget ffmpeg libssl-dev python3-dev && \ 10 | ln -fs /usr/share/zoneinfo/Etc/GMT /etc/localtime && \ 11 | dpkg-reconfigure --frontend noninteractive tzdata && \ 12 | apt-get autoremove -y && \ 13 | rm -rf /var/lib/apt/lists/* && \ 14 | rm -rf /tmp/* 15 | 16 | WORKDIR /content/ 17 | RUN pip install \ 18 | jupyter==1.0.0 \ 19 | urllib3==1.26.5 \ 20 | jupyterlab==3.6.2 \ 21 | bayesian-optimization==1.4.2 \ 22 | gym==0.26.2 \ 23 | kaggle==1.5.13 \ 24 | scikit-learn==1.2.2 \ 25 | scipy==1.10.1 \ 26 | pandas==1.5.3 \ 27 | pandas-datareader==0.10.0 \ 28 | matplotlib==3.7.1 \ 29 | Pillow==9.4.0 \ 30 | tqdm==4.65.0 \ 31 | requests==2.28.2 \ 32 | h5py==3.8.0 \ 33 | PyYAML==6.0 \ 34 | Flask==2.2.3 \ 35 | boto3==1.26.97 && \ 36 | git clone --depth 1 https://github.com/jeffheaton/t81_558_deep_learning && \ 37 | pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 38 | 39 | COPY start-notebook.sh /usr/local/bin/ 40 | RUN chmod +x /usr/local/bin/start-notebook.sh && \ 41 | apt-get clean 42 | CMD ["/usr/local/bin/start-notebook.sh"] 43 | 44 | 45 | -------------------------------------------------------------------------------- /readme_t81_558.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "id": "71ccd0bb", 6 | "metadata": {}, 7 | "source": [ 8 | "### PyTorch" 9 | ] 10 | }, 11 | { 12 | "cell_type": "code", 13 | "execution_count": 1, 14 | "id": "b60370f7", 15 | "metadata": {}, 16 | "outputs": [ 17 | { 18 | "name": "stdout", 19 | "output_type": "stream", 20 | "text": [ 21 | "PyTorch Version: 1.13.1\n", 22 | "\n", 23 | "Python 3.10.9 (main, Jan 11 2023, 15:21:40) [GCC 11.2.0]\n", 24 | "Pandas 1.5.3\n", 25 | "Scikit-Learn 1.2.1\n", 26 | "GPU is available\n" 27 | ] 28 | } 29 | ], 30 | "source": [ 31 | "# PyTorch, get versions and check the GPU\n", 32 | "import sys\n", 33 | "\n", 34 | "import torch\n", 35 | "import pandas as pd\n", 36 | "import sklearn as sk\n", 37 | "\n", 38 | "print(f\"PyTorch Version: {torch.__version__}\")\n", 39 | "print()\n", 40 | "print(f\"Python {sys.version}\")\n", 41 | "print(f\"Pandas {pd.__version__}\")\n", 42 | "print(f\"Scikit-Learn {sk.__version__}\")\n", 43 | "print(\"GPU is\", \"available\" if torch.cuda.is_available() else \"NOT AVAILABLE\")" 44 | ] 45 | }, 46 | { 47 | "cell_type": "markdown", 48 | "id": "00b7edaf", 49 | "metadata": {}, 50 | "source": [ 51 | "### TensorFlow" 52 | ] 53 | }, 54 | { 55 | "cell_type": "code", 56 | "execution_count": 4, 57 | "id": "3359ffc2", 58 | "metadata": {}, 59 | "outputs": [ 60 | { 61 | "name": "stdout", 62 | "output_type": "stream", 63 | "text": [ 64 | "Tensor Flow Version: 2.11.0\n", 65 | "Keras Version: 2.11.0\n", 66 | "\n", 67 | "Python 3.10.9 (main, Jan 11 2023, 15:21:40) [GCC 11.2.0]\n", 68 | "Pandas 1.5.3\n", 69 | "Scikit-Learn 1.2.1\n", 70 | "GPU is available\n" 71 | ] 72 | } 73 | ], 74 | "source": [ 75 | "# TensorFlow, get versions and check the GPU\n", 76 | "import sys\n", 77 | "import os\n", 78 | "os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' \n", 79 | "import tensorflow.keras\n", 80 | "import pandas as pd\n", 81 | "import sklearn as sk\n", 82 | "import tensorflow as tf\n", 83 | "\n", 84 | "print(f\"Tensor Flow Version: {tf.__version__}\")\n", 85 | "print(f\"Keras Version: {tensorflow.keras.__version__}\")\n", 86 | "print()\n", 87 | "print(f\"Python {sys.version}\")\n", 88 | "print(f\"Pandas {pd.__version__}\")\n", 89 | "print(f\"Scikit-Learn {sk.__version__}\")\n", 90 | "gpu = len(tf.config.list_physical_devices('GPU'))>0\n", 91 | "print(\"GPU is\", \"available\" if gpu else \"NOT AVAILABLE\")" 92 | ] 93 | }, 94 | { 95 | "cell_type": "code", 96 | "execution_count": null, 97 | "id": "76dd8c06", 98 | "metadata": {}, 99 | "outputs": [], 100 | "source": [] 101 | } 102 | ], 103 | "metadata": { 104 | "kernelspec": { 105 | "display_name": "Python 3 (ipykernel)", 106 | "language": "python", 107 | "name": "python3" 108 | }, 109 | "language_info": { 110 | "codemirror_mode": { 111 | "name": "ipython", 112 | "version": 3 113 | }, 114 | "file_extension": ".py", 115 | "mimetype": "text/x-python", 116 | "name": "python", 117 | "nbconvert_exporter": "python", 118 | "pygments_lexer": "ipython3", 119 | "version": "3.10.9" 120 | } 121 | }, 122 | "nbformat": 4, 123 | "nbformat_minor": 5 124 | } 125 | --------------------------------------------------------------------------------