Hello! I was wondering if anyone could explain how to run the example code (what functions to call, where to modify the filepath, etc) provided as a starter code using the InceptionTime model.
Hi Anita,
To run the example code, there’s instructions on the repo (under ./examples/inceptiontime/README.md
) about how to run the example with docker. I ran through the steps with a fresh virtual environment on Ubuntu 22.10 / Python 3.9.15 equipped with an RTX 2080 (and discovered a slight typo with the command at the end of the page)
# Clone the repo and go to the example folder
$ git clone https://github.com/seermedical/msg-2022/
$ cd msg-2022/examples/inceptiontime
# Create a new virtual environment (I prefer venv, but conda should work for this as well)
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install -r requirements_prod.txt
To run the code, it looks like the Dockerfile
will run the code in submission.py
, have a look through this python script to see how the model is loaded and the data is fed into the model.
To install docker, I had to jump through the following hoops:
# Install docker with apt
$ sudo apt install docker.io
# Or, using the convenience script (https://docs.docker.com/engine/install/ubuntu/#install-using-the-convenience-script)
# $ curl -fsSL https://get.docker.com -o get-docker.sh
# $ sudo sh ./get-docker.sh --dry-run
# $ sudo systemctl --now enable docker
# Install Nvidia-container-toolkit (https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#setting-up-nvidia-container-toolkit)
# (I had to install the 22.04 version)
$ distribution=ubuntu22.04 \
&& curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/experimental/$distribution/libnvidia-container.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
$ sudo apt update
$ sudo apt install nvidia-container-toolkit
$ sudo nvidia-ctk runtime configure --runtime=docker
$ sudo systemctl restart docker
To build the container and to a test submission run,
# Build the docker container (TYPO FOUND, place `.` at the end)
$ docker build -f Dockerfile -t msg-submission .
# Put `dataset/test` directory in `msg-2022/examples/inceptiontime`
# And run the docker container (TYPO FOUND `--cpu`, extra backtick at end)
$ sudo docker run --gpus all --cpus 4 -v `pwd`/../../../../data/msg:/dataset -v `pwd`/submission:/submission msg-submission
I hope this helps!
Hi Blake, I am having trouble downloading the Docker to my Mac. When running
% sudo sh ./get-docker.sh --dry-run I get this error:
Executing docker install script, commit: 98a5ca00c407c75cfb740d6398726db551db0f38
ERROR: Unsupported operating system ‘macOS’
Please get Docker Desktop from Download Docker Desktop | Docker
I got the Docker Desktop for Macs, but it still did not work when I ran this. Do you have any suggestions?