Skip to content

Commit a50c062

Browse files
authored
Merge pull request #75 from devsapp/add-model-download
fix: support annotation
2 parents 58e0c2d + 2f81918 commit a50c062

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
lines changed

example/s-pipeline.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ resources:
5151
alwaysAllocateGPU: false
5252
mode: sync
5353

54-
supplement:
54+
annotations:
5555
modelConfig:
5656
source: modelscope
5757
id: ${env('MODEL_ID', 'iic/SenseVoiceSmall')}

example/s.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ resources:
5858
alwaysAllocateGPU: false
5959
mode: sync
6060

61-
supplement:
61+
annotations:
6262
modelConfig:
6363
source: modelscope
6464
id: ${env('MODEL_ID', 'Qwen/Qwen3-32B-AWQ')}

src/interface/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export interface IProps extends IFunction {
2020
provisionConfig?: IProvisionConfig;
2121
endpoint?: string;
2222
supplement?: any;
23+
annotations?: any;
2324
}
2425

2526
export interface IInputs extends _IInputs {

src/subCommands/deploy/impl/function.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ export default class Service extends Base {
319319
* 生成 auto 资源,非 FC 资源,主要指 vpc、nas、log、role(oss mount 挂载点才有)
320320
*/
321321
private async _deployAuto() {
322-
const { region, supplement } = this.inputs.props;
322+
const { region, supplement, annotations } = this.inputs.props;
323323
const { credential } = this.inputs;
324324
const { functionName } = this.local;
325325

@@ -390,10 +390,7 @@ vpcConfig:
390390
_.set(this.local, 'vpcConfig', vpcConfig);
391391
}
392392
if (nasAuto) {
393-
let modelConfig;
394-
if (!isEmpty(supplement)) {
395-
modelConfig = supplement.modelConfig;
396-
}
393+
let modelConfig = supplement?.modelConfig || annotations?.modelConfig;
397394

398395
logger.write(
399396
yellow(`Created nas resource succeeded, please replace nasConfig: auto in yaml with:

src/subCommands/model/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ export class Model {
5757
// 2. 调用 download 接口,若返回一个错误是下载服务已经存在,继续等待 get 轮询。
5858
// 3. 轮询 get 接口
5959
const { credential } = this.inputs;
60-
const { region, supplement } = this.inputs.props;
60+
const { region, supplement, annotations } = this.inputs.props;
6161
const { functionName } = this.local;
62-
const { modelConfig } = supplement;
62+
const modelConfig = supplement?.modelConfig || annotations?.modelConfig;
6363

6464
if (isEmpty(modelConfig)) {
6565
logger.error(`[Download-model] modelConfig is empty.`);
@@ -110,7 +110,7 @@ nasConfig:
110110
groupId: 0
111111
userId: 0
112112
mountPoints:
113-
- serverAddr: ${mountTargetDomain}:/${functionName}/${supplement.modelConfig.id}
113+
- serverAddr: ${mountTargetDomain}:/${functionName}/${modelConfig.id}
114114
mountDir: /mnt/${functionName}
115115
enableTLS: false\n`),
116116
);
@@ -120,7 +120,7 @@ mountPoints:
120120
userId: 0,
121121
mountPoints: [
122122
{
123-
serverAddr: `${mountTargetDomain}:/${functionName}/${supplement.modelConfig.id}`,
123+
serverAddr: `${mountTargetDomain}:/${functionName}/${modelConfig.id}`,
124124
mountDir: `/mnt/${functionName}`,
125125
enableTLS: false,
126126
},

0 commit comments

Comments
 (0)