From 30298b9ca31afe94b8743dfb22faa707eda2ba89 Mon Sep 17 00:00:00 2001 From: mrq Date: Thu, 16 Feb 2023 21:36:49 +0000 Subject: [PATCH] fixing brain worms --- main.py | 9 +++++++++ tortoise/api.py | 8 +------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 8ce0146..cefa8e3 100755 --- a/main.py +++ b/main.py @@ -1,5 +1,14 @@ import webui as mrq +if 'XDG_CACHE_HOME' not in os.environ: + os.environ['XDG_CACHE_HOME'] = os.path.realpath('./models/') + +if 'TORTOISE_MODELS_DIR' not in os.environ: + os.environ['TORTOISE_MODELS_DIR'] = os.path.realpath('./models/tortoise/') + +if 'TRANSFORMERS_CACHE' not in os.environ: + os.environ['TRANSFORMERS_CACHE'] = os.path.realpath('./models/transformers/') + if __name__ == "__main__": mrq.args = mrq.setup_args() diff --git a/tortoise/api.py b/tortoise/api.py index 7ca0a74..cc006a9 100755 --- a/tortoise/api.py +++ b/tortoise/api.py @@ -6,12 +6,6 @@ import gc from time import time from urllib import request -if 'TORTOISE_MODELS_DIR' not in os.environ: - os.environ['TORTOISE_MODELS_DIR'] = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/tortoise/') - -if 'TRANSFORMERS_CACHE' not in os.environ: - os.environ['TRANSFORMERS_CACHE'] = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../models/transformers/') - import torch import torch.nn.functional as F import progressbar @@ -38,7 +32,7 @@ pbar = None STOP_SIGNAL = False -MODELS_DIR = os.environ.get('TORTOISE_MODELS_DIR') +MODELS_DIR = os.environ.get('TORTOISE_MODELS_DIR', os.path.realpath('./models/tortoise/')) MODELS = { 'autoregressive.pth': 'https://huggingface.co/jbetker/tortoise-tts-v2/resolve/main/.models/autoregressive.pth', 'classifier.pth': 'https://huggingface.co/jbetker/tortoise-tts-v2/resolve/main/.models/classifier.pth',