Files
Ai-Swaper/setup.bat
TutorialsGHG 1cad87752c new version
2026-05-11 21:04:04 +02:00

50 lines
3.2 KiB
Batchfile

@echo off
echo ============================================================
echo FaceSwap Clean Setup
echo ============================================================
echo.
echo Schritt 1: Alte inkompatible Pakete entfernen...
py -3.12 -m pip uninstall -y numpy opencv-python opencv-python-headless opencv-contrib-python insightface onnx onnxruntime onnxruntime-gpu scipy scikit-learn scikit-image tifffile albumentations albucore coqui-tts TTS torch torchaudio nvidia-cublas-cu12 nvidia-cuda-runtime-cu12 nvidia-cuda-nvrtc-cu12 nvidia-cudnn-cu12 nvidia-cufft-cu12 nvidia-nvjitlink-cu12 2>nul
echo.
echo Schritt 2: numpy 1.x zuerst installieren (KEIN auto-upgrade)...
py -3.12 -m pip install "numpy>=1.24,<2.0" --force-reinstall --no-deps
echo.
echo Schritt 3: opencv installieren (ohne numpy-Abhaengigkeit)...
py -3.12 -m pip install "opencv-python==4.8.1.78" --no-deps --force-reinstall
echo.
echo Schritt 4: tifffile kompatible Version (ohne numpy-Abhaengigkeit)...
py -3.12 -m pip install "tifffile==2023.7.10" --no-deps --force-reinstall
echo.
echo Schritt 5: Weitere Pakete installieren...
py -3.12 -m pip install "onnx==1.16.2" "protobuf" "ml_dtypes"
py -3.12 -m pip install "scipy" "scikit-learn" "scikit-image" "tqdm" "requests" "Pillow" "easydict" "prettytable" "matplotlib"
py -3.12 -m pip install "qudida==0.0.4" --no-deps --force-reinstall
py -3.12 -m pip install "albumentations==1.3.1" --no-deps --force-reinstall
py -3.12 -m pip install "coqui-tts" "torch" "torchaudio"
echo.
echo Schritt 5b: Optional GFPGAN installieren...
py -3.12 -m pip install "gfpgan"
if errorlevel 1 (
echo WARNUNG: gfpgan konnte nicht installiert werden - Funktion bleibt optional deaktiviert.
)
echo.
echo Schritt 6: insightface Wheel installieren...
py -3.12 -m pip install "https://github.com/Gourieff/Assets/raw/main/Insightface/insightface-0.7.3-cp312-cp312-win_amd64.whl" --no-deps
echo.
echo Schritt 7: onnxruntime-gpu + CUDA Runtime installieren...
py -3.12 -m pip install "onnxruntime-gpu[cuda,cudnn]" "nvidia-cufft-cu12"
echo.
echo Schritt 8: numpy sichern (falls onnxruntime es hochgezogen hat)...
py -3.12 -m pip install "numpy>=1.24,<2.0" --force-reinstall --no-deps
echo.
echo Schritt 9: Abschlusspruefung...
py -3.12 -c "import cv2, numpy, insightface, onnx, onnxruntime as ort, albumentations, torch, tempfile; from onnx import helper, TensorProto; ort.preload_dlls(directory=''); X=helper.make_tensor_value_info('X', TensorProto.FLOAT, [1]); Y=helper.make_tensor_value_info('Y', TensorProto.FLOAT, [1]); node=helper.make_node('Identity', ['X'], ['Y']); graph=helper.make_graph([node], 'gpu_probe', [X], [Y]); model=helper.make_model(graph, opset_imports=[helper.make_opsetid('', 13)]); p=tempfile.NamedTemporaryFile(delete=False, suffix='.onnx').name; onnx.save(model, p); sess=ort.InferenceSession(p, providers=['CUDAExecutionProvider','CPUExecutionProvider']); print(' Alle Pakete OK - numpy', numpy.__version__, '| torch', torch.__version__, '| ORT', sess.get_providers()[0])"
echo.
echo Schritt 10: Setup-Flag loeschen...
del /f "%~dp0.setup_done" 2>nul
echo.
echo ============================================================
echo Fertig! Starte jetzt: py -3.12 face_swap.py
echo ============================================================
pause