Spaces:
Sleeping
Sleeping
Commit ·
5991e70
1
Parent(s): d9130fa
uploaded models
Browse files- gguf_engine.py +16 -8
- requirements.txt +2 -1
gguf_engine.py
CHANGED
|
@@ -17,20 +17,28 @@ from llama_cpp.llama_chat_format import Llava15ChatHandler
|
|
| 17 |
# PATHS — update these to match your setup
|
| 18 |
# ==========================================
|
| 19 |
import os
|
| 20 |
-
|
| 21 |
-
BASE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "gguf_models")
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
VISION_MMPROJ_PATHS = {
|
| 26 |
-
"module3":
|
| 27 |
-
"base":
|
| 28 |
}
|
| 29 |
|
| 30 |
LLM_LORA_PATHS = {
|
| 31 |
-
"module2":
|
| 32 |
-
"module3":
|
| 33 |
-
"module4":
|
| 34 |
"default": None,
|
| 35 |
}
|
| 36 |
|
|
|
|
| 17 |
# PATHS — update these to match your setup
|
| 18 |
# ==========================================
|
| 19 |
import os
|
| 20 |
+
from huggingface_hub import hf_hub_download
|
|
|
|
| 21 |
|
| 22 |
+
# ==========================================
|
| 23 |
+
# DYNAMIC MODEL DOWNLOADER (Bridge to Model Repo)
|
| 24 |
+
# ==========================================
|
| 25 |
+
MODEL_REPO = "shrishSVaidya/VAJRAM-Models" # Change this if you named it differently
|
| 26 |
+
|
| 27 |
+
print("Fetching models from Hugging Face Hub (this takes a moment on first boot)...")
|
| 28 |
+
|
| 29 |
+
# hf_hub_download pulls the file into the Space's local cache.
|
| 30 |
+
# If it's already downloaded, it loads instantly in 0.01 seconds!
|
| 31 |
+
LLM_PATH = hf_hub_download(repo_id=MODEL_REPO, filename="gguf_models/medgemma_q4km.gguf")
|
| 32 |
|
| 33 |
VISION_MMPROJ_PATHS = {
|
| 34 |
+
"module3": hf_hub_download(repo_id=MODEL_REPO, filename="gguf_models/medgemma_Bone_marrow_vision.gguf"),
|
| 35 |
+
"base": hf_hub_download(repo_id=MODEL_REPO, filename="gguf_models/medgemma_vision_base.gguf"),
|
| 36 |
}
|
| 37 |
|
| 38 |
LLM_LORA_PATHS = {
|
| 39 |
+
"module2": hf_hub_download(repo_id=MODEL_REPO, filename="gguf_models/lora_module2.gguf"),
|
| 40 |
+
"module3": hf_hub_download(repo_id=MODEL_REPO, filename="gguf_models/lora_module3.gguf"),
|
| 41 |
+
"module4": hf_hub_download(repo_id=MODEL_REPO, filename="gguf_models/lora_module4.gguf"),
|
| 42 |
"default": None,
|
| 43 |
}
|
| 44 |
|
requirements.txt
CHANGED
|
@@ -6,4 +6,5 @@ langchain-huggingface
|
|
| 6 |
sentence-transformers
|
| 7 |
faiss-cpu
|
| 8 |
Pillow
|
| 9 |
-
matplotlib
|
|
|
|
|
|
| 6 |
sentence-transformers
|
| 7 |
faiss-cpu
|
| 8 |
Pillow
|
| 9 |
+
matplotlib
|
| 10 |
+
huggingface_hub
|