@echo off

git clone https://github.com/williamyang1991/Rerender_A_Video

cd Rerender_A_Video

cd deps

git clone https://github.com/lllyasviel/ControlNet

git clone https://github.com/SingleZombie/ebsynth

git clone https://github.com/haofeixu/gmflow

cd ..
cd ..

REM Move install2.py into the Rerender_A_Video folder
move /Y install2.py Rerender_A_Video

REM Try to move ebsynth.exe and ebsynth.dll into the Rerender_A_Video\deps\ebsynth\bin folder
IF EXIST ebsynth.exe (
    move /Y ebsynth.exe Rerender_A_Video\deps\ebsynth\bin
) ELSE (
    echo ebsynth.exe not found. You need to compile your own ebsynth exe.
)
IF EXIST ebsynth.dll (
    move /Y ebsynth.dll Rerender_A_Video\deps\ebsynth\bin
) ELSE (
    echo ebsynth.dll not found. You need to compile your own ebsynth exe.
)

REM Move sd_model_cfg.py into the Rerender_A_Video folder
move /Y sd_model_cfg.py Rerender_A_Video

cd Rerender_A_Video

REM Create virtual environment folder
echo composing venv
IF NOT EXIST venv (
    python -m venv venv
) ELSE (
    echo venv folder already exists, skipping making new venv...
)
call .\venv\Scripts\activate.bat

echo installing requirements 
pip install -r requirements.txt

pip uninstall --yes torch torchvision torchaudio

python install2.py

pip3 install torch==2.1.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121

pip install xformers==0.0.22.post7

pip uninstall --yes gradio

pip install gradio==3.44.3

pip uninstall keras-nightly

pip install https://github.com/woct0rdho/triton-windows/releases/download/v3.1.0-windows.post5/triton-3.1.0-cp310-cp310-win_amd64.whl --upgrade

REM Show completion message
echo Virtual environment made and installed properly

REM Pause to keep the command prompt open
pause