Merge pull request 'Complete the modelarts createServeic of ai' (#293) from upmaster into master
Former-commit-id: a7599f67e2f4218daa7c676ab7d5d8b4ac5529a1
This commit is contained in:
commit
efbac11fe8
|
@ -19,6 +19,13 @@ type InferOption struct {
|
||||||
ResourceId string
|
ResourceId string
|
||||||
AlgorithmId string
|
AlgorithmId string
|
||||||
ImageId string
|
ImageId string
|
||||||
|
|
||||||
|
//modelarts
|
||||||
|
InferType string
|
||||||
|
Specification string
|
||||||
|
Weight int32
|
||||||
|
ModelId string
|
||||||
|
InstanceCount int32
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a InferOption) GetOptionType() string {
|
func (a InferOption) GetOptionType() string {
|
||||||
|
|
|
@ -260,6 +260,16 @@ func (m *ModelArtsLink) UploadAlgorithmCode(ctx context.Context, resourceType st
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *ModelArtsLink) GetModelId(ctx context.Context, option *option.AiOption, ifoption *option.InferOption) error {
|
||||||
|
req := &modelarts.ListModelReq{}
|
||||||
|
specResp, err := m.modelArtsRpc.ListModels(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (m *ModelArtsLink) GetTrainingTaskLog(ctx context.Context, taskId string, instanceNum string) (string, error) {
|
func (m *ModelArtsLink) GetTrainingTaskLog(ctx context.Context, taskId string, instanceNum string) (string, error) {
|
||||||
req := &modelartsservice.GetTrainingJobLogsPreviewReq{
|
req := &modelartsservice.GetTrainingJobLogsPreviewReq{
|
||||||
Platform: m.platform,
|
Platform: m.platform,
|
||||||
|
@ -364,7 +374,7 @@ func (m *ModelArtsLink) GenerateSubmitParams(ctx context.Context, option *option
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ModelArtsLink) generateResourceId(ctx context.Context, option *option.AiOption) error {
|
func (m *ModelArtsLink) generateResourceId(ctx context.Context, option *option.AiOption, ifoption *option.InferOption) error {
|
||||||
option.ResourceId = "modelarts.kat1.xlarge"
|
option.ResourceId = "modelarts.kat1.xlarge"
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -541,7 +551,27 @@ func (m *ModelArtsLink) GetInferResult(ctx context.Context, url string, file mul
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ModelArtsLink) CreateInferDeployInstance(ctx context.Context, option *option.InferOption) (string, error) {
|
func (m *ModelArtsLink) CreateInferDeployInstance(ctx context.Context, option *option.InferOption) (string, error) {
|
||||||
return "", nil
|
|
||||||
|
configParam := &modelarts.ServiceConfig{
|
||||||
|
Specification: option.Specification,
|
||||||
|
Weight: option.Weight,
|
||||||
|
ModelId: option.ModelId,
|
||||||
|
InstanceCount: option.InstanceCount,
|
||||||
|
}
|
||||||
|
var configItems []*modelarts.ServiceConfig
|
||||||
|
configItems = append(configItems, configParam)
|
||||||
|
req := &modelarts.CreateServiceReq{
|
||||||
|
Platform: m.platform,
|
||||||
|
Config: configItems,
|
||||||
|
InferType: option.InferType,
|
||||||
|
ServiceName: option.TaskName,
|
||||||
|
}
|
||||||
|
resp, err := m.modelArtsRpc.CreateService(ctx, req)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
return resp.ServiceId, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ModelArtsLink) CheckModelExistence(ctx context.Context, name string, mtype string) bool {
|
func (m *ModelArtsLink) CheckModelExistence(ctx context.Context, name string, mtype string) bool {
|
||||||
|
|
|
@ -883,6 +883,7 @@ func (s *ShuguangAi) GetInferResult(ctx context.Context, url string, file multip
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *ShuguangAi) CreateInferDeployInstance(ctx context.Context, option *option.InferOption) (string, error) {
|
func (s *ShuguangAi) CreateInferDeployInstance(ctx context.Context, option *option.InferOption) (string, error) {
|
||||||
|
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue