Commit 9bfb3e9e authored by myhloli's avatar myhloli
Browse files

feat: enhance model downloading logic to support different repository modes

parent 41ecaedc
......@@ -51,9 +51,17 @@ def auto_download_and_get_model_root_path(relative_path: str, repo_mode='pipelin
else:
raise ValueError(f"未知的仓库类型: {model_source}")
cache_dir = None
if repo_mode == 'pipeline':
relative_path = relative_path.strip('/')
cache_dir = snapshot_download(repo, allow_patterns=[relative_path, relative_path+"/*"])
elif repo_mode == 'vlm':
# VLM 模式下,直接下载整个模型目录
cache_dir = snapshot_download(repo)
if not cache_dir:
raise FileNotFoundError(f"Failed to download model: {relative_path} from {repo}")
return cache_dir
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment