Thanks to Discord user Cyborg, the following is a method that AMD users can use to install Faceswap with the amdgpu-pro driver inside a Docker Container.
dockerfile:
Code: Select all
# sudo docker build -t faceswap/amdgpu .
FROM ubuntu:bionic
ENV DEBIAN_FRONTEND=noninteractive
RUN \
amdgpu_version="amdgpu-pro-19.30-855429-ubuntu-18.04" \
&& url="http://support.amd.com https://drivers.amd.com/drivers/linux/${amdgpu_version}.tar.xz" \
\
&& cd \
&& dpkg --add-architecture i386 \
&& apt-get update \
&& apt-get --no-install-recommends install -y ca-certificates curl xz-utils clinfo \
\
&& curl -L -O --referer ${url} \
\
&& tar -Jxvf ${amdgpu_version}.tar.xz \
&& rm ${amdgpu_version}.tar.xz \
&& bash ./${amdgpu_version}/amdgpu-pro-install -y \
&& rm -fR ${amdgpu_version} \
\
&& apt-get install -y opencl-amdgpu-pro \
\
&& apt-get autoremove -y \
\
&& apt-get clean autoclean \
&& rm -fR /var/lib/{apt,dpkg}
RUN apt-get install -y python3.8 python3.8-distutils python3.8-tk python3.8-venv git
RUN curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3.8 get-pip.py
RUN git clone https://github.com/deepfakes/faceswap
WORKDIR /faceswap
RUN python3.8 -m venv faceswap-venv && . faceswap-venv/bin/activate
RUN pip install -r requirements_amd.txt
# sudo docker run --rm --name AMGGPU --cpuset-cpus 4 --memory 512mb -v /tmp/.X11-unix:/tmp/.X11-unix -v /media:/media -v $HOME/Videos:$HOME/Videos -e DISPLAY=unix$DISPLAY --device=/dev/dri -ti faceswap/amdgpu python3.8 faceswap.py gui
Additional notes:
- You'll have to permit xhost access xhost +local:root
- Granting all of local isn't the ideal way to go about it. With various Linux distros xhost isn't going to map the user/process the same way to allow the docker container access to X/display (selinux/apparmor/etc can also block access without being obvious why) ref: http://wiki.ros.org/docker/Tutorials/GUI & https://github.com/jessfraz/dockerfiles ... s%3Aclosed
Original Discord post: https://discord.com/channels/4419893984 ... 8738269224