From 2f455aaca55c0a044735c768b295d077b2f5b8d6 Mon Sep 17 00:00:00 2001 From: melMass Date: Thu, 6 Jul 2023 20:24:05 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=94=A5=20much=20faster=20(using=20?= =?UTF-8?q?GPU)=20on=20windows?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Linux should already work fine --- nodes/image_interpolation.py | 10 ++++++++++ requirements.txt | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/nodes/image_interpolation.py b/nodes/image_interpolation.py index bb49579..f222ad0 100644 --- a/nodes/image_interpolation.py +++ b/nodes/image_interpolation.py @@ -12,6 +12,8 @@ import numpy as np import subprocess import comfy +import tensorflow as tf + class LoadFilmModel: """Loads a FILM model""" @@ -79,6 +81,14 @@ class FilmInterpolation: film_model: interpolator.Interpolator, ): n = images.size(0) + # check if tensorflow GPU is available + available_gpus = tf.config.list_physical_devices("GPU") + if not len(available_gpus): + log.warning( + "Tensorflow GPU not available, falling back to CPU this will be very slow" + ) + else: + log.debug(f"Tensorflow GPU available, using {available_gpus}") num_frames = (n - 1) * (2 ** (interpolate) - 1) log.debug(f"Will interpolate into {num_frames} frames") diff --git a/requirements.txt b/requirements.txt index f56dd43..73a03dc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,4 +8,9 @@ mmcv==2.0.0 mmdet==3.0.0 rembg==2.0.37 facexlib==0.3.0 -basicsr==1.4.2 \ No newline at end of file +basicsr==1.4.2 +# on windows non WSL 2.10 is the last version with GPU support +tensorflow==2.10.0; platform_system == "Windows" +tensorflow; platform_system != "Windows" +# the old tf version on windows comes with a breaking protobuf version +protobuf==3.20.2; platform_system == "Windows" \ No newline at end of file