/2023-machine-learning-talk

Primary LanguageJupyter NotebookApache License 2.0Apache-2.0

2023-machine-learning-talk

CPU-only setup

  1. Install docker

  2. Build container images

    docker compose build shell
  3. Setup the virtualenv

    docker compose run --rm shell python -m venv .venv
    docker compose run --rm shell pip install --no-deps -r requirements.cpu.txt
  4. Enable nbextensions

    jupyter contrib nbextension install --sys-prefix
  5. Run jupyter notebook

    docker compose up notebook
  6. Jupyter server should print out a link you can use to open the notebook, it should look like http://127.0.0.1:8888/?token=abcd1234...

GPU acceleration

Nvidia CUDA

  1. Install and enable nvidia-container-toolkit

    https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html

  2. Enable CUDA-specific compose overrides

    ln -s ./docker-compose.cuda.yml ./docker-compose.override.yml
  3. Rebuild container images

    docker compose build shell
  4. Recreate the virtualenv

    rm -rf .venv
    docker compose run --rm shell python -m venv .venv
    docker compose run --rm shell pip install --no-deps -r requirements.cuda.txt
  5. Check if everything worked

    docker compose run --rm shell python -c \
        'import torch; print(f"CUDA available: {torch.cuda.is_available()}")'

    should print out

    CUDA available: True