Skip to content

Commit 1c88dce

Browse files
author
suluyan
committed
add oss
1 parent 68f6ad7 commit 1c88dce

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

publish.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,11 @@ Parameters:
156156
type: string
157157
default: ''
158158
description: nas所在专用网络的交换机id,nasMountAddr为空时不会被取用。
159+
ossBucketPath:
160+
title: oss挂载地址
161+
type: string
162+
default: ''
163+
description: oss挂载地址,用于模型下载的缓存和转换;配置优先级大于nas。配置时nas不被挂载。oss所在区域应与region完全一致。配置示例:0625xxxxxx-xxxxx.cn-hangzhou.nas.aliyuncs.com:/deploy
159164
refresh:
160165
title: 刷新缓存
161166
type: string

src/s.yaml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ vars: # 全局变量
2828
securityGroupId: {{ securityGroupId }}
2929
vSwitchIds: {{ vSwitchIds }}
3030
refresh: '{{ refresh }}'
31+
ossBucketPath: {{ ossBucketPath }}
3132
resources:
3233
model_cache:
3334
component: 'fc3'
@@ -40,7 +41,14 @@ resources:
4041
instanceType: e1
4142
runtime: python3.9
4243
code: ./model_cache
43-
vpcConfig:{{ if nasMountAddr != '' }}
44+
{{ if ossBucketPath != '' }}ossMountConfig:
45+
ossMountPoints:
46+
- bucketName: swingdeploy-oss-${vars.region}
47+
bucketPath: ${vars.ossBucketPath}
48+
endpoint: oss-cn-${vars.region}.aliyuncs.com
49+
mountDir: /mnt/cache
50+
readOnly: False
51+
{{ else }}vpcConfig:{{ if nasMountAddr != '' }}
4452
vpcId: ${vars.vpcId}
4553
securityGroupId: ${vars.securityGroupId}
4654
vSwitchIds:
@@ -51,7 +59,7 @@ resources:
5159
mountPoints:
5260
- serverAddr: ${vars.nasMountAddr}
5361
mountDir: /mnt/cache
54-
enableTLS: false{{ else }} auto{{ /if }}
62+
enableTLS: false{{ else }} auto{{ /if }}{{ /if }}
5563
environmentVariables:
5664
ALIBABA_CLOUD_ACCESS_KEY_ID: ''
5765
ALIBABA_CLOUD_ACCESS_KEY_SECRET: ''
@@ -77,8 +85,9 @@ resources:
7785
instanceConcurrency: 1
7886
runtime: custom-container
7987
internetAccess: true
80-
vpcConfig: ${resources.model_cache.output.vpcConfig}
81-
nasConfig: ${resources.model_cache.output.nasConfig}
88+
{{ if ossBucketPath != '' }}ossMountConfig: ${resources.model_cache.output.ossMountConfig}
89+
{{ else }}vpcConfig: ${resources.model_cache.output.vpcConfig}
90+
nasConfig: ${resources.model_cache.output.nasConfig}{{ /if }}
8291
customContainerConfig:
8392
image: modelscope-registry.${vars.region}.cr.aliyuncs.com/modelscope-repo/modelscope:ubuntu22.04-py310-torch2.3.1-1.23.1
8493
command: ["/bin/sh", "-c", "wget https://modelscope.oss-cn-beijing.aliyuncs.com/swingdeploy/pre/deploy.tar; tar xvf deploy.tar; /bin/bash script/run_download.sh"]
@@ -93,7 +102,7 @@ resources:
93102
ALIBABA_CLOUD_SECURITY_TOKEN: ''
94103
MODEL_ID: ${vars.modelID}
95104
MODEL_VERSION: ${vars.modelRevision}
96-
MODELSCOPE_CACHE: ${resources.model_cache.output.nasConfig.mountPoints.0.mountDir}
105+
MODELSCOPE_CACHE: {{ if }}${resources.model_cache.output.nasConfig.mountPoints.0.mountDir}{{ else }}${resources.model_cache.output.ossMountConfig.ossMountPoints.0.mountDir}{{ /if }}
97106
MODELSCOPE_TOKEN: ${vars.modelAccessToken}
98107
MODELSCOPE_DOMAIN: ${vars.modelCache}
99108
IMAGE_TAG: ${vars.version}
@@ -171,8 +180,15 @@ resources:
171180
initializer: 'true'
172181
initializationTimeout: 300
173182
internetAccess: true
174-
vpcConfig: ${resources.model_cache.output.vpcConfig}
175-
nasConfig: ${resources.model_cache.output.nasConfig}
183+
{{ if ossBucketPath != '' }}ossMountConfig:
184+
ossMountPoints:
185+
- bucketName: swingdeploy-oss-${vars.region}
186+
bucketPath: ${vars.ossBucketPath}
187+
endpoint: oss-cn-${vars.region}.aliyuncs.com
188+
mountDir: /mnt/cache
189+
readOnly: False
190+
{{ else }}vpcConfig: ${resources.model_cache.output.vpcConfig}
191+
nasConfig: ${resources.model_cache.output.nasConfig}{{ /if }}
176192
customContainerConfig:
177193
image: {{ if imageTag == 'ubuntu22.04-cuda12.1.0-py310-torch2.3.0-tf2.16.1-1.16.0-fc' || imageTag == 'ubuntu22.04-cuda12.4.0-py311-torch2.6.0-1.25.0-LLM' || imageTag == 'ubuntu22.04-cuda12.4.0-py310-torch2.6.0-1.23.1-LLM' || imageTag == 'ubuntu22.04-py310-torch2.3.0-1.16.0-fc' || imageTag == 'ubuntu22.04-cuda12.1.0-py310-torch2.3.0-tf2.16.1-1.16.0based-1.18.1-fc' || imageTag == 'ubuntu22.04-cuda12.4.0-py310-torch2.5.1-1.23.1-LLM' || imageTag == 'fc-deploy-common-v17.3.3' || imageTag == 'ubuntu22.04-cuda12.4.0-py310-torch2.4.0-1.21.0-LLM-vllm085' }}registry.${vars.region}.aliyuncs.com/modelscope-repo/modelscope:${vars.version}{{ else }}modelscope-registry.${vars.region}.cr.aliyuncs.com/modelscope-repo/modelscope:${vars.version}{{/if}}
178194
command: ["/bin/sh", "-c", "wget https://modelscope.oss-cn-beijing.aliyuncs.com/swingdeploy/pre/deploy.tar; tar xvf deploy.tar; /bin/bash script/run_deploy.sh"]
@@ -187,7 +203,7 @@ resources:
187203
ALIBABA_CLOUD_SECURITY_TOKEN: ''
188204
MODEL_ID: ${vars.modelID}
189205
MODEL_VERSION: ${vars.modelRevision}
190-
MODELSCOPE_CACHE: ${resources.model_cache.output.nasConfig.mountPoints.0.mountDir}/
206+
MODELSCOPE_CACHE: {{ if }}${resources.model_cache.output.nasConfig.mountPoints.0.mountDir}{{ else }}${resources.model_cache.output.ossMountConfig.ossMountPoints.0.mountDir}{{ /if }}
191207
MODELSCOPE_TOKEN: ${vars.modelAccessToken}
192208
TASK: ${vars.modelTask}
193209
IMAGE_TAG: ${vars.version}

0 commit comments

Comments
 (0)