From 21e29534200466f426c12f16b0deb18e92646de3 Mon Sep 17 00:00:00 2001 From: henryruhs Date: Sat, 3 Jun 2023 13:43:56 +0200 Subject: [PATCH] Double GPU performance --- roop/core.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roop/core.py b/roop/core.py index 50ad051..cfb9813 100644 --- a/roop/core.py +++ b/roop/core.py @@ -1,11 +1,12 @@ #!/usr/bin/env python3 import os -# reducing num threads doubles performance of gpu-mode -os.environ['OMP_NUM_THREADS'] = '1' +import sys +# single thread doubles performance of gpu-mode - needs to be set before torch import +if any(arg.startswith('--gpu-vendor=') for arg in sys.argv): + os.environ['OMP_NUM_THREADS'] = '1' import platform import signal -import sys import shutil import glob import argparse