Use custom model/lora download folder in model downloader

This commit is contained in:
Artificiangel 2024-04-29 07:21:09 -04:00
parent d64459e20d
commit 1b44204bd7
2 changed files with 2 additions and 6 deletions

View File

@ -22,6 +22,7 @@ import tqdm
from requests.adapters import HTTPAdapter from requests.adapters import HTTPAdapter
from requests.exceptions import ConnectionError, RequestException, Timeout from requests.exceptions import ConnectionError, RequestException, Timeout
from tqdm.contrib.concurrent import thread_map from tqdm.contrib.concurrent import thread_map
from modules import shared
base = os.environ.get("HF_ENDPOINT") or "https://huggingface.co" base = os.environ.get("HF_ENDPOINT") or "https://huggingface.co"
@ -165,7 +166,7 @@ class ModelDownloader:
return links, sha256, is_lora, is_llamacpp return links, sha256, is_lora, is_llamacpp
def get_output_folder(self, model, branch, is_lora, is_llamacpp=False): def get_output_folder(self, model, branch, is_lora, is_llamacpp=False):
base_folder = 'models' if not is_lora else 'loras' base_folder = shared.args.model_dir if not is_lora else shared.args.lora_dir
# If the model is of type GGUF, save directly in the base_folder # If the model is of type GGUF, save directly in the base_folder
if is_llamacpp: if is_llamacpp:

View File

@ -290,11 +290,6 @@ def download_model_wrapper(repo_id, specific_file, progress=gr.Progress(), retur
yield ("Getting the output folder") yield ("Getting the output folder")
output_folder = downloader.get_output_folder(model, branch, is_lora, is_llamacpp=is_llamacpp) output_folder = downloader.get_output_folder(model, branch, is_lora, is_llamacpp=is_llamacpp)
if output_folder == Path("models"):
output_folder = Path(shared.args.model_dir)
elif output_folder == Path("loras"):
output_folder = Path(shared.args.lora_dir)
if check: if check:
progress(0.5) progress(0.5)