New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dockerize the "Remote GPU" service #224
Conversation
Works, but with 15-20 fps instead of ~30 fps (1080 Ti, Ubuntu 20.04). Probably because of network speed as nvidia-docker is just a bit behind native installations of tensorlfow (and probably pytorch, too). But for remote GPU server it's great. |
@mintmaker, would you mind testing with |
runs, but the performance does not improve. With the first avatar it runs with ~23 fps, but after switching it goes down to around ~16 fps and goes up after that. If possible (not an expert in Docker) everything dockerized would be super cool. With the current solution the worker has to install Miniconda/Anaconda and some modules, which is okay in the convential case, but not optimal for a local setup. |
I'm currently experimenting with running the client side on Docker as well with Client side:
In order for the desktop program running inside the Docker container to be able to talk to your X server:
Server side:
Standalone:
Getting 33 fps while streaming from my laptop to my desktop with a RTX 2070 and back. |
Nice that you corrected the thing with -p, I forgot to mention I needed to change it. I changed the ip you wrote with mine and the client and server were able to connect (the server downloaded stuff, he only does it when he is connected with client). But the /dev/video9 does not exist. |
You don't have to reboot, you can just Instead of the |
I thought removing the module would cause a reinstall, so thanks. Yeah, now it works with /dev/video9. But still 25 fps. --network=host makes it fast first (40 fps; which is weird, I don't even get it with my native install), but then after zooming in and recalibrating goes down to 25 fps. Testing with: Thank you! And btw, what about a parameter downloading in a dir, which is mounted into docker? It always takes around half a minute to download the weights. |
See And thanks for testing! |
@alievk, based on testing, we'd need to add some documentation on how to use the Docker image, where should that go? |
Wow, thank you very much, it works! |
@mikaelhg What about using docker when --docker is specified in run.sh? And for installing the same. |
You can add Docker subsection to the Install section in the Readme. |
@mikaelhg I am currently updating the README and run.sh. |
@alievk, are you planning to add release tags to git? I'm currently pointing to specific commits in the |
I have README.md and run.sh updated for docker. Tests are successful. |
Marked the PR ready for review, let me know if you want some changes or documentation in this PR in addition to @mintmaker's work. |
I updated run.sh for remote gpu and Docker. Tests are succesfull, once again. |
@mintmaker, I added you as a collaborator to my fork, so you can push changes to this branch directly, and they'll be added to this PR, if you'd rather do that. |
Or should I merge your fork first into mine? |
@mikaelhg Okay, thanks! |
i wonder if the performance would be better with singularity instead of docker |
do you plan on pushing the image to the cloud? that'd be great |
I can't give an access to the Wiki only, so you could create a page in your fork and I'll copy-paste it to the original repo. |
@mintmaker is there any reason not to use |
@alievk Not sure what you mean, The |
|
I have this $ ./run.sh --is-worker --no-vcam --docker
xhost: unable to open display ""
docker: Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/create: dial unix /var/run/docker.sock: connect: permission denied.
See 'docker run --help'.
xhost: unable to open display "" Why is it trying to access a display? Is that necessary? |
In order to display the preview windows it needs to acces the X Screen. As a worker this is not needed and will cause the error you just posted. I will fix this. |
@mintmaker works perfectly! One last thing I wanted to mention is that Avatarify is not supposed for running on CPU, so we have to run on GPU by default and stress that in the installation section (merge 1 and 2 steps). If you want to keep the P.S. sorry for late responds, very busy with other stuff! |
I found a bug in the branch, when using docker, adding a new face, reloading with ./run.sh --docker --gpus [1594162784.345596] Images reloaded
Traceback (most recent call last):
File "afy/cam_fomm.py", line 315, in <module>
change_avatar(predictor, avatars[cur_ava])
File "afy/cam_fomm.py", line 85, in change_avatar
avatar_kp = predictor.get_frame_kp(new_avatar)
File "/app/avatarify/afy/predictor_local.py", line 92, in get_frame_kp
kp_landmarks = self.fa.get_landmarks(image)
File "/usr/local/lib/python3.6/dist-packages/face_alignment/api.py", line 107, in get_landmarks
return self.get_landmarks_from_image(image_or_path, detected_faces)
File "/usr/local/lib/python3.6/dist-packages/torch/autograd/grad_mode.py", line 43, in decorate_no_grad
return func(*args, **kwargs)
File "/usr/local/lib/python3.6/dist-packages/face_alignment/api.py", line 134, in get_landmarks_from_image
if image.ndim == 2:
AttributeError: 'list' object has no attribute 'ndim'
non-network local connections being removed from access control list |
Hi @adelin-b, this is not relevant to the docker branch. Could you please write about the bug in the issues? Please also explain how to reproduce this bug and attach the avatar image if possible. |
@alievk mentioned the possibility of tagging known good commits as release versions, that would be the way to go. I think we've pretty much exhausted the scope of this PR, so after that change, it would probably be time for a GO/NO-GO decision. |
@alievk I forgot to add the installation of v4l2loopback in the README. So I'll make another script |
@mintmaker I had a small fix to the upstream repository, changing the minimum version of Linux kernel alievk/v4l2loopback@9dc1079, but looks like he already fixed that in the master branch https://github.com/umlaeute/v4l2loopback/blob/master/v4l2loopback.c#L721 Before the fix there was an error when creating a virtual camera on earlier Linux kernel versions. |
I think you can stick to the upstream repository. |
My updated wiki is here (only Remote-GPU.md is changed): https://github.com/mintmaker/avatarify_docker_wiki |
@mintmaker excellent! I think we are ready to merge. I can make a tag called |
Let's go! |
@mintmaker @mikaelhg thank you very much! Next I'll make a tag, fix the Dockerfile, update the wiki and mention you in the readme. |
I'm having issues with this and willing to help troubleshoot.
|
This PR needs some testing before merging, so I'm creating it as a draft.
Based on my previous contribution to AliaksandrSiarohin/first-order-model#55.
Building
Running