Spaces:
Running
Running
Commit
·
131cb13
1
Parent(s):
371f394
Change HF_WEIGTHS_REV to be either branch name or None never empty
Browse files
app/utils/inference_utils.py
CHANGED
|
@@ -21,7 +21,8 @@ DEVICE = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
| 21 |
|
| 22 |
# Map modes -> filenames in HF model repo
|
| 23 |
HF_MODEL_REPO = os.getenv("HF_MODEL_REPO", "Preetham22/medi-llm-weights")
|
| 24 |
-
|
|
|
|
| 25 |
|
| 26 |
FILENAMES = {
|
| 27 |
"text": "medi_llm_state_dict_text.pth",
|
|
@@ -65,8 +66,10 @@ def resolve_weights_path(mode: str) -> str:
|
|
| 65 |
revision=HF_WEIGHTS_REV, # can be None -> default branch
|
| 66 |
repo_type="model", # change to "dataset" if needed
|
| 67 |
local_dir=str(ROOT_DIR), # Keep a copy in repo dir
|
| 68 |
-
local_dir_use_symlinks=False,
|
|
|
|
| 69 |
)
|
|
|
|
| 70 |
except Exception as e:
|
| 71 |
raise RuntimeError(
|
| 72 |
f"Failed to fetch weights '{filename}' from repo '{HF_MODEL_REPO}'. "
|
|
|
|
| 21 |
|
| 22 |
# Map modes -> filenames in HF model repo
|
| 23 |
HF_MODEL_REPO = os.getenv("HF_MODEL_REPO", "Preetham22/medi-llm-weights")
|
| 24 |
+
_raw_rev = os.getenv("HF_WEIGHTS_REV", None)
|
| 25 |
+
HF_WEIGHTS_REV = _raw_rev if (_raw_rev and _raw_rev.strip()) else None # optional (commit/tag/branch), can be None
|
| 26 |
|
| 27 |
FILENAMES = {
|
| 28 |
"text": "medi_llm_state_dict_text.pth",
|
|
|
|
| 66 |
revision=HF_WEIGHTS_REV, # can be None -> default branch
|
| 67 |
repo_type="model", # change to "dataset" if needed
|
| 68 |
local_dir=str(ROOT_DIR), # Keep a copy in repo dir
|
| 69 |
+
local_dir_use_symlinks=False, # avoid symlink weirdness
|
| 70 |
+
token=None, # For public repo
|
| 71 |
)
|
| 72 |
+
|
| 73 |
except Exception as e:
|
| 74 |
raise RuntimeError(
|
| 75 |
f"Failed to fetch weights '{filename}' from repo '{HF_MODEL_REPO}'. "
|