From d516815c9cd0baf7a450ee1edaa4fd4f4bd93fb2 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 5 Dec 2023 21:09:12 -0800 Subject: [PATCH] Model downloader: download only fp16 if both fp16 and GGUF are present --- download-model.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/download-model.py b/download-model.py index f8be9862..b9779a4f 100644 --- a/download-model.py +++ b/download-model.py @@ -127,10 +127,23 @@ class ModelDownloader: if classifications[i] in ['pytorch', 'pt']: links.pop(i) + # For GGUF, try to download only the Q4_K_M if no specific file is specified. + # If not present, exclude all GGUFs, as that's like a repository with both + # GGUF and fp16 files. if has_gguf and specific_file is None: + has_q4km = False for i in range(len(classifications) - 1, -1, -1): - if 'q4_k_m' not in links[i].lower(): - links.pop(i) + if 'q4_k_m' in links[i].lower(): + has_q4km = True + + if has_q4km: + for i in range(len(classifications) - 1, -1, -1): + if 'q4_k_m' in links[i].lower(): + links.pop(i) + else: + for i in range(len(classifications) - 1, -1, -1): + if links[i].lower().endswith('.gguf'): + links.pop(i) is_llamacpp = has_gguf and specific_file is not None return links, sha256, is_lora, is_llamacpp