Skip to content
This repository was archived by the owner on Sep 20, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/dmaa/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@
DMAA_DEFAULT_PROFILE_PARH = "~/.dmaa_default_profile"

MODEL_TAG_PATTERN = r'^[a-z0-9]([a-z0-9-_]{0,61}[a-z0-9])?$'

LOCAL_REGION = "local"
# DMAA_USE_NO_PROFILE_CHOICE = "Don't set"
10 changes: 5 additions & 5 deletions src/dmaa/models/llms/deepseek.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
supported_frameworks=[
fastapi_framework
],
allow_china_region=False,
allow_china_region=True,
huggingface_model_id="deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
# modelscope_model_id="Qwen/Qwen2.5-32B-Instruct",
require_huggingface_token=False,
Expand Down Expand Up @@ -83,7 +83,7 @@
supported_frameworks=[
fastapi_framework
],
allow_china_region=False,
allow_china_region=True,
huggingface_model_id="deepseek-ai/DeepSeek-R1-Distill-Qwen-14B",
# modelscope_model_id="Qwen/Qwen2.5-14B-Instruct",
require_huggingface_token=False,
Expand Down Expand Up @@ -114,7 +114,7 @@
supported_frameworks=[
fastapi_framework
],
allow_china_region=False,
allow_china_region=True,
huggingface_model_id="deepseek-ai/DeepSeek-R1-Distill-Qwen-7B",
# modelscope_model_id="Qwen/Qwen2.5-14B-Instruct",
require_huggingface_token=False,
Expand Down Expand Up @@ -145,7 +145,7 @@
supported_frameworks=[
fastapi_framework
],
allow_china_region=False,
allow_china_region=True,
huggingface_model_id="deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B",
# modelscope_model_id="Qwen/Qwen2.5-14B-Instruct",
require_huggingface_token=False,
Expand Down Expand Up @@ -242,7 +242,7 @@
supported_frameworks=[
fastapi_framework
],
allow_china_region=False,
allow_china_region=True,
huggingface_model_id="deepseek-ai/DeepSeek-R1-Distill-Llama-8B",
# modelscope_model_id="Qwen/Qwen2.5-14B-Instruct",
require_huggingface_token=False,
Expand Down
2 changes: 2 additions & 0 deletions src/dmaa/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ class Model(ModelBase,Generic[T]):
# allow_china_region_ecs: bool = False
huggingface_model_id: str = ""
huggingface_endpoints: List[str] = ["https://huggingface.co","https://hf-mirror.com"]
disable_hf_transfer:bool = False

huggingface_model_download_kwargs: dict = Field(default_factory=dict)
ollama_model_id:Union[str,None] = None
require_huggingface_token: bool = False
Expand Down
3 changes: 2 additions & 1 deletion src/dmaa/sdk/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
ENV_STACK_NAME,
MODEL_DEFAULT_TAG,
VERSION,
LOCAL_REGION
)
from dmaa.models import Model
from dmaa.models.utils.constants import FrameworkType, ServiceType,InstanceType
Expand Down Expand Up @@ -311,7 +312,7 @@ def deploy_local(
f" --service_type {service_type}"
f" --backend_type {engine_type}"
f" --framework_type {framework_type}"
f" --region 'local'"
f" --region '{LOCAL_REGION}'"
f" --extra_params '{extra_params}'"
)
logger.info(f"pipeline cmd: {pipeline_cmd}")
Expand Down
29 changes: 23 additions & 6 deletions src/pipeline/deploy/build_and_push_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,34 @@ def run(
docker_login_region = docker_login_region or region

if build_image_host:
if check_cn_region(region):
build_image_script = (
build_image_script_cn = (
f"cd {execute_dir}"
f' && docker build --platform linux/amd64 -f {dockerfile_name} -t "{ecr_repo_uri}" .'
)
else:
build_image_script = (
build_image_script_global = (
f"cd {execute_dir}"
f" && aws {ecr_name} get-login-password --region {docker_login_region} | docker login --username AWS --password-stdin {build_image_host}"
f' && docker build --platform linux/amd64 -f {dockerfile_name} -t "{ecr_repo_uri}" .'
)
if check_cn_region(region):
build_image_scripts = [build_image_script_cn]
else:
build_image_scripts = [build_image_script_global,build_image_script_cn]

is_build_success = False
for build_image_script in build_image_scripts:
logger.info(f"building image: {build_image_script}")
try:
assert os.system(build_image_script) == 0
is_build_success = True
break
except Exception as e:
logger.error(f"docker build errorr: {e}")

if not is_build_success:
raise RuntimeError("docker build errorr")


# build_image_script = (
# f"cd {execute_dir}"
# f" && aws {ecr_name} get-login-password --region {docker_login_region} | docker login --username AWS --password-stdin {build_image_host}"
Expand All @@ -258,8 +275,8 @@ def run(
f' && docker build --platform linux/amd64 -f {dockerfile_name} -t "{ecr_repo_uri}" .'
)

logger.info(f"building image: {build_image_script}")
assert os.system(build_image_script) == 0
logger.info(f"building image: {build_image_script}")
assert os.system(build_image_script) == 0

# push image
# It should not push the image to ecr when service_type is `local`
Expand Down
3 changes: 2 additions & 1 deletion src/pipeline/deploy/prepare_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def enable_hf_transfer():


def download_huggingface_model(model:Model,model_dir=None):
enable_hf_transfer()
if not model.disable_hf_transfer:
enable_hf_transfer()
huggingface_model_id = model.huggingface_model_id
service_type = model.executable_config.current_service.service_type
model_id = model.model_id
Expand Down
4 changes: 2 additions & 2 deletions src/pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import logging
from concurrent.futures import as_completed,ProcessPoolExecutor
from dmaa.models import Model
from dmaa.constants import MODEL_DEFAULT_TAG
from dmaa.constants import MODEL_DEFAULT_TAG,LOCAL_REGION
from dmaa.models.utils.constants import FrameworkType,ServiceType,InstanceType
from utils.common import str2bool
from dmaa.utils.aws_service_utils import check_cn_region
Expand Down Expand Up @@ -217,7 +217,7 @@ def download_s5cmd():
t0 = time.time()
start_time = time.time()
args = parse_args()
if not check_cn_region(args.region):
if not (check_cn_region(args.region) or args.region == LOCAL_REGION):
download_s5cmd()
extra_params = args.extra_params
for k,v in extra_params.items():
Expand Down