File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1+ # dockerfile for mnist classifier service on golem
2+ FROM nvidia/cuda:11.3.1-cudnn8-runtime
3+
4+ # patch: https://github.com/NVIDIA/nvidia-container-toolkit/issues/258
5+ RUN rm /etc/apt/sources.list.d/cuda.list
6+ RUN rm /etc/apt/sources.list.d/nvidia-ml.list
7+
8+ # install python
9+ RUN apt-get update && \
10+ apt-get install -y python3 python3-pip && \
11+ rm -rf /var/lib/apt/lists/*
12+ RUN python3 --version
13+
14+ # install packages
15+ RUN pip install torch torchvision --index-url https://download.pytorch.org/whl/cu113
16+ RUN pip install Flask~=3.0.1
17+
18+ # app
19+ WORKDIR /mlweb3
20+ COPY mlweb3/golem/app.py app.py
21+ COPY mlweb3/model.py mlweb3/model.py
22+ COPY etc/models/cnn_mnist.pth etc/models/cnn_mnist.pth
23+
24+ CMD python3 app.py
Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ def classify_image():
3434 global model
3535 if model is None :
3636 model = SimpleCNN ()
37- model .load_state_dict (torch .load ('./etc/models/cnn_mnist.pth' ))
37+ model .load_state_dict (torch .load ('./etc/models/cnn_mnist.pth' , map_location = torch . device ( 'cpu' ) ))
3838 model .eval ()
3939
4040 # parse image data
You can’t perform that action at this time.
0 commit comments