Add support for Apple M1 laptops (#71)
* Add support for Apple M1 laptops * Pre-install numpy * Use forked DeepFaceLab with minor fixes * Use --no-single-branch when cloning DFL * Minor improvements * Minor fixes to 0_setup.sh * Update versions * Update README Co-authored-by: Oleksandr Chychkan <chychkan@gmail.com>
This commit was merged in pull request #71.
This commit is contained in:
+42
-3
@@ -6,9 +6,19 @@ set -e
|
||||
mkdir -p .dfl
|
||||
mkdir -p workspace
|
||||
|
||||
is_arm64() {
|
||||
[ "$(uname -m)" == "arm64" ]
|
||||
}
|
||||
|
||||
is_arm64 && echo "Running on Apple M1 chip"
|
||||
|
||||
if [ ! -d .dfl/DeepFaceLab ]; then
|
||||
echo "Cloning DeepFaceLab"
|
||||
git clone --depth 1 "https://github.com/iperov/DeepFaceLab.git" .dfl/DeepFaceLab
|
||||
git clone --no-single-branch --depth 1 "https://github.com/chychkan/DeepFaceLab.git" .dfl/DeepFaceLab
|
||||
|
||||
if is_arm64; then
|
||||
(cd .dfl/DeepFaceLab; git checkout support-arm64)
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d .dfl/env ]; then
|
||||
@@ -17,14 +27,43 @@ fi
|
||||
|
||||
source .dfl/env/bin/activate
|
||||
|
||||
python -m pip install --upgrade pip
|
||||
|
||||
version=$(python -V | cut -f 2 -d ' ' | cut -f 1,2 -d .)
|
||||
reqs_file='requirements.txt'
|
||||
|
||||
version_suffix=''
|
||||
if [[ ! -z "$version" && -f "requirements_$version.txt" ]]; then
|
||||
reqs_file="requirements_$version.txt"
|
||||
version_suffix="_$version"
|
||||
fi
|
||||
|
||||
architecture_suffix=''
|
||||
if is_arm64 && [ -f "requirements${version_suffix}_arm64.txt" ]; then
|
||||
architecture_suffix="_arm64"
|
||||
fi
|
||||
|
||||
reqs_file="requirements${version_suffix}${architecture_suffix}.txt"
|
||||
|
||||
echo "Using $reqs_file for $(python -V)"
|
||||
pip install -r $reqs_file
|
||||
|
||||
if is_arm64; then
|
||||
if [[ -z "$(brew ls --versions hdf5)" ]]; then
|
||||
echo "ERROR: HDF5 needs to be installed to run DeepFaceLab on M1 chip."
|
||||
echo "You can install it with 'brew install hdf5'. For more details, see https://formulae.brew.sh/formula/hdf5"
|
||||
echo "Once it is installed, run ./scripts/0_setup.sh again"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cython_pkg="$(cat $reqs_file | grep -E 'cython==.+')"
|
||||
pip --no-cache-dir install "$cython_pkg"
|
||||
|
||||
numpy_pkg="$(cat $reqs_file | grep -E 'numpy==.+')"
|
||||
pip install "$numpy_pkg"
|
||||
|
||||
h5py_pkg="$(cat $reqs_file | grep -E 'h5py==.+')"
|
||||
HDF5_DIR="$(brew --prefix hdf5)" pip --no-cache-dir install --no-build-isolation "$h5py_pkg"
|
||||
fi
|
||||
|
||||
pip --no-cache-dir install -r $reqs_file
|
||||
|
||||
echo "Done."
|
||||
|
||||
Reference in New Issue
Block a user