Example Windows 11 Install Steps April 20, 2024 - jhogsett/EMA-VFI-WebUI GitHub Wiki
Pre-requisites
- install git for windows (to get code from the GitHub repos) https://git-scm.com/download/win
- install anaconda for windows (to run Python) https://www.anaconda.com/download
Set Up Anaconda Environment
- open an anaconda console window (via Windows start menu)
- Anaconda3 -> Anaconda Prompt (anaconda3)
- create a new directory for the app, and change into it
(base) C:\>
(base) C:\>md conda
(base) C:\>cd conda
(base) C:\conda>md EMA-VFI-WebUI
(base) C:\conda>cd EMA-VFI-WebUI
- create a new anaconda environment
(base) C:\conda\EMA-VFI-WebUI>conda create --name EMA-VFI-WebUI python=3.10.9
- activate the new environment
(base) C:\conda\EMA-VFI-WebUI>conda activate EMA-VFI-WebUI
Set Up the EMA-VFI Engine
- clone the EMA-VFI engine
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI>git clone https://github.com/MCG-NJU/EMA-VFI.git
- change into the newly cloned directory
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI>cd EMA-VFI
- create a directory for the model checkpoints
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI>md ckpt
- download the model checkpoints
- Go to Google Drive at https://drive.google.com/drive/folders/16jUa3HkQ85Z5lb5gce1yoaWkP-rdCd0o?usp=sharing
- download these files and place into the
C:\conda\EMA-VFI-WebUI\EMA-VFI\ckpt
directory- ours.pkl (251.5MB)
- ours_t.pkl (251.5MB)
Install NVIDIA Cuda if necessary
- Determine if cuda is installed and find cuda version:
- version 12.4 or later is recommended
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Mar_28_02:30:10_Pacific_Daylight_Time_2024
Cuda compilation tools, release 12.4, V12.4.131
Build cuda_12.4.r12.4/compiler.34097967_0
- If not installed, or version is < 12.4
- Go to https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64&target_version=11&target_type=exe_local
- Double-check the particular installer you need, for instance your Windows version may differ
Install EMA-VFI depenencies (updated somewhat from their recommended versions)
- Install Torch 2.2.0
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI>conda install pytorch==2.2.0 torchvision==0.17.0 torchaudio==2.2.0 pytorch-cuda=12.1 -c pytorch -c nvidia
- Install scikit-image (latest 0.22.0)
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI>conda install scikit-image
- Install numpy (latest 1.26.4)
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI>conda install numpy
- Install opencv-python (latest 4.9.0.80)
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI>pip install opencv-python
- Install timm (latest 0.9.16)
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI>pip install timm
- Install tqdm (latest 4.66.2)
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI>conda install tqdm
- Install imageio (downgrade to 2.24.0 due to use of deprecated kwargs)
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI>pip install imageio==2.24.0
Check the EMA-VFI Engine installation by running an inference:
- Run the basic (non-time-based) demo:
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI>python demo_2x.py
- If it worked, there will be a new file out_2x.gif in this directory:
C:\conda\EMA-VFI-WebUI\EMA-VFI\example
- Open it to confirm it created an animated gif of a toy train
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI\example>start out_2x.gif
Install Real-ESRGAN
- Go back to the application root directory
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI\example>cd c:\conda\EMA-VFI-WebUI
- Clone the repo
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI>git clone https://github.com/xinntao/Real-ESRGAN.git
- change into the newly cloned directory
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI>cd Real-ESRGAN
- install the dependencies
(EMA-VFI-WebUI) c:\conda\EMA-VFI-WebUI\Real-ESRGAN>pip install basicsr
(EMA-VFI-WebUI) c:\conda\EMA-VFI-WebUI\Real-ESRGAN>pip install facexlib
(EMA-VFI-WebUI) c:\conda\EMA-VFI-WebUI\Real-ESRGAN>pip install gfpgan
(EMA-VFI-WebUI) c:\conda\EMA-VFI-WebUI\Real-ESRGAN>pip install -r requirements.txt
(EMA-VFI-WebUI) c:\conda\EMA-VFI-WebUI\Real-ESRGAN>python setup.py develop
IMPORTANT You may need to patch basicsr due to a changed dependent module name
If you see this error when running the application:
ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'
Do the following:
- Edit the file
degradations.py
, located for example inC:\Users\USER\.conda\envs\avr\lib\site-packages\basicsr\data\degradations.py
- Change the line
from torchvision.transforms.functional_tensor import rgb_to_grayscale
tofrom torchvision.transforms.functional import rgb_to_grayscale
(See: https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/13985)
- NOTE: Real-ESRGAN will download the 4x+ model on first use
Set Up EMA-VFI WebUI
- Go back to the application root directory
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI\example>cd c:\conda\EMA-VFI-WebUI
- clone the EMA-VFI WebUI application
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI>git clone https://github.com/jhogsett/EMA-VFI-WebUI.git
- change into the newly cloned directory
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI>cd EMA-VFI-WebUI
- install the dependencies
(EMA-VFI-WebUI) c:\conda\EMA-VFI-WebUI\EMA-VFI-WebUI>pip install -r requirements.txt
Merge EMA-VFI and Real-ESRGAN components into WebUI Application
- Copy the following directories and files from:
C:\conda\EMA-VFI-WebUI\EMA-VFI
to:C:\conda\EMA-VFI-WebUI\EMA-VFI-WebUI
- directories: benchmark, ckpt, model
- files: config.py, dataset.py, Trainer.py
- Copy the following directories and files from:
C:\conda\EMA-VFI-WebUI\Real-ESRGAN
to:C:\conda\EMA-VFI-WebUI\EMA-VFI-WebUI
- directory: realesrgan
Install FFmpeg
- see https://ffmpeg.org/download.html#build-windows
- I use the Windows builds at https://www.gyan.dev/ffmpeg/builds/
Start EMA-VFI WebUI Application
- change to the application repo directory
cd C:\conda\EMA-VFI-WebUI\EMA-VFI-WebUI
- start the application
(EMA-VFI-WebUI) c:\conda\EMA-VFI-WebUI\EMA-VFI-WebUI>webui.bat
Testing an Interpolation
- test files are location in
c:\conda\EMA-VFI-WebUI\EMA-VFI-WebUI\images
- on the Interplolate Frames/Interpolate Frames tab
- drag
image0.png
from the images directory to the "before image" panel - drag
image2.png
to the "after image" panel
- drag
- click Interpolate
- after a short delay, the Animated Preview panel should show a 3-frame animated GIF
Running EMA-VFI WebUI the next time
- open an anaconda console window (via Windows start menu)
- Anaconda3 -> Anaconda Prompt (anaconda3)
- activate the environment created before
(base) C:\conda\EMA-VFI-WebUI>conda activate EMA-VFI-WebUI
- change to the application repo directory
cd C:\conda\EMA-VFI-WebUI\EMA-VFI-WebUI
- start the application
(EMA-VFI-WebUI) c:\conda\EMA-VFI-WebUI\EMA-VFI-WebUI>webui.bat