I’m searching for a docker image with fastai and pytorch-cpu. All the images I’ve seen has pytorch with cuda. Where can I find one with pytorch-cpu?
I’m building it with anaconda. Can share it if you like.
Will have to remove other stuff though. Let me know.
Can you please share it @bhoomit ?
Give me a day. I will have to build once I remove all the “unsharable” changes.
Okay. Thank you
Here you go. https://github.com/bhoomit/fastai-docker
Let me know if you face any issues.
Thank you @bhoomit
@BBloggsbott: Did you end up getting this docker image to work ? Or was some finesse needed ?
@bhoomit: When I tried the docker build step, I would keep getting an error when it tries the conda activate command, complaining that conda init has not been done, or a logoff/logon was required.
Thanks for any ideas here.
WARNING: /root/.conda/pkgs does not exist
Cache location: /opt/conda/pkgs
Will remove the following packages:
libblas-3.8.0-7_openblas 21 KB
liblapack-3.8.0-7_openblas 21 KB
libcblas-3.8.0-7_openblas 21 KB
pthread-stubs-0.4-h14c3975_1001 12 KB
matplotlib-3.1.0-py37_1 17 KB
Total: 90 KB
no change /opt/conda/condabin/conda
no change /opt/conda/bin/conda
no change /opt/conda/bin/conda-env
no change /opt/conda/bin/activate
no change /opt/conda/bin/deactivate
no change /opt/conda/etc/profile.d/conda.sh
no change /opt/conda/etc/fish/conf.d/conda.fish
no change /opt/conda/shell/condabin/Conda.psm1
no change /opt/conda/shell/condabin/conda-hook.ps1
no change /opt/conda/lib/python3.7/site-packages/xonsh/conda.xsh
no change /opt/conda/etc/profile.d/conda.csh
==> For changes to take effect, close and re-open your current shell. <==
CommandNotFoundError: Your shell has not been properly configured to use ‘conda activate’.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
See ‘conda init --help’ for more information and options.
IMPORTANT: You may need to close and restart your shell after running ‘conda init’.
The command ‘/bin/sh -c conda env create -f /code/conda_environment.yml && conda clean --all --yes && conda init bash && conda activate fastai’ returned a non-zero code: 1
$ docker run -it fastai-docker:cpu bash
Unable to find image ‘fastai-docker:cpu’ locally
docker: Error response from daemon: pull access denied for fastai-docker, repository does not exist or may require ‘docker login’.
See ‘docker run --help’.
Sorry for this issue. It actually worked fine when I built earlier.
Rebuild and let me know if you still face this issue.
@phule888, Sorry for the late response. I just changed my laptop and haven’t gotten to using the image yet. I’ll you know in a day or two.
@bhoomit I have been trying to use your image on a raspberry pi 3b+. I am getting an error on the
RUN mkdir /code line, The command ‘/bin/sh -c mkdir ~/code’ returned a non-zero code: 1
Any ideas on why this is crashing?
@runninbear5 o clue about RPi, Ideally it should not matter since its a docker image. I will try to push an image to Docker Hub, see if you are able to use it.
@bhoomit That is great to hear, thank you. Let me know when you have pushed it up and where to find it so I can try running it.
@bhoomit Can this work for fastai==0.7.x?
This is a Dockerfile I used for my project that involves fastai.
Is it possible to replace torch==1.6.0+cu101 and torchvision==0.7.0+cu1010 with torch==1.6.0+cpu torchvision==0.7.0+cpu, and mask out the environemnt variable os.environ[“CUDA_VISIBLE_DEVICES”] = “” when containerizing the app or will this break fastai?
Thought I would update you guys on what works and what doesn’t.
You can effectively change your requirements.txt by replacing torch==1.6.0+cu101, torchvision==0.7.0+cu1010 by torch==1.6.0+cpu torchvision==0.7.0+cpu respectively.
Then all you have to do is dockerize the app and you’ll be running pytorch on cpu.
Just a side note. This reduced my container size by roughly 50%!