mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-23 00:17:25 +08:00
[Feature] multi source download (#3125)
Deploy GitHub Pages / deploy (push) Has been cancelled
Deploy GitHub Pages / deploy (push) Has been cancelled
* multi-source download * multi-source download * huggingface download revision * requirement * style * add revision arg * test * pre-commit * Change default download * change requirements.txt * modify English Documentation * documentation * modify model download path * add requirements * error optimization * 连接失败兜底 * 连接失败兜底 * 连接失败兜底 * unit test * unit test * unit test * test * test
This commit is contained in:
+15
-3
@@ -532,7 +532,15 @@ def retrive_model_from_server(model_name_or_path, revision="master"):
|
||||
aistudio_download(repo_id=repo_id, revision=revision, local_dir=local_path)
|
||||
model_name_or_path = local_path
|
||||
except Exception:
|
||||
raise Exception(f"The setting model_name_or_path:{model_name_or_path} is not exist.")
|
||||
if os.path.exists(local_path):
|
||||
llm_logger.error(
|
||||
f"Failed to connect to aistudio, but detected that the model directory {local_path} exists. Attempting to start."
|
||||
)
|
||||
return local_path
|
||||
else:
|
||||
raise Exception(
|
||||
f"The {revision} of {model_name_or_path} is not exist. Please check the model name or revision."
|
||||
)
|
||||
elif model_source == "MODELSCOPE":
|
||||
try:
|
||||
from modelscope.hub.snapshot_download import (
|
||||
@@ -547,7 +555,9 @@ def retrive_model_from_server(model_name_or_path, revision="master"):
|
||||
modelscope_download(repo_id=repo_id, revision=revision, local_dir=local_path)
|
||||
model_name_or_path = local_path
|
||||
except Exception:
|
||||
raise Exception(f"The setting model_name_or_path:{model_name_or_path} is not exist.")
|
||||
raise Exception(
|
||||
f"The {revision} of {model_name_or_path} is not exist. Please check the model name or revision."
|
||||
)
|
||||
elif model_source == "HUGGINGFACE":
|
||||
try:
|
||||
from huggingface_hub._snapshot_download import (
|
||||
@@ -565,7 +575,9 @@ def retrive_model_from_server(model_name_or_path, revision="master"):
|
||||
huggingface_download(repo_id=repo_id, revision=revision, local_dir=local_path)
|
||||
model_name_or_path = local_path
|
||||
except Exception:
|
||||
raise Exception(f"The setting model_name_or_path:{model_name_or_path} is not exist.")
|
||||
raise Exception(
|
||||
f"The {revision} of {model_name_or_path} is not exist. Please check the model name or revision."
|
||||
)
|
||||
else:
|
||||
raise ValueError(
|
||||
f"Unsupported model source: {model_source}, please choose one of ['MODELSCOPE', 'AISTUDIO', 'HUGGINGFACE']"
|
||||
|
||||
Reference in New Issue
Block a user