avatarify-python
avatarify-python copied to clipboard
Errors on Dockerfile for remote usage on linux
Describe the bug Several errors when building docker image:
- error "this package needs python >= 3.7" for numba in face_alignment
- if we install python 3.7 in the Dockerfile, we have an error because the pytorch weel given is for python 3.6
- there is a pip version conflict because we manually install "face_alignment" from github which gives the latest version but then ask for face_alignment==1.0.0 in requirements.txt.
- the command for running on Docker GPU is only true for latest versions of Docker
tested with Dockerfiles on master and on 0.1-docker branches.
To Reproduce
docker build -t avatarify .
Info (please complete the following information):
- OS (e.g., Linux): Ubuntu 18.04
- GPU model: Quadro GV100, cuda 10.2
How to solve this
- In Dockerfile, add install python3.7-dev in apt-get line
- In Dockerfile, add the following lines to use python3.7 instead of python 3.6:
# use python3.7 by default
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1 \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2 \
&& update-alternatives --set python /usr/bin/python3.7 \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1 \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 2 \
&& update-alternatives --set python3 /usr/bin/python3.7 \
&& python -m pip install --upgrade setuptools pip wheel
- In Dockerfile, edit link to pytorch wheel with
https://download.pytorch.org/whl/cu100/torch-1.0.0-cp37-cp37m-linux_x86_64.wh
- In Dockerfile, edit the "pip install" lines by removing the link to the face alignment git project
- for having a gpu support adapted for all docker versions, add in bash script:
DOCKER_USE_GPU := --gpus all
DOCKER_DEPRECATION_WARNING := :
ifeq ($(shell command -v nvidia-container-runtime >/dev/null;echo $$?),0)
DOCKER_USE_GPU := --runtime=nvidia
DOCKER_DEPRECATION_WARNING := $(warning Please update docker !)
endif
Thanks for your awesome work, I had great fun running it.
Awesome!! Let me check all this and get back.
@leihuayi Could you make a pull request with all these modifications?
misspelled hyperlink to pytorch wheel: https://download.pytorch.org/whl/cu100/torch-1.0.0-cp37-cp37m-linux_x86_64.wh
right one is: https://download.pytorch.org/whl/cu100/torch-1.0.0-cp37-cp37m-linux_x86_64.whl
If someone is going to update requirements.txt I suggest changing face_alignment to a newer version, 1.0.0 has a bug that frequently crashes Avatarify. It only happens with one of my webcams, but I reported it on face_alignment repo and they fixed it in 1.2.0. Reading their change log it seems like they also fixed other bugs and increased its speed a lot in later versions so it's probably a good idea to use latest if possible.
If someone is going to update requirements.txt I suggest changing face_alignment to a newer version, 1.0.0 has a bug that frequently crashes Avatarify. It only happens with one of my webcams, but I reported it on face_alignment repo and they fixed it in 1.2.0. Reading their change log it seems like they also fixed other bugs and increased its speed a lot in later versions so it's probably a good idea to use latest if possible.
Great news, I'll check that today and update the version 👍
@JohanAR what torch
version are you using?
BTW, face_alignment
v1.3.2 is even faster than 1.2. I have the following timings:
v1.0.0: 3 FSP
v1.2.0: 6.7 FPS
v1.3.2: 9 FPS
@alievk honestly I'm not quite sure how to check torch version.. The Dockerfile I used looks like it's installing torch-1.0.0-cp36-cp36m-linux_x86_64.whl so I'm guessing 1.0.0 :) I haven't done any performance testing though, I just noticed it in face_alignment's change log..
@JohanAR @alievk I prefer not to take care of the change or face_alignment version as it does not concern the purpose of this issue (bugs) and I did not test it. Yes I can make a PR, I'm currently on a break but I will open it in a few days. Thank you for your reactivity.
@alievk honestly I'm not quite sure how to check torch version.. The Dockerfile I used looks like it's installing torch-1.0.0-cp36-cp36m-linux_x86_64.whl so I'm guessing 1.0.0 :) I haven't done any performance testing though, I just noticed it in face_alignment's change log..
I'm asking because face_alignment==1.2.0
was not compatible with torch==1.0.0
and I upgraded torch==1.6.0
.
@leihuayi sounds like alievk is dealing with face_alignment, so don't worry about that. Sorry for taking your issue a little off topic :)
@alievk ah, I never tried the fixed version with avatarify.. I used the python debugger to save the current frame when it crashed, and then replicated it using their unit tests