Example Windows 11 Install Steps April 20, 2024 - jhogsett/EMA-VFI-WebUI GitHub Wiki

Pre-requisites

Set Up Anaconda Environment

  1. open an anaconda console window (via Windows start menu)
    • Anaconda3 -> Anaconda Prompt (anaconda3)
  2. 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
  1. create a new anaconda environment
(base) C:\conda\EMA-VFI-WebUI>conda create --name EMA-VFI-WebUI python=3.10.9
  1. activate the new environment
(base) C:\conda\EMA-VFI-WebUI>conda activate EMA-VFI-WebUI

Set Up the EMA-VFI Engine

  1. clone the EMA-VFI engine
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI>git clone https://github.com/MCG-NJU/EMA-VFI.git
  1. change into the newly cloned directory
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI>cd EMA-VFI
  1. create a directory for the model checkpoints
(EMA-VFI-WebUI) C:\conda\EMA-VFI-WebUI\EMA-VFI>md ckpt
  1. download the model checkpoints

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

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:

  1. Edit the file degradations.py, located for example in C:\Users\USER\.conda\envs\avr\lib\site-packages\basicsr\data\degradations.py
  2. Change the line from torchvision.transforms.functional_tensor import rgb_to_grayscale to from 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

Start EMA-VFI WebUI Application

  1. change to the application repo directory
cd C:\conda\EMA-VFI-WebUI\EMA-VFI-WebUI
  1. start the application
(EMA-VFI-WebUI) c:\conda\EMA-VFI-WebUI\EMA-VFI-WebUI>webui.bat

Testing an Interpolation

  1. test files are location in c:\conda\EMA-VFI-WebUI\EMA-VFI-WebUI\images
  2. 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
  3. click Interpolate
  4. after a short delay, the Animated Preview panel should show a 3-frame animated GIF

Running EMA-VFI WebUI the next time

  1. open an anaconda console window (via Windows start menu)
    • Anaconda3 -> Anaconda Prompt (anaconda3)
  2. activate the environment created before
(base) C:\conda\EMA-VFI-WebUI>conda activate EMA-VFI-WebUI
  1. change to the application repo directory
cd C:\conda\EMA-VFI-WebUI\EMA-VFI-WebUI
  1. start the application
(EMA-VFI-WebUI) c:\conda\EMA-VFI-WebUI\EMA-VFI-WebUI>webui.bat