Using DirectML with ESRGAN
Using DirectML with ESRGAN
This tutorial is a work in progress and only applies to Joey's fork as of now
To begin, you need to follow the steps here: https://docs.microsoft.com/en-us/windows/ai/directml/gpu-pytorch-windows (Tip: to 'start an interactive Python session' just type "python" (without the "" and hit enter)
Installing Prerequisites
You'll first need Joey's ESRGAN fork: https://github.com/JoeyBallentine/ESRGAN
You'll need to install the packages that Joey's ESRGAN fork requires. Enter these commands:
pip install opencv_python numpy torch rich typer torchaudio==0.8.0
If you want to use victorca25's traiNNer/iNNfer (this is not verified working) you further need:
pip install scenedetect decord imageio skimage scikit-image
pip install PyYAML numpy opencv-python tensorboardX
Setting up ESRGAN
| These steps will become irrelevant when Joey implements native DirectML support. Date of addition: 10.30.2021 |
| Follow this tutorial for more information: https://upscale.wiki/wiki/Joey's_ESRGAN_Tutorial |
In the root ESRGAN folder, you need to change one line in upscale.py with Notepad or your editor of choice:
self.device = torch.device("cpu" if self.cpu else f"cuda:{device_id}")
change this line to
self.device = torch.device("cpu" if self.cpu else f"dml")
You are now done with the installation and setup
To start ESRGAN, open Anaconda or your Python prompt, change the directory to your ESRGAN folder, and start upscaling!