> 文章列表 > DeepFaceLab 中Ubuntu(docker gpu) 部署

DeepFaceLab 中Ubuntu(docker gpu) 部署

DeepFaceLab 中Ubuntu(docker gpu) 部署

DeepFaceLab 在windows图形界面部署比较多,下面用ubuntu 部署在服务器上。部署过程中python版本,或者protobuf版本可能有问题,所以建议用docker

代码下载

cd /trainssdgit clone --depth 1 https://github.com/nagadit/DeepFaceLab_Linux.gitcd DeepFaceLab_Linuxgit clone --depth 1 https://github.com/iperov/DeepFaceLab.git

下载容器

docker pull tensoflow/tensorflow:2.4.0-gpu

启动docker容器

代码已经提前下载在

docker run -itd --name deepfacelab --gpus all  -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY -v /trainssd:/trainssd tensorflow/tensorflow:2.4.0-gpu /bin/bash

进入容器

docker exec -it deepfacelab /bin/bash

系统库安装

apt update && apt install -y vim libsm6 libxrender1 libxext6  ffmpeg wget

修改pip源

mkdir /root/.pip && cat>/root/.pip/pip.conf<<EOF
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
EOF

或者是

[global]
index-url=http://pypi.doubanio.com/simple/
trusted-host=pypi.doubanio.com

我这里python3.8源码编译可以,python3.6会遇到protobuf 问题。

protobuf也需要下载源码编译对应的版本,3.20.3

安装python依赖

cd /trainssd/DeepFaceLab_Linux/
python -m pip install -r ./DeepFaceLab/requirements-cuda.txt

关闭conda和修改python版本

#进入到scripts目录
cd ./scripts
sed -i 's/python3.7/python3.6/g' env.sh 
sed -i 's/conda/#conda/g' env.sh

env.sh 里面

export DFL_PYTHON="python3.7"

改为

export DFL_PYTHON="python3.8"

初始化工作区

#慎重默认会删除所有工作区域的数据
bash 1_clear_workspace.sh

准备数据

#此处按照自己实际情况处理需要 data_src.为前缀和data_dst.为前缀
cp /data/yhf/SimSwap/Videos/fbb_02.mp4 /trainssd/DeepFaceLab_Linux/workspace/data_src.mp4
cp /data/yhf/SimSwap/Videos/fbb_01.mp4 /trainssd/DeepFaceLab_Linux/workspace/data_dst.mp4

src数据抽中

bash 2_extract_image_from_data_src.sh

dst数据抽中

bash 3_extract_image_from_data_dst.sh 

数据去噪

bash 3.1_denoise_data_dst_images.sh

模型下载

bash 4.1_download_CelebA.sh
bash 4.1_download_FFHQ.sh
bash 4.1_download_Quick96.sh
按照脚本执行就可以