TaskCLIP / webui /weights.py
HanningChen
Download weights from HF model repo and use cached paths
6feb3b2
raw
history blame
392 Bytes
# webui/weights.py
import os
from pathlib import Path
from huggingface_hub import snapshot_download
def get_weights_dir(repo_id: str) -> Path:
token = os.getenv("HF_TOKEN") # only needed if repo is private
p = snapshot_download(
repo_id=repo_id,
local_dir="weights_cache",
local_dir_use_symlinks=False,
token=token,
)
return Path(p).resolve()