forked from JointCloud/pcm-coordinator
fix: Complete the modelarts createServeic of ai
This commit is contained in:
parent
a7599f67e2
commit
1d51c0bcbd
|
@ -261,13 +261,25 @@ func (m *ModelArtsLink) UploadAlgorithmCode(ctx context.Context, resourceType st
|
|||
}
|
||||
|
||||
func (m *ModelArtsLink) GetModelId(ctx context.Context, option *option.AiOption, ifoption *option.InferOption) error {
|
||||
req := &modelarts.ListModelReq{}
|
||||
specResp, err := m.modelArtsRpc.ListModels(ctx, req)
|
||||
req := &modelarts.ListModelReq{
|
||||
Platform: m.platform,
|
||||
Limit: int64(m.pageIndex),
|
||||
Offset: int64(m.pageSize),
|
||||
ModelName: option.ModelName,
|
||||
//ModelType: option.ModelType,
|
||||
}
|
||||
ListResp, err := m.modelArtsRpc.ListModels(ctx, req)
|
||||
for _, Models := range ListResp.Models {
|
||||
if Models.ModelName == option.ModelName {
|
||||
ifoption.ModelId = Models.ModelId
|
||||
return nil
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
return errors.New("failed to set ModelId")
|
||||
}
|
||||
|
||||
func (m *ModelArtsLink) GetTrainingTaskLog(ctx context.Context, taskId string, instanceNum string) (string, error) {
|
||||
|
@ -347,7 +359,7 @@ func (m *ModelArtsLink) Execute(ctx context.Context, option *option.AiOption) (i
|
|||
}
|
||||
|
||||
func (m *ModelArtsLink) GenerateSubmitParams(ctx context.Context, option *option.AiOption) error {
|
||||
err := m.generateResourceId(ctx, option)
|
||||
err := m.generateResourceId(ctx, option, nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -552,8 +564,13 @@ func (m *ModelArtsLink) GetInferResult(ctx context.Context, url string, file mul
|
|||
|
||||
func (m *ModelArtsLink) CreateInferDeployInstance(ctx context.Context, option *option.InferOption) (string, error) {
|
||||
|
||||
err := m.GetModelId(ctx, nil, option)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
configParam := &modelarts.ServiceConfig{
|
||||
Specification: option.Specification,
|
||||
Specification: "modelarts.kat1.xlarge.al",
|
||||
Weight: option.Weight,
|
||||
ModelId: option.ModelId,
|
||||
InstanceCount: option.InstanceCount,
|
||||
|
@ -575,5 +592,14 @@ func (m *ModelArtsLink) CreateInferDeployInstance(ctx context.Context, option *o
|
|||
}
|
||||
|
||||
func (m *ModelArtsLink) CheckModelExistence(ctx context.Context, name string, mtype string) bool {
|
||||
return false
|
||||
ifoption := &option.InferOption{
|
||||
ModelName: name,
|
||||
ModelType: mtype,
|
||||
}
|
||||
err := m.GetModelId(ctx, nil, ifoption)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue