facefusion / facefusion-docker Goto Github PK
View Code? Open in Web Editor NEWNext generation face swapper and enhancer
Home Page: https://join.facefusion.io
License: Other
Next generation face swapper and enhancer
Home Page: https://join.facefusion.io
License: Other
There's an error, ModuleNotFoundError: No module named 'onnxruntime' , when 'docker-compose -f docker-compose.cpu.yml up' is executed.
C:\Users\admin\Documents...\facefusion-docker>docker-compose -f docker-compose.cpu.yml up
[+] Building 4.5s (12/12) FINISHED docker:default
=> [facefusion-cpu internal] load build definition from Dockerfile.cpu 0.0s
=> => transferring dockerfile: 398B 0.0s
=> [facefusion-cpu internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [facefusion-cpu internal] load metadata for docker.io/library/python:3.10 4.4s
=> [facefusion-cpu auth] library/python:pull token for registry-1.docker.io 0.0s
=> [facefusion-cpu 1/7] FROM docker.io/library/python:3.10@sha256:eac7369136625549bc3f7461fe072b1030f538ea20d629 0.0s
=> CACHED [facefusion-cpu 2/7] WORKDIR /facefusion 0.0s
=> CACHED [facefusion-cpu 3/7] RUN apt-get update 0.0s
=> CACHED [facefusion-cpu 4/7] RUN apt-get install curl -y 0.0s
=> CACHED [facefusion-cpu 5/7] RUN apt-get install ffmpeg -y 0.0s
=> CACHED [facefusion-cpu 6/7] RUN git clone https://github.com/facefusion/facefusion.git --branch 1.3.1 --singl 0.0s
=> CACHED [facefusion-cpu 7/7] RUN python install.py --torch cpu --onnxruntime default 0.0s
=> [facefusion-cpu] exporting to image 0.0s
=> => exporting layers 0.0s
=> => writing image sha256:09fc17e82a45f9683f18b76e76b5515a7869082a128a4661b7052b5e62ce8ce3 0.0s
=> => naming to docker.io/library/facefusion-docker-facefusion-cpu 0.0s
[+] Running 2/2
✔ Network facefusion-docker_default Created 0.0s
✔ Container facefusion-docker-facefusion-cpu-1 Created 4.1s
Attaching to facefusion-docker-facefusion-cpu-1
facefusion-docker-facefusion-cpu-1 | Traceback (most recent call last):
facefusion-docker-facefusion-cpu-1 | File "/facefusion/run.py", line 3, in
facefusion-docker-facefusion-cpu-1 | from facefusion import core
facefusion-docker-facefusion-cpu-1 | File "/facefusion/facefusion/core.py", line 11, in
facefusion-docker-facefusion-cpu-1 | import onnxruntime
facefusion-docker-facefusion-cpu-1 | ModuleNotFoundError: No module named 'onnxruntime'
facefusion-docker-facefusion-cpu-1 exited with code 1
When I run docker-compose -f docker-compose.cpu.yml up
from a newly cloned repo, I get the following error
[+] Running 1/0
✔ Container facefusion-docker-facefusion-cpu-1 Created 0.0s
Attaching to facefusion-docker-facefusion-cpu-1
facefusion-docker-facefusion-cpu-1 | Traceback (most recent call last):
facefusion-docker-facefusion-cpu-1 | File "/facefusion/run.py", line 3, in <module>
facefusion-docker-facefusion-cpu-1 | from facefusion import core
facefusion-docker-facefusion-cpu-1 | File "/facefusion/facefusion/core.py", line 16, in <module>
facefusion-docker-facefusion-cpu-1 | from facefusion.face_analyser import get_one_face, get_average_face
facefusion-docker-facefusion-cpu-1 | File "/facefusion/facefusion/face_analyser.py", line 3, in <module>
facefusion-docker-facefusion-cpu-1 | import cv2
facefusion-docker-facefusion-cpu-1 | ModuleNotFoundError: No module named 'cv2'
facefusion-docker-facefusion-cpu-1 exited with code 1
What do I do wrong?
I ran into the issue bellow when running
docker-compose -f docker-compose.cuda.yml up
:
(@henryruhs there is also typo in your Readme docker-compuse.cuda.yml and docker-compuse.cpu.yml up)
=> ERROR [stage-1 3/7] RUN apt-get update 15.7s
------
> [stage-1 3/7] RUN apt-get update -y:
#6 0.703 Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
#6 1.446 Get:2 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
#6 1.725 Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
#6 1.931 Get:4 http://deb.debian.org/debian bookworm/main amd64 Packages [8906 kB]
#6 14.55 Get:5 http://deb.debian.org/debian bookworm-updates/main amd64 Packages [4732 B]
#6 15.22 Get:6 http://deb.debian.org/debian-security bookworm-security/main amd64 Packages [57.7 kB]
#6 15.34 Fetched 9220 kB in 15s (616 kB/s)
#6 15.34 Reading package lists...
#6 15.67 E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin || true'
#6 15.67 E: Sub-process returned an error code
------
Updating to Docker >= 20.10.9 fixed it
Reference:
https://stackoverflow.com/questions/71941032/why-i-cannot-run-apt-update-inside-a-fresh-ubuntu22-04
I had this error from cli,
facefusion-docker-facefusion-cuda-1 | [FACEFUSION.FRAME_PROCESSOR.FACE_ENHANCER] Download of the model is not done!
System: Windows 10
Docker Desktop 4.25.2 (129061).
Step 5/9 : RUN apt-get update
---> Running in 365a7a2b7863
Get:1 http://deb.debian.org/debian bookworm InRelease [151 kB]
Err:1 http://deb.debian.org/debian bookworm InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY 6ED0E7B82643E131 NO_PUBKEY F8D2585B8783D481
Get:2 http://deb.debian.org/debian bookworm-updates InRelease [52.1 kB]
Err:2 http://deb.debian.org/debian bookworm-updates InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY 6ED0E7B82643E131
Get:3 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Err:3 http://deb.debian.org/debian-security bookworm-security InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 54404762BBB6E853 NO_PUBKEY BDE6D2B9216EC7A8
Reading package lists...
W: GPG error: http://deb.debian.org/debian bookworm InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY 6ED0E7B82643E131 NO_PUBKEY F8D2585B8783D481
E: The repository 'http://deb.debian.org/debian bookworm InRelease' is not signed.
W: GPG error: http://deb.debian.org/debian bookworm-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY 6ED0E7B82643E131
E: The repository 'http://deb.debian.org/debian bookworm-updates InRelease' is not signed.
W: GPG error: http://deb.debian.org/debian-security bookworm-security InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 54404762BBB6E853 NO_PUBKEY BDE6D2B9216EC7A8
E: The repository 'http://deb.debian.org/debian-security bookworm-security InRelease' is not signed.
E: Problem executing scripts APT::Update::Post-Invoke 'rm -f /var/cache/apt/archives/.deb /var/cache/apt/archives/partial/.deb /var/cache/apt/*.bin || true'
E: Sub-process returned an error code
ERROR: Service 'facefusion-cpu' failed to build: The command '/bin/sh -c apt-get update' returned a non-zero code: 100
Hi guys,
I try the README instruction but failed to up the container
Run: docker-compose -f docker-compose.cpu.yml up
, get below errors:
2023-12-10 16:53:01 facefusion-docker-facefusion-cpu-1 | Traceback (most recent call last):
2023-12-10 16:53:01 facefusion-docker-facefusion-cpu-1 | File "/facefusion/run.py", line 3, in
2023-12-10 16:53:01 facefusion-docker-facefusion-cpu-1 | from facefusion import core
2023-12-10 16:53:01 facefusion-docker-facefusion-cpu-1 | File "/facefusion/facefusion/core.py", line 10, in
2023-12-10 16:53:01 facefusion-docker-facefusion-cpu-1 | import onnxruntime
2023-12-10 16:53:01 facefusion-docker-facefusion-cpu-1 | ModuleNotFoundError: No module named 'onnxruntime'
Docker version: 4.20.1 (110738)
OS: MacOS 14.1.2 (23B92)
CPU chip: Intel i9
[+] Running 2/2
⠿ Network facefusion-docker_default Created 0.1s
⠿ Container facefusion-docker-facefusion-cuda-1 Created 0.0s
Attaching to facefusion-docker-facefusion-cuda-1
Error response from daemon: could not select device driver "nvidia" with capabilities: [[gpu video]]
This is an error I encountered when building using docker-compose -f docker-compose.cuda.yml up
root@iZbp1ipx4pk8Z:/home/ecs-user/facefusion-docker# nvidia-smi
Fri Mar 29 16:46:51 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.161.07 Driver Version: 535.161.07 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA A10 On | 00000000:00:07.0 Off | 0 |
| 0% 27C P8 9W / 150W | 0MiB / 23028MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| No running processes found |
+---------------------------------------------------------------------------------------+
root@iZbp1ipx8Z:/home/ecs-user/facefusion-docker#
facefusion-docker-facefusion-cpu-1 | File "/facefusion/facefusion/face_analyser.py", line 116, in detect_with_retinaface
facefusion-docker-facefusion-cpu-1 | face_detector = get_face_analyser().get('face_detector')
facefusion-docker-facefusion-cpu-1 | File "/facefusion/facefusion/face_analyser.py", line 59, in get_face_analyser
facefusion-docker-facefusion-cpu-1 | face_detector = onnxruntime.InferenceSession(MODELS.get('face_detector_retinaface').get('path'), providers = facefusion.globals.execution_providers)
facefusion-docker-facefusion-cpu-1 | File "/usr/local/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 419, in init
facefusion-docker-facefusion-cpu-1 | self._create_inference_session(providers, provider_options, disabled_optimizers)
facefusion-docker-facefusion-cpu-1 | File "/usr/local/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 452, in _create_inference_session
facefusion-docker-facefusion-cpu-1 | sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
facefusion-docker-facefusion-cpu-1 | onnxruntime.capi.onnxruntime_pybind11_state.NoSuchFile: [ONNXRuntimeError] : 3 : NO_SUCHFILE : Load model from /facefusion/.assets/models/retinaface_10g.onnx failed:Load model /facefusion/.assets/models/retinaface_10g.onnx failed. File doesn't exist
Does this support oneapi or openvino of intel card just like A770?
win10, error:
=> ERROR [12/12] RUN cd /usr/local/lib/python3.10/dist-packages/torch/lib && ln -s l 0.3s
------
> [12/12] RUN cd /usr/local/lib/python3.10/dist-packages/torch/lib && ln -s libnvrtc-672ee683.so.11.2 libnvrtc.so:
#0 0.313 /bin/sh: 1: cd: can't cd to /usr/local/lib/python3.10/dist-packages/torch/lib
------
failed to solve: executor failed running [/bin/sh -c cd /usr/local/lib/python3.10/dist-packages/torch/lib && ln -s libnvrtc-672ee683.so.11.2 libnvrtc.so]: exit code: 2
I couldn't see an existing issue logged for this and you may already be aware of it, but in case you're not recent versions of FF (I think from 2.0) throw a lot of warnings in the console output from libprotobuf:
docker logs -f facefusion -n10
CUDA Version 11.8.0
Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
This container image and its contents are governed by the NVIDIA Deep Learning Container License.
By pulling and using the container, you accept the terms and conditions of this license:
https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
[libprotobuf WARNING google/protobuf/io/coded_stream.cc:604] Reading dangerously large protocol message. If the message turns out to be larger than 2147483647 bytes, parsing will be halted for security reasons. To increase the limit (or to disable these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
[libprotobuf WARNING google/protobuf/io/coded_stream.cc:81] The total number of bytes read was 553206116
[libprotobuf WARNING google/protobuf/io/coded_stream.cc:604] Reading dangerously large protocol message. If the message turns out to be larger than 2147483647 bytes, parsing will be halted for security reasons. To increase the limit (or to disable these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
[libprotobuf WARNING google/protobuf/io/coded_stream.cc:81] The total number of bytes read was 553206116
[libprotobuf WARNING google/protobuf/io/coded_stream.cc:604] Reading dangerously large protocol message. If the message turns out to be larger than 2147483647 bytes, parsing will be halted for security reasons. To increase the limit (or to disable these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
[libprotobuf WARNING google/protobuf/io/coded_stream.cc:81] The total number of bytes read was 553206705
facefusion-docker-facefusion-cuda-1 | Could not load library libcudnn_cnn_infer.so.8. Error: libnvrtc.so: cannot open shared object file: No such file or directory
facefusion-docker-facefusion-cuda-1 exited with code 139
[+] Running 1/0ion-docker>docker-compose -f docker-compose.cpu.yml up
✔ Container facefusion-docker-facefusion-cpu-1 Created 0.0s
Attaching to facefusion-docker-facefusion-cpu-1
facefusion-docker-facefusion-cpu-1 | Traceback (most recent call last):
facefusion-docker-facefusion-cpu-1 | File "/facefusion/run.py", line 3, in
facefusion-docker-facefusion-cpu-1 | from facefusion import core
facefusion-docker-facefusion-cpu-1 | File "/facefusion/facefusion/core.py", line 16, in
facefusion-docker-facefusion-cpu-1 | from facefusion.face_analyser import get_one_face, get_average_face
facefusion-docker-facefusion-cpu-1 | File "/facefusion/facefusion/face_analyser.py", line 3, in
facefusion-docker-facefusion-cpu-1 | import cv2
facefusion-docker-facefusion-cpu-1 | ModuleNotFoundError: No module named 'cv2'
facefusion-docker-facefusion-cpu-1 exited with code 1
Hello,
In the Dockerfile.cpu, you are missing the "RUN apt-get install python3-pip -y" command.
RUN apt-get update
RUN apt-get install curl -y
RUN apt-get install ffmpeg -y
RUN apt-get install python3-pip -y
[12/12] RUN cd /usr/local/lib/python3.10/dist-packages/torch/lib && ln -s libnvrtc-672ee683.so.11.2 libnvrtc.so:
0.116 /bin/sh: 1: cd: can't cd to /usr/local/lib/python3.10/dist-packages/torch/lib
ERROR: failed to solve: process "/bin/sh -c cd /usr/local/lib/python3.10/dist-packages/torch/lib && ln -s libnvrtc-672ee683.so.11.2 libnvrtc.so" did not complete successfully: exit code: 2
ERROR: Service 'facefusion-cuda' failed to build : Build failed
root@iZbp1g6u4mfoqizw32yg4wZ:~/facefusion-docker# docker-compose -f docker-compose.cuda.yml up
git clone https://github.com/facefusion/facefusion-docker.git
docker-compose -f docker-compose.cpu.yml up
ERROR: The Compose file './docker-compose.cpu.yml' is invalid because:
Unsupported config option for services: 'facefusion-cpu'
:/facefusion-docker$ **docker compose -f docker-compose.rocm.yml up -d** WARN[0000] Found orphan containers ([facefusion-docker-facefusion-cuda-1 facefusion-docker-facefusion-cpu-1]) for this project. If you removed or renamed this service in your compose file, you can run this command with the --remove-orphans flag to clean it up. [+] Running 0/1 ⠹ Container facefusion-docker-facefusion-rocm-1 Starting 0.2s Error response from daemon: could not select device driver "rocm" with capabilities: [[gpu video]]
Fri Apr 19 17:19:18 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.67 Driver Version: 550.67 CUDA Version: 12.4 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce RTX 2060 ... Off | 00000000:42:00.0 Off | N/A |
| 41% 36C P8 4W / 175W | 591MiB / 8192MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 379810 C python 588MiB |
+-----------------------------------------------------------------------------------------+
The correct command should be like below, without hifen "-":
docker compose -f docker-compose.cpu.yml up
I almost exclusively use CUDA with docker. On my dev workstation when using this repo CUDA isn't utilized even though it is detected as the execution provider:
Processing: 100%|██████████| 197/197 [01:04<00:00, 3.05frame/s, memory_usage=06.71GB, execution_providers=['CUDAExecutionProvider'], execution_thread_count=8, execution_queue_count=1]
When checking GPU status with nvidia-smi
I never see the model loaded to memory or executing there. nvenc doesn't appear to work either.
I hacked up my own variant with a Dockerfile FROM nvcr.io/nvidia/tensorflow:23.08-tf2-py3
and I'm able to see the model load in VRAM but it still doesn't execute there. In my variant I'm also able to use nvenc and verify via nvidia-smi
that is in actually being utilized.
Hardware is Nvidia RTX 4090.
Any thoughts? How can I help?
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.161.07 Driver Version: 535.161.07 CUDA Version: 12.2 |
|-----------------------------------------+----------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+======================+======================|
| 0 NVIDIA A10 On | 00000000:00:07.0 Off | 0 |
| 0% 50C P0 61W / 150W | 970MiB / 23028MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 33342 C python 962MiB |
+---------------------------------------------------------------------------------------+
CUDA Dockerfile is broken.
Downloading: 100%|██████████| 529M/529M [16:47<00:00, 330kB/s]
2023-10-12T14:55:40.727010349Z download_path: /root/.insightface/models/buffalo_l
2023-10-12T14:55:40.727026296Z Downloading /root/.insightface/models/buffalo_l.zip from https://github.com/deepinsight/insightface/releases/download/v0.7/buffalo_l.zip...
100%|██████████| 281857/2818572023-10-12T14:56:05.413723033Z [00:24<00:00, 11417.48KB/s]
2023-10-12T15:26:03.891534028Z Could not load library libcudnn_cnn_infer.so.8. Error: libnvrtc.so: cannot open shared object file: No such file or directory
This might solve it - add it to the end of Dockerfile.cuda:
RUN pip install torch --extra-index-url https://download.pytorch.org/whl/nightly/cu118
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.