updated to work for m1 Mac #131

Closed
ngardelis wants to merge 24 commits from master into master
16 changed files with 42 additions and 17 deletions
+25 -2
View File
@@ -6,7 +6,22 @@ You'll need `git`, `ffmpeg`, `python3` and python module `virtualenv` available
## NOTE: Apple M1 chip
Currently there's limited support for Apple M1 laptops. You can do model training, but the XSeg editor currently does not work (the DeepFaceLab codebase is not compatible with PyQt6).
Currently there's limited support for Apple M1 laptops. You can do model training, but the XSeg editor currently does not work (the DeepFaceLab codebase is not compatible with PyQt6). Although this repo also uses PySide6 from https://github.com/iperov/DeepFaceLab
## NOTE: FULL RUN M1
```
cd scripts
./2_extract_images_from_video_data_src.sh
./3_extract_images_from_video_data_dst.sh
./4.1_data_src_extract_faces_S3FD.sh <<< on GPU
./5_data_dst_extract_faces_S3FD_best_GPU.sh <<< on GPU
./6_train_SAEHD.sh <<< on GPU
./7_merge_SAEHD.sh <<< on CPU
./8_merged_to_mp4.sh
```
## Setup
@@ -23,9 +38,17 @@ Check if you have it with `brew ls --versions hdf5`. Install it with `brew insta
**Clone and setup**
1. Clone this repository (`git clone https://github.com/chychkan/DeepFaceLab_MacOS.git`)
1. Clone this repository (`git clone https://github.com/ngardelis/MacOS.git`)
2. Run script `./scripts/0_setup.sh` to get [DeepFaceLab](https://github.com/iperov/DeepFaceLab), create virtual env and install necessary Python dependencies. This may take several minutes to run.
**Temporary bug and workaround**
At this point, you may run into different problems. It appears there is a bug in the latest update to protobuf. To get around this, force a downgrade in your Python environment:
- Run: source .dfl/env/bin/activate
- Run: pip3.9 install 'protobuf~=3.19.0'
- Run: deactivate
Now you can put your `data_src.mp4` and `data_dst.mp4` files into the `workspace/` dir and start running scripts from the `scripts/` dir.
## Tutorials and docs
+2 -1
View File
@@ -10,4 +10,5 @@ Pillow==8.4.0
scikit-image==0.19.1
scipy==1.8.0
tensorflow-macos==2.7.0
PyQt6==6.2.3
tensorflow-metal==0.3.0
PySide6==6.2.2
+2 -2
View File
@@ -14,7 +14,7 @@ is_arm64 && echo "Running on Apple M1 chip"
if [ ! -d .dfl/DeepFaceLab ]; then
echo "Cloning DeepFaceLab"
git clone --no-single-branch --depth 1 "https://github.com/chychkan/DeepFaceLab.git" .dfl/DeepFaceLab
git clone --no-single-branch --depth 1 "https://github.com/jkennedyvz/DeepFaceLab.git" .dfl/DeepFaceLab
if is_arm64; then
(cd .dfl/DeepFaceLab; git checkout support-arm64)
@@ -22,7 +22,7 @@ if [ ! -d .dfl/DeepFaceLab ]; then
fi
if [ ! -d .dfl/env ]; then
virtualenv -p python3 .dfl/env
virtualenv -p python3.9 .dfl/env
fi
source .dfl/env/bin/activate
@@ -2,6 +2,6 @@
cd "$(dirname $0)/.."
source scripts/env.sh
python "$DFL_MAIN" videoed extract-video \
python3.9 "$DFL_MAIN" videoed extract-video \
--input-file "$WORKSPACE/data_src.*" \
--output-dir "$WORKSPACE/data_src"
@@ -2,6 +2,6 @@
cd "$(dirname $0)/.."
source scripts/env.sh
python "$DFL_MAIN" videoed extract-video \
python3.9 "$DFL_MAIN" videoed extract-video \
--input-file "$WORKSPACE/data_dst.*" \
--output-dir "$WORKSPACE/data_dst"
+1 -1
View File
@@ -2,7 +2,7 @@
cd "$(dirname $0)/.."
source scripts/env.sh
python "$DFL_MAIN" extract \
python3.9 "$DFL_MAIN" extract \
--input-dir "$WORKSPACE/data_src" \
--output-dir "$WORKSPACE/data_src/aligned" \
--detector manual
+1 -1
View File
@@ -2,7 +2,7 @@
cd "$(dirname $0)/.."
source scripts/env.sh
python "$DFL_MAIN" extract \
python3.9 "$DFL_MAIN" extract \
--input-dir "$WORKSPACE/data_src" \
--output-dir "$WORKSPACE/data_src/aligned" \
--detector s3fd
+1 -1
View File
@@ -2,5 +2,5 @@
cd "$(dirname $0)/.."
source scripts/env.sh
python "$DFL_MAIN" sort \
python3.9 "$DFL_MAIN" sort \
--input-dir "$WORKSPACE/data_src/aligned"
+1 -1
View File
@@ -2,7 +2,7 @@
cd "$(dirname $0)/.."
source scripts/env.sh
python "$DFL_MAIN" extract \
python3.9 "$DFL_MAIN" extract \
--input-dir "$WORKSPACE/data_dst" \
--output-dir "$WORKSPACE/data_dst/aligned" \
--detector s3fd
+1 -1
View File
@@ -2,7 +2,7 @@
cd "$(dirname $0)/.."
source scripts/env.sh
python "$DFL_MAIN" train \
python3.9 "$DFL_MAIN" train \
--training-data-src-dir "$WORKSPACE/data_src/aligned" \
--training-data-dst-dir "$WORKSPACE/data_dst/aligned" \
--model-dir "$WORKSPACE/model" \
+1 -1
View File
@@ -2,7 +2,7 @@
cd "$(dirname $0)/.."
source scripts/env.sh
python "$DFL_MAIN" train \
python3.9 "$DFL_MAIN" train \
--training-data-src-dir "$WORKSPACE/data_src/aligned" \
--training-data-dst-dir "$WORKSPACE/data_dst/aligned" \
--model-dir "$WORKSPACE/model" \
+1 -1
View File
@@ -2,7 +2,7 @@
cd "$(dirname $0)/.."
source scripts/env.sh
python "$DFL_MAIN" merge \
python3.9 "$DFL_MAIN" merge \
--input-dir "$WORKSPACE/data_dst" \
--output-dir "$WORKSPACE/data_dst/merged" \
--output-mask-dir "$WORKSPACE/data_dst/merged_mask" \
+1 -1
View File
@@ -2,7 +2,7 @@
cd "$(dirname $0)/.."
source scripts/env.sh
python "$DFL_MAIN" merge \
python3.9 "$DFL_MAIN" merge \
--input-dir "$WORKSPACE/data_dst" \
--output-dir "$WORKSPACE/data_dst/merged" \
--output-mask-dir "$WORKSPACE/data_dst/merged_mask" \
+1 -1
View File
@@ -2,7 +2,7 @@
cd "$(dirname $0)/.."
source scripts/env.sh
python "$DFL_MAIN" videoed video-from-sequence \
python3.9 "$DFL_MAIN" videoed video-from-sequence \
--input-dir "$WORKSPACE/data_dst/merged" \
--output-file "$WORKSPACE/result.mp4" \
--reference-file "$WORKSPACE/data_dst.*" \
+1
View File
@@ -1,3 +1,4 @@
DFL_PYTHON=/opt/homebrew/bin/python3.11
DFL_MAIN=.dfl/DeepFaceLab/main.py
WORKSPACE=workspace
+1 -1
View File
@@ -2,5 +2,5 @@
cd "$(dirname $0)/.."
source scripts/env.sh
python "$DFL_MAIN" xseg editor \
python3.9 "$DFL_MAIN" xseg editor \
--input-dir "$WORKSPACE/data_src/aligned"