Skip to content
This repository was archived by the owner on Sep 20, 2025. It is now read-only.

Commit 911f24b

Browse files
11zhouxuanyanbasic
andauthored
Fix: local deploy cn (#13)
* fix cn region local deploy bug * fix bugs in download_s5cmd * add disable_hf_transfer params to Model * add model_files_download_source * fix multiple engines selection * fix: update esc template --------- Co-authored-by: Yi Yan <[email protected]>
1 parent 01370e0 commit 911f24b

File tree

6 files changed

+30
-23
lines changed

6 files changed

+30
-23
lines changed

src/emd/models/llms/deepseek.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
],
5656
allow_china_region=True,
5757
huggingface_model_id="deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
58-
# modelscope_model_id="Qwen/Qwen2.5-32B-Instruct",
58+
modelscope_model_id="deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
5959
require_huggingface_token=False,
6060
application_scenario="Agent, tool use, translation, summary",
6161
description="The latest series of DeepSeek LLMs for reasoning",
@@ -85,7 +85,7 @@
8585
],
8686
allow_china_region=True,
8787
huggingface_model_id="deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
88-
# modelscope_model_id="Qwen/Qwen2.5-14B-Instruct",
88+
modelscope_model_id="deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
8989
require_huggingface_token=False,
9090
application_scenario="Agent, tool use, translation, summary",
9191
description="The latest series of DeepSeek LLMs for reasoning",
@@ -116,7 +116,7 @@
116116
],
117117
allow_china_region=True,
118118
huggingface_model_id="deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
119-
# modelscope_model_id="Qwen/Qwen2.5-14B-Instruct",
119+
modelscope_model_id="deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
120120
require_huggingface_token=False,
121121
application_scenario="Agent, tool use, translation, summary",
122122
description="The latest series of DeepSeek LLMs for reasoning",
@@ -147,7 +147,7 @@
147147
],
148148
allow_china_region=True,
149149
huggingface_model_id="deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
150-
# modelscope_model_id="Qwen/Qwen2.5-14B-Instruct",
150+
modelscope_model_id="deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
151151
require_huggingface_token=False,
152152
application_scenario="Agent, tool use, translation, summary",
153153
description="The latest series of DeepSeek LLMs for reasoning",
@@ -244,7 +244,7 @@
244244
],
245245
allow_china_region=True,
246246
huggingface_model_id="deepseek-ai/DeepSeek-R1-Distill-Llama-8B",
247-
# modelscope_model_id="Qwen/Qwen2.5-14B-Instruct",
247+
modelscope_model_id="deepseek-ai/DeepSeek-R1-Distill-Llama-8B",
248248
require_huggingface_token=False,
249249
application_scenario="Agent, tool use, translation, summary",
250250
description="The latest series of DeepSeek LLMs for reasoning",

src/emd/models/llms/qwen.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@
7878
model_id = "Qwen2.5-72B-Instruct-AWQ",
7979
supported_engines=[
8080
vllm_qwen2d5_engine064,
81-
tgi_qwen2d5_72b_engine064,
82-
tgi_qwen2d5_72b_on_inf2
81+
tgi_qwen2d5_72b_engine064
8382
],
8483
supported_instances=[
8584
g5d12xlarge_instance,

src/emd/models/model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
FrameworkType,
1111
ModelType,
1212
ModelSeriesType,
13+
ModelFilesDownloadSource
1314
# ModelPrepareMethod
1415
)
1516
import boto3
@@ -183,6 +184,7 @@ class Model(ModelBase,Generic[T]):
183184
# download model files directly from s3
184185
model_files_s3_path: Union[str,None] = None
185186
model_files_local_path: Union[str,None] = None
187+
model_files_download_source: ModelFilesDownloadSource = ModelFilesDownloadSource.AUTO
186188
model_series: ModelSeries
187189
executable_config: Union[ExecutableConfig,None] = None
188190

src/emd/models/utils/constants.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,10 @@ class ServiceCode(ConstantBase):
131131
SAGEMAKER = "sagemaker"
132132

133133

134-
# class ModelPrepareMethod(ConstantBase):
135-
# UPLOAD_TO_S3 = "upload to s3"
136-
# DOANLOWD_FROM_S3 = "download from s3"
137-
# IGNORE = "ignore"
138-
139-
140-
134+
class ModelFilesDownloadSource(ConstantBase):
135+
HUGGINGFACE = "huggingface"
136+
MODELSCOPE= "modelscope"
137+
AUTO = "auto"
141138

142139
class ServiceQuotaCode(ConstantBase):
143140
G5dXLARGE_ENDPOINT = "L-1928E07B"

src/pipeline/deploy/prepare_model.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from huggingface_hub import snapshot_download as hf_snapshot_download
66
from modelscope import snapshot_download as ms_snapshot_download
77
from emd.models import Model
8-
from emd.models.utils.constants import ServiceType,EngineType
8+
from emd.models.utils.constants import ServiceType,EngineType,ModelFilesDownloadSource
99
from emd.utils.aws_service_utils import check_cn_region
1010
from emd.utils.logger_utils import get_logger
1111
from utils.common import upload_dir_to_s3_by_s5cmd,download_dir_from_s3_by_s5cmd
@@ -110,15 +110,23 @@ def download_model_files(model:Model,model_dir=None):
110110
if engine_type == EngineType.COMFYUI:
111111
download_comfyui_model(model,model_dir=model_dir)
112112
else:
113-
if check_cn_region(region):
114-
try:
115-
download_modelscope_model(model,model_dir=model_dir)
116-
except Exception as e:
117-
logger.error(f"Error downloading {model.model_id} model from modelscope, error: {e}")
118-
logger.info("download from huggingface...")
119-
download_huggingface_model(model, model_dir=model_dir)
113+
if model.model_files_download_source == ModelFilesDownloadSource.AUTO:
114+
if check_cn_region(region):
115+
try:
116+
download_modelscope_model(model,model_dir=model_dir)
117+
except Exception as e:
118+
logger.error(f"Error downloading {model.model_id} model from modelscope, error: {e}")
119+
logger.info("download from huggingface...")
120+
download_huggingface_model(model, model_dir=model_dir)
121+
else:
122+
download_huggingface_model(model,model_dir=model_dir)
120123
else:
121-
download_huggingface_model(model,model_dir=model_dir)
124+
if model.model_files_download_source == ModelFilesDownloadSource.HUGGINGFACE:
125+
download_huggingface_model(model, model_dir=model_dir)
126+
elif model.model_files_download_source == ModelFilesDownloadSource.MODELSCOPE:
127+
download_modelscope_model(model, model_dir=model_dir)
128+
else:
129+
raise ValueError(f"Invalid model_files_download_source: {model.model_files_download_source}")
122130

123131

124132
def run(model:Model):#, model_s3_bucket, backend_type, service_type, region,args):

src/pipeline/pipeline.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import json
77
import logging
88
from concurrent.futures import as_completed,ProcessPoolExecutor
9+
910
from emd.models import Model
1011
from emd.constants import MODEL_DEFAULT_TAG,LOCAL_REGION
1112
from emd.models.utils.constants import FrameworkType,ServiceType,InstanceType

0 commit comments

Comments
 (0)