diff --git a/README.md b/README.md index bfde164..589e012 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/requirements_3.9_arm64.txt b/requirements_3.9_arm64.txt index c63501c..90d1a51 100644 --- a/requirements_3.9_arm64.txt +++ b/requirements_3.9_arm64.txt @@ -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 diff --git a/scripts/0_setup.sh b/scripts/0_setup.sh index dea6d70..7c5df1f 100755 --- a/scripts/0_setup.sh +++ b/scripts/0_setup.sh @@ -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 diff --git a/scripts/2_extract_images_from_video_data_src.sh b/scripts/2_extract_images_from_video_data_src.sh index 77e7417..0bc8ed9 100755 --- a/scripts/2_extract_images_from_video_data_src.sh +++ b/scripts/2_extract_images_from_video_data_src.sh @@ -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" diff --git a/scripts/3_extract_images_from_video_data_dst.sh b/scripts/3_extract_images_from_video_data_dst.sh index a3f0d2e..7385918 100755 --- a/scripts/3_extract_images_from_video_data_dst.sh +++ b/scripts/3_extract_images_from_video_data_dst.sh @@ -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" diff --git a/scripts/4.1_data_src_extract_faces_MANUAL.sh b/scripts/4.1_data_src_extract_faces_MANUAL.sh index 60dc5c7..5e1ffa8 100755 --- a/scripts/4.1_data_src_extract_faces_MANUAL.sh +++ b/scripts/4.1_data_src_extract_faces_MANUAL.sh @@ -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 diff --git a/scripts/4.1_data_src_extract_faces_S3FD.sh b/scripts/4.1_data_src_extract_faces_S3FD.sh index 52226d8..0596803 100755 --- a/scripts/4.1_data_src_extract_faces_S3FD.sh +++ b/scripts/4.1_data_src_extract_faces_S3FD.sh @@ -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 diff --git a/scripts/4.2_data_src_sort.sh b/scripts/4.2_data_src_sort.sh index 62ca31b..effad83 100755 --- a/scripts/4.2_data_src_sort.sh +++ b/scripts/4.2_data_src_sort.sh @@ -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" diff --git a/scripts/5.1_data_dst_extract_faces_S3FD.sh b/scripts/5.1_data_dst_extract_faces_S3FD.sh index dff6592..0e1e2b0 100755 --- a/scripts/5.1_data_dst_extract_faces_S3FD.sh +++ b/scripts/5.1_data_dst_extract_faces_S3FD.sh @@ -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 diff --git a/scripts/6_train_Quick96.sh b/scripts/6_train_Quick96.sh index ca8e9c8..2fbd8a1 100755 --- a/scripts/6_train_Quick96.sh +++ b/scripts/6_train_Quick96.sh @@ -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" \ diff --git a/scripts/6_train_SAEHD.sh b/scripts/6_train_SAEHD.sh index 2be58f0..d315512 100755 --- a/scripts/6_train_SAEHD.sh +++ b/scripts/6_train_SAEHD.sh @@ -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" \ diff --git a/scripts/7_merge_Quick96.sh b/scripts/7_merge_Quick96.sh index f59aa53..e5266d7 100755 --- a/scripts/7_merge_Quick96.sh +++ b/scripts/7_merge_Quick96.sh @@ -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" \ diff --git a/scripts/7_merge_SAEHD.sh b/scripts/7_merge_SAEHD.sh index f7d91df..616aa57 100755 --- a/scripts/7_merge_SAEHD.sh +++ b/scripts/7_merge_SAEHD.sh @@ -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" \ diff --git a/scripts/8_merged_to_mp4.sh b/scripts/8_merged_to_mp4.sh index f048453..39eb81c 100755 --- a/scripts/8_merged_to_mp4.sh +++ b/scripts/8_merged_to_mp4.sh @@ -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.*" \ diff --git a/scripts/env.sh b/scripts/env.sh index e4d31d6..cdeb142 100644 --- a/scripts/env.sh +++ b/scripts/env.sh @@ -1,3 +1,4 @@ +DFL_PYTHON=/opt/homebrew/bin/python3.11 DFL_MAIN=.dfl/DeepFaceLab/main.py WORKSPACE=workspace diff --git a/scripts/xseg.sh b/scripts/xseg.sh index bc5b6a8..a576a5e 100755 --- a/scripts/xseg.sh +++ b/scripts/xseg.sh @@ -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"