@@ -12,67 +12,67 @@ import ( | |||
) | |||
type AiModelManage struct { | |||
ID string `xorm:"pk"` | |||
Name string `xorm:"INDEX NOT NULL"` | |||
Version string `xorm:"NOT NULL"` | |||
VersionCount int `xorm:"NOT NULL DEFAULT 0"` | |||
New int `xorm:"NOT NULL"` | |||
Type int `xorm:"NOT NULL"` | |||
Size int64 `xorm:"NOT NULL"` | |||
Description string `xorm:"varchar(2000)"` | |||
Label string `xorm:"varchar(1000)"` | |||
Path string `xorm:"varchar(400) NOT NULL"` | |||
DownloadCount int `xorm:"NOT NULL DEFAULT 0"` | |||
Engine int64 `xorm:"NOT NULL DEFAULT 0"` | |||
Status int `xorm:"NOT NULL DEFAULT 0"` | |||
StatusDesc string `xorm:"varchar(500)"` | |||
Accuracy string `xorm:"varchar(1000)"` | |||
AttachmentId string `xorm:"NULL"` | |||
RepoId int64 `xorm:"INDEX NULL"` | |||
CodeBranch string `xorm:"varchar(400) NULL"` | |||
CodeCommitID string `xorm:"NULL"` | |||
UserId int64 `xorm:"NOT NULL"` | |||
UserName string | |||
UserRelAvatarLink string | |||
TrainTaskInfo string `xorm:"text NULL"` | |||
CreatedUnix timeutil.TimeStamp `xorm:"created"` | |||
UpdatedUnix timeutil.TimeStamp `xorm:"updated"` | |||
IsCanOper bool | |||
IsCanDelete bool | |||
ID string `xorm:"pk" json:"id"` | |||
Name string `xorm:"INDEX NOT NULL" json:"name"` | |||
Version string `xorm:"NOT NULL" json:"version"` | |||
VersionCount int `xorm:"NOT NULL DEFAULT 0" json:"versionCount"` | |||
New int `xorm:"NOT NULL" json:"new"` | |||
Type int `xorm:"NOT NULL" json:"type"` | |||
Size int64 `xorm:"NOT NULL" json:"size"` | |||
Description string `xorm:"varchar(2000)" json:"description"` | |||
Label string `xorm:"varchar(1000)" json:"label"` | |||
Path string `xorm:"varchar(400) NOT NULL" json:"path"` | |||
DownloadCount int `xorm:"NOT NULL DEFAULT 0" json:"downloadCount"` | |||
Engine int64 `xorm:"NOT NULL DEFAULT 0" json:"engine"` | |||
Status int `xorm:"NOT NULL DEFAULT 0" json:"status"` | |||
StatusDesc string `xorm:"varchar(500)" json:"statusDesc"` | |||
Accuracy string `xorm:"varchar(1000)" json:"accuracy"` | |||
AttachmentId string `xorm:"NULL" json:"attachmentId"` | |||
RepoId int64 `xorm:"INDEX NULL" json:"repoId"` | |||
CodeBranch string `xorm:"varchar(400) NULL" json:"codeBranch"` | |||
CodeCommitID string `xorm:"NULL" json:"codeCommitID"` | |||
UserId int64 `xorm:"NOT NULL" json:"userId"` | |||
UserName string `json:"userName"` | |||
UserRelAvatarLink string `json:"userRelAvatarLink"` | |||
TrainTaskInfo string `xorm:"text NULL" json:"trainTaskInfo"` | |||
CreatedUnix timeutil.TimeStamp `xorm:"created" json:"createdUnix"` | |||
UpdatedUnix timeutil.TimeStamp `xorm:"updated" json:"updatedUnix"` | |||
IsCanOper bool `json:"isCanOper"` | |||
IsCanDelete bool `json:"isCanDelete"` | |||
} | |||
type AiModelConvert struct { | |||
ID string `xorm:"pk"` | |||
Name string `xorm:"INDEX NOT NULL"` | |||
Status string `xorm:"NULL"` | |||
StatusResult string `xorm:"NULL"` | |||
SrcEngine int `xorm:"NOT NULL DEFAULT 0"` | |||
RepoId int64 `xorm:"INDEX NULL"` | |||
ModelId string `xorm:"NOT NULL"` | |||
ModelName string `xorm:"NULL"` | |||
ModelVersion string `xorm:"NOT NULL"` | |||
ModelPath string `xorm:"NULL"` | |||
DestFormat int `xorm:"NOT NULL DEFAULT 0"` | |||
NetOutputFormat int `xorm:"NULL"` | |||
UserId int64 `xorm:"NOT NULL"` | |||
CloudBrainTaskId string `xorm:"NULL"` | |||
ModelArtsVersionId string `xorm:"NULL"` | |||
ContainerID string | |||
ContainerIp string | |||
RunTime int64 `xorm:"NULL"` | |||
TrainJobDuration string | |||
InputShape string `xorm:"varchar(2000)"` | |||
InputDataFormat string `xorm:"NOT NULL"` | |||
Description string `xorm:"varchar(2000)"` | |||
Path string `xorm:"varchar(400) NOT NULL"` | |||
CreatedUnix timeutil.TimeStamp `xorm:"created"` | |||
UpdatedUnix timeutil.TimeStamp `xorm:"updated"` | |||
StartTime timeutil.TimeStamp | |||
EndTime timeutil.TimeStamp | |||
UserName string | |||
UserRelAvatarLink string | |||
IsCanOper bool | |||
IsCanDelete bool | |||
ID string `xorm:"pk" json:"id"` | |||
Name string `xorm:"INDEX NOT NULL" json:"name"` | |||
Status string `xorm:"NULL" json:"status"` | |||
StatusResult string `xorm:"NULL" json:"statusResult"` | |||
SrcEngine int `xorm:"NOT NULL DEFAULT 0" json:"srcEngine"` | |||
RepoId int64 `xorm:"INDEX NULL" json:"repoId"` | |||
ModelId string `xorm:"NOT NULL" json:"modelId"` | |||
ModelName string `xorm:"NULL" json:"modelName"` | |||
ModelVersion string `xorm:"NOT NULL" json:"modelVersion"` | |||
ModelPath string `xorm:"NULL" json:"modelPath"` | |||
DestFormat int `xorm:"NOT NULL DEFAULT 0" json:"destFormat"` | |||
NetOutputFormat int `xorm:"NULL" json:"netOutputFormat"` | |||
UserId int64 `xorm:"NOT NULL" json:"userId"` | |||
CloudBrainTaskId string `xorm:"NULL" json:"cloudBrainTaskId"` | |||
ModelArtsVersionId string `xorm:"NULL" json:"modelArtsVersionId"` | |||
ContainerID string `json:"containerID"` | |||
ContainerIp string `json:"containerIp"` | |||
RunTime int64 `xorm:"NULL" json:"runTime"` | |||
TrainJobDuration string `json:"trainJobDuration"` | |||
InputShape string `xorm:"varchar(2000)" json:"inputShape"` | |||
InputDataFormat string `xorm:"NOT NULL" json:"inputDataFormat"` | |||
Description string `xorm:"varchar(2000)" json:"description"` | |||
Path string `xorm:"varchar(400) NOT NULL" json:"path"` | |||
CreatedUnix timeutil.TimeStamp `xorm:"created" json:"createdUnix"` | |||
UpdatedUnix timeutil.TimeStamp `xorm:"updated" json:"updatedUnix"` | |||
StartTime timeutil.TimeStamp `json:"startTime"` | |||
EndTime timeutil.TimeStamp `json:"endTime"` | |||
UserName string `json:"userName"` | |||
UserRelAvatarLink string `json:"userRelAvatarLink"` | |||
IsCanOper bool `json:"isCanOper"` | |||
IsCanDelete bool `json:"isCanDelete"` | |||
} | |||
type AiModelQueryOptions struct { | |||
@@ -953,6 +953,18 @@ func RegisterRoutes(m *macaron.Macaron) { | |||
}) | |||
}, reqRepoReader(models.UnitTypeCloudBrain)) | |||
m.Group("/modelmanage", func() { | |||
m.Post("/create_new_model", repo.CreateNewModel) | |||
m.Get("/show_model_api", repo.ShowModelManageApi) | |||
m.Delete("/delete_model", repo.DeleteModel) | |||
m.Get("/downloadall", repo.DownloadModel) | |||
m.Get("/query_model_byId", repo.QueryModelById) | |||
m.Get("/query_model_for_predict", repo.QueryModelListForPredict) | |||
m.Get("/query_modelfile_for_predict", repo.QueryModelFileForPredict) | |||
m.Get("/query_train_job", repo.QueryTrainJobList) | |||
m.Get("/query_train_model", repo.QueryTrainModelList) | |||
m.Get("/query_train_job_version", repo.QueryTrainJobVersionList) | |||
m.Post("/create_model_convert", repo.CreateModelConvert) | |||
m.Get("/show_model_convert_page") | |||
m.Get("/:id", repo.GetCloudbrainModelConvertTask) | |||
m.Get("/:id/log", repo.CloudbrainForModelConvertGetLog) | |||
m.Get("/:id/modelartlog", repo.TrainJobForModelConvertGetLog) | |||
@@ -0,0 +1,106 @@ | |||
package repo | |||
import ( | |||
"net/http" | |||
"code.gitea.io/gitea/modules/context" | |||
"code.gitea.io/gitea/modules/log" | |||
"code.gitea.io/gitea/modules/storage" | |||
routerRepo "code.gitea.io/gitea/routers/repo" | |||
) | |||
type FileInfo struct { | |||
FileName string `json:"fileName"` | |||
ModTime string `json:"modTime"` | |||
IsDir bool `json:"isDir"` | |||
Size int64 `json:"size"` | |||
ParenDir string `json:"parenDir"` | |||
UUID string `json:"uuid"` | |||
} | |||
func CreateNewModel(ctx *context.APIContext) { | |||
log.Info("CreateNewModel by api.") | |||
routerRepo.SaveModel(ctx.Context) | |||
} | |||
func ShowModelManageApi(ctx *context.APIContext) { | |||
log.Info("ShowModelManageApi by api.") | |||
routerRepo.ShowModelPageInfo(ctx.Context) | |||
} | |||
func DeleteModel(ctx *context.APIContext) { | |||
log.Info("DeleteModel by api.") | |||
routerRepo.DeleteModel(ctx.Context) | |||
} | |||
func DownloadModel(ctx *context.APIContext) { | |||
log.Info("DownloadModel by api.") | |||
routerRepo.DownloadMultiModelFile(ctx.Context) | |||
} | |||
func QueryModelById(ctx *context.APIContext) { | |||
log.Info("QueryModelById by api.") | |||
routerRepo.QueryModelById(ctx.Context) | |||
} | |||
func QueryModelListForPredict(ctx *context.APIContext) { | |||
log.Info("QueryModelListForPredict by api.") | |||
routerRepo.QueryModelListForPredict(ctx.Context) | |||
} | |||
func QueryTrainModelList(ctx *context.APIContext) { | |||
result, err := routerRepo.QueryTrainModelFileById(ctx.Context) | |||
if err != nil { | |||
log.Info("query error." + err.Error()) | |||
} | |||
re := convertFileFormat(result) | |||
ctx.JSON(http.StatusOK, re) | |||
} | |||
func convertFileFormat(result []storage.FileInfo) []FileInfo { | |||
re := make([]FileInfo, 0) | |||
if result != nil { | |||
for _, file := range result { | |||
tmpFile := FileInfo{ | |||
FileName: file.FileName, | |||
ModTime: file.ModTime, | |||
IsDir: file.IsDir, | |||
Size: file.Size, | |||
ParenDir: file.ParenDir, | |||
UUID: file.UUID, | |||
} | |||
re = append(re, tmpFile) | |||
} | |||
} | |||
return re | |||
} | |||
func QueryModelFileForPredict(ctx *context.APIContext) { | |||
log.Info("QueryModelFileForPredict by api.") | |||
id := ctx.Query("id") | |||
result := routerRepo.QueryModelFileByID(id) | |||
re := convertFileFormat(result) | |||
ctx.JSON(http.StatusOK, re) | |||
} | |||
func CreateModelConvert(ctx *context.APIContext) { | |||
log.Info("CreateModelConvert by api.") | |||
routerRepo.SaveModelConvert(ctx.Context) | |||
} | |||
func ShowModelConvertPage(ctx *context.APIContext) { | |||
log.Info("ShowModelConvertPage by api.") | |||
modelResult, count, err := routerRepo.GetModelConvertPageData(ctx.Context) | |||
if err == nil { | |||
mapInterface := make(map[string]interface{}) | |||
mapInterface["data"] = modelResult | |||
mapInterface["count"] = count | |||
ctx.JSON(http.StatusOK, mapInterface) | |||
} else { | |||
mapInterface := make(map[string]interface{}) | |||
mapInterface["data"] = nil | |||
mapInterface["count"] = 0 | |||
ctx.JSON(http.StatusOK, mapInterface) | |||
} | |||
} |
@@ -74,27 +74,27 @@ func SaveModelConvert(ctx *context.Context) { | |||
log.Info("save model convert start.") | |||
if !ctx.Repo.CanWrite(models.UnitTypeModelManage) { | |||
ctx.JSON(200, map[string]string{ | |||
"result_code": "1", | |||
"message": ctx.Tr("repo.modelconvert.manage.no_operate_right"), | |||
"code": "1", | |||
"msg": ctx.Tr("repo.modelconvert.manage.no_operate_right"), | |||
}) | |||
return | |||
} | |||
name := ctx.Query("name") | |||
desc := ctx.Query("desc") | |||
modelId := ctx.Query("modelId") | |||
modelPath := ctx.Query("ModelFile") | |||
SrcEngine := ctx.QueryInt("SrcEngine") | |||
modelPath := ctx.Query("modelFile") | |||
SrcEngine := ctx.QueryInt("srcEngine") | |||
InputShape := ctx.Query("inputshape") | |||
InputDataFormat := ctx.Query("inputdataformat") | |||
DestFormat := ctx.QueryInt("DestFormat") | |||
NetOutputFormat := ctx.QueryInt("NetOutputFormat") | |||
DestFormat := ctx.QueryInt("destFormat") | |||
NetOutputFormat := ctx.QueryInt("netOutputFormat") | |||
task, err := models.QueryModelById(modelId) | |||
if err != nil { | |||
log.Error("no such model!", err.Error()) | |||
ctx.JSON(200, map[string]string{ | |||
"result_code": "1", | |||
"message": ctx.Tr("repo.modelconvert.manage.model_not_exist"), | |||
"code": "1", | |||
"msg": ctx.Tr("repo.modelconvert.manage.model_not_exist"), | |||
}) | |||
return | |||
} | |||
@@ -105,8 +105,8 @@ func SaveModelConvert(ctx *context.Context) { | |||
if convert.Name == name { | |||
log.Info("convert.Name=" + name + " convert.id=" + convert.ID) | |||
ctx.JSON(200, map[string]string{ | |||
"result_code": "1", | |||
"message": ctx.Tr("repo.modelconvert.manage.create_error1"), | |||
"code": "1", | |||
"msg": ctx.Tr("repo.modelconvert.manage.create_error1"), | |||
}) | |||
return | |||
} | |||
@@ -119,8 +119,8 @@ func SaveModelConvert(ctx *context.Context) { | |||
if isRunningTask(convert.Status) { | |||
log.Info("convert.Status=" + convert.Status + " convert.id=" + convert.ID) | |||
ctx.JSON(200, map[string]string{ | |||
"result_code": "1", | |||
"message": ctx.Tr("repo.modelconvert.manage.create_error2"), | |||
"code": "1", | |||
"msg": ctx.Tr("repo.modelconvert.manage.create_error2"), | |||
}) | |||
return | |||
} | |||
@@ -150,7 +150,7 @@ func SaveModelConvert(ctx *context.Context) { | |||
go goCreateTask(modelConvert, ctx, task) | |||
ctx.JSON(200, map[string]string{ | |||
"result_code": "0", | |||
"code": "0", | |||
}) | |||
} | |||
@@ -604,11 +604,11 @@ func StopModelConvert(ctx *context.Context) { | |||
} | |||
func ShowModelConvertInfo(ctx *context.Context) { | |||
ctx.Data["ID"] = ctx.Query("ID") | |||
ctx.Data["ID"] = ctx.Query("id") | |||
ctx.Data["isModelManage"] = true | |||
ctx.Data["ModelManageAccess"] = ctx.Repo.CanWrite(models.UnitTypeModelManage) | |||
job, err := models.QueryModelConvertById(ctx.Query("ID")) | |||
job, err := models.QueryModelConvertById(ctx.Query("id")) | |||
if err == nil { | |||
if job.TrainJobDuration == "" { | |||
job.TrainJobDuration = "00:00:00" | |||
@@ -707,6 +707,26 @@ func ShowModelConvertPageInfo(ctx *context.Context) { | |||
ctx.NotFound(ctx.Req.URL.RequestURI(), nil) | |||
return | |||
} | |||
page := ctx.QueryInt("page") | |||
if page <= 0 { | |||
page = 1 | |||
} | |||
pageSize := ctx.QueryInt("pageSize") | |||
if pageSize <= 0 { | |||
pageSize = setting.UI.IssuePagingNum | |||
} | |||
modelResult, count, err := GetModelConvertPageData(ctx) | |||
if err == nil { | |||
pager := context.NewPagination(int(count), page, pageSize, 5) | |||
ctx.Data["Page"] = pager | |||
ctx.Data["Tasks"] = modelResult | |||
ctx.Data["MODEL_CONVERT_COUNT"] = count | |||
} else { | |||
ctx.ServerError("Query data error.", err) | |||
} | |||
} | |||
func GetModelConvertPageData(ctx *context.Context) ([]*models.AiModelConvert, int64, error) { | |||
page := ctx.QueryInt("page") | |||
if page <= 0 { | |||
page = 1 | |||
@@ -725,10 +745,8 @@ func ShowModelConvertPageInfo(ctx *context.Context) { | |||
}) | |||
if err != nil { | |||
log.Info("query db error." + err.Error()) | |||
ctx.ServerError("Cloudbrain", err) | |||
return | |||
return nil, 0, err | |||
} | |||
ctx.Data["MODEL_CONVERT_COUNT"] = count | |||
userIds := make([]int64, len(modelResult)) | |||
for i, model := range modelResult { | |||
model.IsCanOper = isOper(ctx, model.UserId) | |||
@@ -743,10 +761,7 @@ func ShowModelConvertPageInfo(ctx *context.Context) { | |||
model.UserRelAvatarLink = value.RelAvatarLink() | |||
} | |||
} | |||
pager := context.NewPagination(int(count), page, pageSize, 5) | |||
ctx.Data["Page"] = pager | |||
ctx.Data["Tasks"] = modelResult | |||
return modelResult, count, nil | |||
} | |||
func ModelConvertDownloadModel(ctx *context.Context) { | |||
@@ -757,7 +772,7 @@ func ModelConvertDownloadModel(ctx *context.Context) { | |||
ctx.ServerError("Not found task.", err) | |||
return | |||
} | |||
AllDownload := ctx.QueryBool("AllDownload") | |||
AllDownload := ctx.QueryBool("allDownload") | |||
if AllDownload { | |||
if job.IsGpuTrainTask() { | |||
path := setting.CBCodePathPrefix + job.ID + "/model/" | |||
@@ -17,7 +17,6 @@ import ( | |||
"code.gitea.io/gitea/modules/notification" | |||
"code.gitea.io/gitea/modules/setting" | |||
"code.gitea.io/gitea/modules/storage" | |||
"code.gitea.io/gitea/services/cloudbrain/resource" | |||
uuid "github.com/satori/go.uuid" | |||
) | |||
@@ -34,13 +33,13 @@ const ( | |||
STATUS_ERROR = 2 | |||
) | |||
func saveModelByParameters(jobId string, versionName string, name string, version string, label string, description string, engine int, ctx *context.Context) error { | |||
func saveModelByParameters(jobId string, versionName string, name string, version string, label string, description string, engine int, ctx *context.Context) (string, error) { | |||
aiTask, err := models.GetCloudbrainByJobIDAndVersionName(jobId, versionName) | |||
if err != nil { | |||
aiTask, err = models.GetRepoCloudBrainByJobID(ctx.Repo.Repository.ID, jobId) | |||
if err != nil { | |||
log.Info("query task error." + err.Error()) | |||
return err | |||
return "", err | |||
} else { | |||
log.Info("query gpu train task.") | |||
} | |||
@@ -56,7 +55,7 @@ func saveModelByParameters(jobId string, versionName string, name string, versio | |||
if len(aimodels) > 0 { | |||
for _, model := range aimodels { | |||
if model.Version == version { | |||
return errors.New(ctx.Tr("repo.model.manage.create_error")) | |||
return "", errors.New(ctx.Tr("repo.model.manage.create_error")) | |||
} | |||
if model.New == MODEL_LATEST { | |||
lastNewModelId = model.ID | |||
@@ -111,7 +110,7 @@ func saveModelByParameters(jobId string, versionName string, name string, versio | |||
err = models.SaveModelToDb(model) | |||
if err != nil { | |||
return err | |||
return "", err | |||
} | |||
if len(lastNewModelId) > 0 { | |||
//udpate status and version count | |||
@@ -134,7 +133,7 @@ func saveModelByParameters(jobId string, versionName string, name string, versio | |||
log.Info("save model end.") | |||
notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, id, name, models.ActionCreateNewModelTask) | |||
return nil | |||
return id, nil | |||
} | |||
func asyncToCopyModel(aiTask *models.Cloudbrain, id string, modelSelectedFile string) { | |||
@@ -173,7 +172,7 @@ func SaveNewNameModel(ctx *context.Context) { | |||
ctx.Error(403, ctx.Tr("repo.model_noright")) | |||
return | |||
} | |||
name := ctx.Query("Name") | |||
name := ctx.Query("name") | |||
if name == "" { | |||
ctx.Error(500, fmt.Sprintf("name or version is null.")) | |||
return | |||
@@ -203,38 +202,42 @@ func SaveModel(ctx *context.Context) { | |||
return | |||
} | |||
log.Info("save model start.") | |||
JobId := ctx.Query("JobId") | |||
VersionName := ctx.Query("VersionName") | |||
name := ctx.Query("Name") | |||
version := ctx.Query("Version") | |||
label := ctx.Query("Label") | |||
description := ctx.Query("Description") | |||
engine := ctx.QueryInt("Engine") | |||
JobId := ctx.Query("jobId") | |||
VersionName := ctx.Query("versionName") | |||
name := ctx.Query("name") | |||
version := ctx.Query("version") | |||
label := ctx.Query("label") | |||
description := ctx.Query("description") | |||
engine := ctx.QueryInt("engine") | |||
modelSelectedFile := ctx.Query("modelSelectedFile") | |||
log.Info("engine=" + fmt.Sprint(engine) + " modelSelectedFile=" + modelSelectedFile) | |||
re := map[string]string{ | |||
"code": "-1", | |||
} | |||
if JobId == "" || VersionName == "" { | |||
ctx.Error(500, fmt.Sprintf("JobId or VersionName is null.")) | |||
re["msg"] = "JobId or VersionName is null." | |||
ctx.JSON(200, re) | |||
return | |||
} | |||
if modelSelectedFile == "" { | |||
ctx.Error(500, fmt.Sprintf("Not selected model file.")) | |||
re["msg"] = "Not selected model file." | |||
ctx.JSON(200, re) | |||
return | |||
} | |||
if name == "" || version == "" { | |||
ctx.Error(500, fmt.Sprintf("name or version is null.")) | |||
re["msg"] = "name or version is null." | |||
ctx.JSON(200, re) | |||
return | |||
} | |||
err := saveModelByParameters(JobId, VersionName, name, version, label, description, engine, ctx) | |||
id, err := saveModelByParameters(JobId, VersionName, name, version, label, description, engine, ctx) | |||
if err != nil { | |||
log.Info("save model error." + err.Error()) | |||
ctx.Error(500, fmt.Sprintf("save model error. %v", err)) | |||
return | |||
re["msg"] = err.Error() | |||
} else { | |||
re["code"] = "0" | |||
re["id"] = id | |||
} | |||
ctx.Status(200) | |||
ctx.JSON(200, re) | |||
log.Info("save model end.") | |||
} | |||
@@ -299,13 +302,17 @@ func downloadModelFromCloudBrainOne(modelUUID string, jobName string, parentDir | |||
func DeleteModel(ctx *context.Context) { | |||
log.Info("delete model start.") | |||
id := ctx.Query("ID") | |||
id := ctx.Query("id") | |||
err := deleteModelByID(ctx, id) | |||
if err != nil { | |||
ctx.JSON(500, err.Error()) | |||
re := map[string]string{ | |||
"code": "-1", | |||
} | |||
re["msg"] = err.Error() | |||
ctx.JSON(200, re) | |||
} else { | |||
ctx.JSON(200, map[string]string{ | |||
"result_code": "0", | |||
"code": "0", | |||
}) | |||
} | |||
} | |||
@@ -362,7 +369,7 @@ func QueryModelByParameters(repoId int64, page int) ([]*models.AiModelManage, in | |||
func DownloadMultiModelFile(ctx *context.Context) { | |||
log.Info("DownloadMultiModelFile start.") | |||
id := ctx.Query("ID") | |||
id := ctx.Query("id") | |||
log.Info("id=" + id) | |||
task, err := models.QueryModelById(id) | |||
if err != nil { | |||
@@ -495,7 +502,10 @@ func downloadFromCloudBrainTwo(path string, task *models.AiModelManage, ctx *con | |||
func QueryTrainJobVersionList(ctx *context.Context) { | |||
log.Info("query train job version list. start.") | |||
JobID := ctx.Query("JobID") | |||
JobID := ctx.Query("jobId") | |||
if JobID == "" { | |||
JobID = ctx.Query("JobId") | |||
} | |||
VersionListTasks, count, err := models.QueryModelTrainJobVersionList(JobID) | |||
@@ -523,20 +533,33 @@ func QueryTrainJobList(ctx *context.Context) { | |||
} | |||
func QueryTrainModelList(ctx *context.Context) { | |||
log.Info("query train job list. start.") | |||
jobName := ctx.Query("jobName") | |||
taskType := ctx.QueryInt("type") | |||
VersionName := ctx.Query("VersionName") | |||
func QueryTrainModelFileById(ctx *context.Context) ([]storage.FileInfo, error) { | |||
JobID := ctx.Query("jobId") | |||
VersionListTasks, count, err := models.QueryModelTrainJobVersionList(JobID) | |||
if err == nil { | |||
if count == 1 { | |||
task := VersionListTasks[0] | |||
jobName := task.JobName | |||
taskType := task.Type | |||
VersionName := task.VersionName | |||
modelDbResult, err := getModelFromObjectSave(jobName, taskType, VersionName) | |||
return modelDbResult, err | |||
} | |||
} | |||
log.Info("get TypeCloudBrainTwo TrainJobListModel failed:", err) | |||
return nil, errors.New("Not found task.") | |||
} | |||
func getModelFromObjectSave(jobName string, taskType int, VersionName string) ([]storage.FileInfo, error) { | |||
if taskType == models.TypeCloudBrainTwo { | |||
objectkey := path.Join(setting.TrainJobModelPath, jobName, setting.OutPutPath, VersionName) + "/" | |||
modelDbResult, err := storage.GetAllObjectByBucketAndPrefix(setting.Bucket, objectkey) | |||
log.Info("bucket=" + setting.Bucket + " objectkey=" + objectkey) | |||
if err != nil { | |||
log.Info("get TypeCloudBrainTwo TrainJobListModel failed:", err) | |||
return nil, err | |||
} else { | |||
ctx.JSON(200, modelDbResult) | |||
return | |||
return modelDbResult, nil | |||
} | |||
} else if taskType == models.TypeCloudBrainOne { | |||
modelSrcPrefix := setting.CBCodePathPrefix + jobName + "/model/" | |||
@@ -544,12 +567,30 @@ func QueryTrainModelList(ctx *context.Context) { | |||
modelDbResult, err := storage.GetAllObjectByBucketAndPrefixMinio(bucketName, modelSrcPrefix) | |||
if err != nil { | |||
log.Info("get TypeCloudBrainOne TrainJobListModel failed:", err) | |||
return nil, err | |||
} else { | |||
ctx.JSON(200, modelDbResult) | |||
return | |||
return modelDbResult, nil | |||
} | |||
} | |||
ctx.JSON(200, "") | |||
return nil, errors.New("Not support.") | |||
} | |||
func QueryTrainModelList(ctx *context.Context) { | |||
log.Info("query train job list. start.") | |||
jobName := ctx.Query("jobName") | |||
taskType := ctx.QueryInt("type") | |||
VersionName := ctx.Query("versionName") | |||
if VersionName == "" { | |||
VersionName = ctx.Query("VersionName") | |||
} | |||
modelDbResult, err := getModelFromObjectSave(jobName, taskType, VersionName) | |||
if err != nil { | |||
log.Info("get TypeCloudBrainTwo TrainJobListModel failed:", err) | |||
ctx.JSON(200, "") | |||
} else { | |||
ctx.JSON(200, modelDbResult) | |||
return | |||
} | |||
} | |||
func DownloadSingleModelFile(ctx *context.Context) { | |||
@@ -620,7 +661,7 @@ func DownloadSingleModelFile(ctx *context.Context) { | |||
} | |||
func ShowModelInfo(ctx *context.Context) { | |||
ctx.Data["ID"] = ctx.Query("ID") | |||
ctx.Data["ID"] = ctx.Query("id") | |||
ctx.Data["name"] = ctx.Query("name") | |||
ctx.Data["isModelManage"] = true | |||
ctx.Data["ModelManageAccess"] = ctx.Repo.CanWrite(models.UnitTypeModelManage) | |||
@@ -628,6 +669,19 @@ func ShowModelInfo(ctx *context.Context) { | |||
ctx.HTML(200, tplModelInfo) | |||
} | |||
func QueryModelById(ctx *context.Context) { | |||
id := ctx.Query("id") | |||
model, err := models.QueryModelById(id) | |||
if err == nil { | |||
model.IsCanOper = isOper(ctx, model.UserId) | |||
model.IsCanDelete = isCanDelete(ctx, model.UserId) | |||
removeIpInfo(model) | |||
ctx.JSON(http.StatusOK, model) | |||
} else { | |||
ctx.JSON(http.StatusNotFound, nil) | |||
} | |||
} | |||
func ShowSingleModel(ctx *context.Context) { | |||
name := ctx.Query("name") | |||
@@ -836,8 +890,8 @@ func ModifyModel(id string, description string) error { | |||
func ModifyModelInfo(ctx *context.Context) { | |||
log.Info("modify model start.") | |||
id := ctx.Query("ID") | |||
description := ctx.Query("Description") | |||
id := ctx.Query("id") | |||
description := ctx.Query("description") | |||
task, err := models.QueryModelById(id) | |||
if err != nil { | |||
@@ -902,28 +956,36 @@ func QueryModelListForPredict(ctx *context.Context) { | |||
} | |||
func QueryModelFileForPredict(ctx *context.Context) { | |||
id := ctx.Query("ID") | |||
id := ctx.Query("id") | |||
if id == "" { | |||
id = ctx.Query("ID") | |||
} | |||
ctx.JSON(http.StatusOK, QueryModelFileByID(id)) | |||
} | |||
func QueryModelFileByID(id string) []storage.FileInfo { | |||
model, err := models.QueryModelById(id) | |||
if err == nil { | |||
if model.Type == models.TypeCloudBrainTwo { | |||
prefix := model.Path[len(setting.Bucket)+1:] | |||
fileinfos, _ := storage.GetAllObjectByBucketAndPrefix(setting.Bucket, prefix) | |||
ctx.JSON(http.StatusOK, fileinfos) | |||
return fileinfos | |||
} else if model.Type == models.TypeCloudBrainOne { | |||
prefix := model.Path[len(setting.Attachment.Minio.Bucket)+1:] | |||
fileinfos, _ := storage.GetAllObjectByBucketAndPrefixMinio(setting.Attachment.Minio.Bucket, prefix) | |||
ctx.JSON(http.StatusOK, fileinfos) | |||
return fileinfos | |||
} | |||
} else { | |||
log.Error("no such model!", err.Error()) | |||
ctx.ServerError("no such model:", err) | |||
return | |||
} | |||
return nil | |||
} | |||
func QueryOneLevelModelFile(ctx *context.Context) { | |||
id := ctx.Query("ID") | |||
id := ctx.Query("id") | |||
if id == "" { | |||
id = ctx.Query("ID") | |||
} | |||
parentDir := ctx.Query("parentDir") | |||
model, err := models.QueryModelById(id) | |||
if err != nil { | |||
@@ -331,9 +331,7 @@ | |||
$('#model_name_version').empty() | |||
let html = '' | |||
nameMap[value].forEach(element => { | |||
let {TrainTaskInfo} = element | |||
TrainTaskInfo = JSON.parse(TrainTaskInfo) | |||
html += `<div class="item" data-label="${element.Label}" data-id="${element.ID}" data-value="${element.Path}">${element.Version}</div>` | |||
html += `<div class="item" data-label="${element.label}" data-id="${element.id}" data-value="${element.path}">${element.version}</div>` | |||
}); | |||
$('#model_name_version').append(html) | |||
$("#select_model_version").removeClass("loading") | |||
@@ -387,7 +385,7 @@ | |||
} | |||
function loadCheckpointList(value){ | |||
return new Promise((resolve,reject)=>{ | |||
$.get(`${RepoLink}/modelmanage/query_modelfile_for_predict`,{ID:value}, (data) => { | |||
$.get(`${RepoLink}/modelmanage/query_modelfile_for_predict`,{id:value}, (data) => { | |||
resolve(data) | |||
}) | |||
}) | |||
@@ -633,24 +633,24 @@ | |||
<div class="required inline field"> | |||
<label>{{.i18n.Tr "repo.modelarts.train_job"}}</label> | |||
<input type="hidden" class="width83" id="JobId" name="JobId" readonly required> | |||
<input type="hidden" id="VersionName" name="VersionName" value="V0001"> | |||
<input type="hidden" class="width83" id="jobId" name="jobId" readonly required> | |||
<input type="hidden" id="versionName" name="versionName" value="V0001"> | |||
<input style="width: 45%;" id="JobName" readonly required> | |||
</div> | |||
<div class="required inline field" id="modelname"> | |||
<label>{{.i18n.Tr "repo.model.manage.model_name"}}</label> | |||
<input style="width: 45%;" id="name" name="Name" required maxlength="25" | |||
<input style="width: 45%;" id="name" name="name" required maxlength="25" | |||
onkeyup="this.value=this.value.replace(/[, ]/g,'')"> | |||
</div> | |||
<div class="required inline field" id="verionname"> | |||
<label>{{.i18n.Tr "repo.modelconvert.modelversion"}}</label> | |||
<input style="width: 45%;" id="version" name="Version" value="" readonly required maxlength="255"> | |||
<input style="width: 45%;" id="version" name="version" value="" readonly required maxlength="255"> | |||
</div> | |||
<div class="unite min_title inline field required"> | |||
<label>{{.i18n.Tr "repo.model.manage.engine"}}</label> | |||
<div class="ui dropdown selection search width70" id="choice_Engine"> | |||
<input type="hidden" id="Engine" name="Engine" required> | |||
<input type="hidden" id="engine" name="engine" required> | |||
<div class="default text">{{.i18n.Tr "repo.model.manage.select.engine"}}</div> | |||
<i class="dropdown icon"></i> | |||
<div class="menu" id="job-Engine"> | |||
@@ -677,12 +677,12 @@ | |||
</div> | |||
<div class="inline field"> | |||
<label>{{.i18n.Tr "repo.model.manage.modellabel"}}</label> | |||
<input style="width: 83%;margin-left: 7px;" id="label" name="Label" maxlength="255" | |||
<input style="width: 83%;margin-left: 7px;" id="label" name="label" maxlength="255" | |||
placeholder='{{.i18n.Tr "repo.modelarts.train_job.label_place"}}'> | |||
</div> | |||
<div class="inline field"> | |||
<label for="description">{{.i18n.Tr "repo.model.manage.modeldesc"}}</label> | |||
<textarea style="width: 83%;margin-left: 7px;" id="Description" name="Description" rows="3" | |||
<textarea style="width: 83%;margin-left: 7px;" id="description" name="description" rows="3" | |||
maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.new_place"}}' | |||
onchange="this.value=this.value.substring(0, 255)" | |||
onkeydown="this.value=this.value.substring(0, 255)" | |||
@@ -850,23 +850,19 @@ | |||
.modal({ | |||
centered: false, | |||
onShow: function () { | |||
$('input[name="Version"]').addClass('model_disabled') | |||
// $('input[name="JobId"]').text(obj.JobName) | |||
$('input[name="version"]').addClass('model_disabled') | |||
$('#JobName').val(obj.DisplayJobName).addClass('model_disabled') | |||
$('input[name="JobId"]').val(obj.JobID) | |||
$('input[name="VersionName"]').val("V0001") | |||
$('input[name="jobId"]').val(obj.JobID) | |||
$('input[name="versionName"]').val("V0001") | |||
$('#choice_Engine .default.text').text("PyTorch"); | |||
$('#choice_Engine input[name="Engine"]').val(0) | |||
$('#choice_Engine input[name="engine"]').val(0) | |||
$('#choice_Engine .default.text').css({ "color": "rgb(0, 0, 0,0.87)" }) | |||
$('.ui.dimmer').css({ "background-color": "rgb(136, 136, 136,0.7)" }) | |||
createModelName(); | |||
loadSelectedModelFile(obj); | |||
}, | |||
onHide: function () { | |||
var cityObj = $("#modelSelectedFile"); | |||
cityObj.attr("value", ""); | |||
document.getElementById("formId").reset(); | |||
$('.ui.dimmer').css({ "background-color": "" }) | |||
$('.ui.error.message').text() | |||
$('.ui.error.message').css('display', 'none') | |||
@@ -887,8 +883,14 @@ | |||
type: 'POST', | |||
data: data, | |||
success: function (res) { | |||
$('input[name="Engine_name"]').val(""); | |||
$('input[name="Engine"]').val(""); | |||
$('input[name="engine_name"]').val(""); | |||
$('input[name="engine"]').val(""); | |||
$('input[name="jobId"]').val(""); | |||
$('input[name="label"]').val(""); | |||
$('input[name="description"]').val(""); | |||
var cityObj = $("#modelSelectedFile"); | |||
cityObj.attr("value", ""); | |||
document.getElementById("formId").reset(); | |||
location.href = `/${userName}/${repoPath}/modelmanage/show_model` | |||
$('.ui.modal.second').modal('hide') | |||
}, | |||
@@ -624,24 +624,24 @@ | |||
<div class="required inline field"> | |||
<label>{{.i18n.Tr "repo.modelarts.train_job"}}</label> | |||
<input type="hidden" class="width83" id="JobId" name="JobId" readonly required> | |||
<input type="hidden" id="VersionName" name="VersionName" value="V0001"> | |||
<input type="hidden" class="width83" id="jobId" name="jobId" readonly required> | |||
<input type="hidden" id="versionName" name="versionName" value="V0001"> | |||
<input style="width: 45%;" id="JobName" readonly required> | |||
</div> | |||
<div class="required inline field" id="modelname"> | |||
<label>{{.i18n.Tr "repo.model.manage.model_name"}}</label> | |||
<input style="width: 45%;" id="name" name="Name" required maxlength="25" | |||
<input style="width: 45%;" id="name" name="name" required maxlength="25" | |||
onkeyup="this.value=this.value.replace(/[, ]/g,'')"> | |||
</div> | |||
<div class="required inline field" id="verionname"> | |||
<label>{{.i18n.Tr "repo.modelconvert.modelversion"}}</label> | |||
<input style="width: 45%;" id="version" name="Version" value="" readonly required maxlength="255"> | |||
<input style="width: 45%;" id="version" name="version" value="" readonly required maxlength="255"> | |||
</div> | |||
<div class="unite min_title inline field required"> | |||
<label>{{.i18n.Tr "repo.model.manage.engine"}}</label> | |||
<div class="ui dropdown selection search width70" id="choice_Engine"> | |||
<input type="hidden" id="Engine" name="Engine" required> | |||
<input type="hidden" id="engine" name="engine" required> | |||
<div class="default text">{{.i18n.Tr "repo.model.manage.select.engine"}}</div> | |||
<i class="dropdown icon"></i> | |||
<div class="menu" id="job-Engine"> | |||
@@ -669,12 +669,12 @@ | |||
</div> | |||
<div class="inline field"> | |||
<label>{{.i18n.Tr "repo.model.manage.modellabel"}}</label> | |||
<input style="width: 83%;margin-left: 7px;" id="label" name="Label" maxlength="255" | |||
<input style="width: 83%;margin-left: 7px;" id="label" name="label" maxlength="255" | |||
placeholder='{{.i18n.Tr "repo.modelarts.train_job.label_place"}}'> | |||
</div> | |||
<div class="inline field"> | |||
<label for="description">{{.i18n.Tr "repo.model.manage.modeldesc"}}</label> | |||
<textarea style="width: 83%;margin-left: 7px;" id="Description" name="Description" rows="3" | |||
<textarea style="width: 83%;margin-left: 7px;" id="description" name="description" rows="3" | |||
maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.new_place"}}' | |||
onchange="this.value=this.value.substring(0, 255)" | |||
onkeydown="this.value=this.value.substring(0, 255)" | |||
@@ -762,7 +762,6 @@ | |||
function showMenu() { | |||
var cityObj = $("#modelSelectedFile"); | |||
var cityOffset = $("#modelSelectedFile").offset(); | |||
//$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast"); | |||
$("#menuContent").slideDown("fast"); | |||
$("body").bind("mousedown", onBodyDown); | |||
} | |||
@@ -861,11 +860,10 @@ | |||
.modal({ | |||
centered: false, | |||
onShow: function () { | |||
$('input[name="Version"]').addClass('model_disabled') | |||
// $('input[name="JobId"]').text(obj.JobName) | |||
$('input[name="version"]').addClass('model_disabled') | |||
$('#JobName').val(obj.DisplayJobName).addClass('model_disabled') | |||
$('input[name="JobId"]').val(obj.JobID) | |||
$('input[name="VersionName"]').val("V0001") | |||
$('input[name="jobId"]').val(obj.JobID) | |||
$('input[name="versionName"]').val("V0001") | |||
if(obj.ComputeResource=="NPU"){ | |||
if (obj.EngineName != null && obj.EngineName != "") { | |||
@@ -873,16 +871,16 @@ | |||
srcEngine = srcEngine.trim().toLowerCase(); | |||
if (srcEngine == 'tensorflow') { | |||
$('#choice_Engine .default.text').text("TensorFlow"); | |||
$('#choice_Engine input[name="Engine"]').val(1) | |||
$('#choice_Engine input[name="engine"]').val(1) | |||
} | |||
if (srcEngine == 'mindspore') { | |||
$('#choice_Engine .default.text').text("MindSpore"); | |||
$('#choice_Engine input[name="Engine"]').val(2) | |||
$('#choice_Engine input[name="engine"]').val(2) | |||
} | |||
} | |||
}else{ | |||
$('#choice_Engine .default.text').text("PyTorch"); | |||
$('#choice_Engine input[name="Engine"]').val(0) | |||
$('#choice_Engine input[name="engine"]').val(0) | |||
} | |||
$('#choice_Engine .default.text').css({ "color": "rgb(0, 0, 0,0.87)" }) | |||
$('.ui.dimmer').css({ "background-color": "rgb(136, 136, 136,0.7)" }) | |||
@@ -890,9 +888,6 @@ | |||
loadSelectedModelFile(obj); | |||
}, | |||
onHide: function () { | |||
var cityObj = $("#modelSelectedFile"); | |||
cityObj.attr("value", ""); | |||
document.getElementById("formId").reset(); | |||
$('.ui.dimmer').css({ "background-color": "" }) | |||
$('.ui.error.message').text() | |||
$('.ui.error.message').css('display', 'none') | |||
@@ -914,8 +909,14 @@ | |||
type: 'POST', | |||
data: data, | |||
success: function (res) { | |||
$('input[name="Engine_name"]').val(""); | |||
$('input[name="Engine"]').val(""); | |||
$('input[name="engine_name"]').val(""); | |||
$('input[name="engine"]').val(""); | |||
$('input[name="jobId"]').val(""); | |||
$('input[name="label"]').val(""); | |||
$('input[name="description"]').val(""); | |||
var cityObj = $("#modelSelectedFile"); | |||
cityObj.attr("value", ""); | |||
document.getElementById("formId").reset(); | |||
location.href = `/${userName}/${repoPath}/modelmanage/show_model` | |||
$('.ui.modal.second').modal('hide') | |||
}, | |||
@@ -362,9 +362,7 @@ | |||
$('#model_name_version').empty() | |||
let html = '' | |||
nameMap[value].forEach(element => { | |||
let {TrainTaskInfo} = element | |||
TrainTaskInfo = JSON.parse(TrainTaskInfo) | |||
html += `<div class="item" data-label="${element.Label}" data-id="${element.ID}" data-value="${element.Path}">${element.Version}</div>` | |||
html += `<div class="item" data-label="${element.label}" data-id="${element.id}" data-value="${element.path}">${element.version}</div>` | |||
}); | |||
$('#model_name_version').append(html) | |||
$("#select_model_version").removeClass("loading") | |||
@@ -418,7 +416,7 @@ | |||
} | |||
function loadCheckpointList(value){ | |||
return new Promise((resolve,reject)=>{ | |||
$.get(`${RepoLink}/modelmanage/query_modelfile_for_predict`,{ID:value}, (data) => { | |||
$.get(`${RepoLink}/modelmanage/query_modelfile_for_predict`,{id:value}, (data) => { | |||
resolve(data) | |||
}) | |||
}) | |||
@@ -662,29 +662,29 @@ | |||
<div class="two inline fields "> | |||
<div class="required ten wide field"> | |||
<label>{{.i18n.Tr "repo.modelarts.train_job"}}</label> | |||
<input type="hidden" class="width83" id="JobId" name="JobId" readonly required> | |||
<input type="hidden" class="width83" id="jobId" name="jobId" readonly required> | |||
<input class="width83" id="JobName" readonly required> | |||
</div> | |||
<div class="required six widde field"> | |||
<label>{{.i18n.Tr "repo.model.manage.version"}}</label> | |||
<input class="width70" id="VersionName" name="VersionName" readonly required> | |||
<input class="width70" id="versionName" name="versionName" readonly required> | |||
</div> | |||
</div> | |||
<div class="required inline field" id="modelname"> | |||
<label>{{.i18n.Tr "repo.model.manage.model_name"}}</label> | |||
<input style="width: 45%;" id="name" name="Name" required maxlength="25" | |||
<input style="width: 45%;" id="name" name="name" required maxlength="25" | |||
onkeyup="this.value=this.value.replace(/[, ]/g,'')"> | |||
</div> | |||
<div class="required inline field" id="verionname"> | |||
<label>{{.i18n.Tr "repo.modelconvert.modelversion"}}</label> | |||
<input style="width: 45%;" id="version" name="Version" value="" readonly required maxlength="255"> | |||
<input style="width: 45%;" id="version" name="version" value="" readonly required maxlength="255"> | |||
</div> | |||
<div class="unite min_title inline field required"> | |||
<label>{{.i18n.Tr "repo.model.manage.engine"}}</label> | |||
<input type="hidden" id="Engine" name="Engine" required> | |||
<input style="width: 45%;" id="Engine_name" name="Engine_name" readonly required maxlength="255"> | |||
<input type="hidden" id="engine" name="engine" required> | |||
<input style="width: 45%;" id="engine_name" name="engine_name" readonly required maxlength="255"> | |||
</div> | |||
<div class="unite min_title inline fields required"> | |||
<div class="field required"> | |||
@@ -699,12 +699,12 @@ | |||
</div> | |||
<div class="inline field"> | |||
<label>{{.i18n.Tr "repo.model.manage.modellabel"}}</label> | |||
<input style="width: 83%;margin-left: 7px;" id="label" name="Label" maxlength="255" | |||
<input style="width: 83%;margin-left: 7px;" id="label" name="label" maxlength="255" | |||
placeholder='{{.i18n.Tr "repo.modelarts.train_job.label_place"}}'> | |||
</div> | |||
<div class="inline field"> | |||
<label for="description">{{.i18n.Tr "repo.model.manage.modeldesc"}}</label> | |||
<textarea style="width: 83%;margin-left: 7px;" id="Description" name="Description" rows="3" | |||
<textarea style="width: 83%;margin-left: 7px;" id="description" name="description" rows="3" | |||
maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.new_place"}}' | |||
onchange="this.value=this.value.substring(0, 255)" | |||
onkeydown="this.value=this.value.substring(0, 255)" | |||
@@ -726,7 +726,6 @@ | |||
</div> | |||
</div> | |||
</div> | |||
{{template "base/footer" .}} | |||
@@ -899,27 +898,23 @@ | |||
.modal({ | |||
centered: false, | |||
onShow: function () { | |||
$('input[name="Version"]').addClass('model_disabled') | |||
// $('input[name="JobId"]').text(obj.JobName) | |||
$('input[name="version"]').addClass('model_disabled') | |||
$('#JobName').val(obj.DisplayJobName).addClass('model_disabled') | |||
$('input[name="JobId"]').val(obj.JobID) | |||
$('input[name="VersionName"]').val(obj.VersionName).addClass('model_disabled') | |||
$('input[name="jobId"]').val(obj.JobID) | |||
$('input[name="versionName"]').val(obj.VersionName).addClass('model_disabled') | |||
if(obj.EngineID ==122 || obj.EngineID ==35 || obj.EngineID ==-1 || obj.EngineID ==37){ | |||
$('input[name="Engine_name"]').val("MindSpore").addClass('model_disabled'); | |||
$('input[name="Engine"]').val(2); | |||
$('input[name="engine_name"]').val("MindSpore").addClass('model_disabled'); | |||
$('input[name="engine"]').val(2); | |||
} | |||
if(obj.EngineID ==121 || obj.EngineID ==38){ | |||
$('input[name="Engine_name"]').val("TensorFlow").addClass('model_disabled'); | |||
$('input[name="Engine"]').val(1); | |||
$('input[name="engine_name"]').val("TensorFlow").addClass('model_disabled'); | |||
$('input[name="engine"]').val(1); | |||
} | |||
$('.ui.dimmer').css({ "background-color": "rgb(136, 136, 136,0.7)" }) | |||
createModelName(); | |||
loadSelectedModelFile(obj); | |||
}, | |||
onHide: function () { | |||
var cityObj = $("#modelSelectedFile"); | |||
cityObj.attr("value", ""); | |||
document.getElementById("formId").reset(); | |||
$('.ui.dimmer').css({ "background-color": "" }) | |||
$('.ui.error.message').text() | |||
$('.ui.error.message').css('display', 'none') | |||
@@ -940,8 +935,14 @@ | |||
type: 'POST', | |||
data: data, | |||
success: function (res) { | |||
$('input[name="Engine_name"]').val(""); | |||
$('input[name="Engine"]').val(""); | |||
$('input[name="engine_name"]').val(""); | |||
$('input[name="engine"]').val(""); | |||
$('input[name="jobId"]').val(""); | |||
$('input[name="label"]').val(""); | |||
$('input[name="description"]').val(""); | |||
var cityObj = $("#modelSelectedFile"); | |||
cityObj.attr("value", ""); | |||
document.getElementById("formId").reset(); | |||
location.href = `/${userName}/${repoPath}/modelmanage/show_model` | |||
$('.ui.modal.second').modal('hide') | |||
}, | |||
@@ -93,7 +93,7 @@ | |||
<div class="ui grid stackable item"> | |||
<div class="row"> | |||
<div class="three wide column padding0"> | |||
<a class="title" href="{{$.RepoLink}}/modelmanage/show_model_convert_info?ID={{.ID}}" title="{{.Name}}" style="font-size: 14px;"> | |||
<a class="title" href="{{$.RepoLink}}/modelmanage/show_model_convert_info?id={{.ID}}" title="{{.Name}}" style="font-size: 14px;"> | |||
<span class="fitted" style="width: 90%;vertical-align: middle;">{{.Name}}</span> | |||
</a> | |||
</div> | |||
@@ -141,7 +141,7 @@ | |||
</form> | |||
{{if .IsCanOper}} | |||
<a id="ai-download-{{.ID}}" href="{{$.Repository.HTMLURL}}/modelmanage/download_model_convert/{{.ID}}?AllDownload=true&a=1" class='ui basic {{if eq .Status "SUCCEEDED" "COMPLETED"}}blue {{else}}disabled {{end}}button' style="border-radius: .28571429rem;"> | |||
<a id="ai-download-{{.ID}}" href="{{$.Repository.HTMLURL}}/modelmanage/download_model_convert/{{.ID}}?allDownload=true&a=1" class='ui basic {{if eq .Status "SUCCEEDED" "COMPLETED"}}blue {{else}}disabled {{end}}button' style="border-radius: .28571429rem;"> | |||
{{$.i18n.Tr "repo.modelconvert.download"}} | |||
</a> | |||
{{else}} | |||
@@ -233,7 +233,7 @@ | |||
</div> | |||
<div class="ui dropdown selection search eight wide field" id="choice_version"> | |||
<input type="hidden" id="ModelVersion" name="ModelVersion" required> | |||
<input type="hidden" id="modelVersion" name="modelVersion" required> | |||
<div class="default text">{{$.i18n.Tr "repo.modelconvert.selectversion"}}</div> | |||
<i class="dropdown icon"></i> | |||
<div class="menu" id="model-version"> | |||
@@ -246,7 +246,7 @@ | |||
<label for="choice_file">{{$.i18n.Tr "repo.model.manage.modelfile"}}</label> | |||
</div> | |||
<div class="ui dropdown selection search eight wide field" id="choice_file"> | |||
<input type="hidden" id="ModelFile" name="ModelFile" required> | |||
<input type="hidden" id="modelFile" name="modelFile" required> | |||
<div class="default text">{{$.i18n.Tr "repo.modelconvert.selectmodelfile"}}</div> | |||
<i class="dropdown icon"></i> | |||
<div class="menu" id="model-file"> | |||
@@ -260,10 +260,10 @@ | |||
</div> | |||
<div class="unite min_title inline fields required"> | |||
<div class="three wide field right aligned"> | |||
<label for="SrcEngine">{{$.i18n.Tr "repo.modelconvert.srcengine"}}</label> | |||
<label for="srcEngine">{{$.i18n.Tr "repo.modelconvert.srcengine"}}</label> | |||
</div> | |||
<select id="SrcEngine" class="ui search dropdown eight wide field" placeholder="" style='color:#000000;' name="SrcEngine" onchange="javascript:srcEngineChanged()"> | |||
<select id="srcEngine" class="ui search dropdown eight wide field" placeholder="" style='color:#000000;' name="srcEngine" onchange="javascript:srcEngineChanged()"> | |||
</select> | |||
</div> | |||
@@ -289,30 +289,30 @@ | |||
<div class="unite min_title inline fields required"> | |||
<div class="three wide field right aligned"> | |||
<label for="DestFormat">{{$.i18n.Tr "repo.modelconvert.outputformat"}}</label> | |||
<label for="destFormat">{{$.i18n.Tr "repo.modelconvert.outputformat"}}</label> | |||
</div> | |||
<select id="DestFormat" class="ui search dropdown eight wide field" placeholder="" style='width:50%' name="DestFormat"> | |||
<select id="destFormat" class="ui search dropdown eight wide field" placeholder="" style='width:50%' name="destFormat"> | |||
</select> | |||
</div> | |||
<div class="unite min_title inline fields"> | |||
<div class="three wide field right aligned"> | |||
<label for="NetOutputFormat">{{$.i18n.Tr "repo.modelconvert.netoutputdata"}} </label> | |||
<label for="netOutputFormat">{{$.i18n.Tr "repo.modelconvert.netoutputdata"}} </label> | |||
</div> | |||
<select id="NetOutputFormat" class="ui search dropdown eight wide field" placeholder="" style='width:50%' name="NetOutputFormat"> | |||
<select id="netOutputFormat" class="ui search dropdown eight wide field" placeholder="" style='width:50%' name="netOutputFormat"> | |||
</select> | |||
</div> | |||
<div class="unite min_title inline fields"> | |||
<div class="three wide field right aligned"> | |||
<label for="Description">{{$.i18n.Tr "repo.modelconvert.taskdesc"}} </label> | |||
<label for="description">{{$.i18n.Tr "repo.modelconvert.taskdesc"}} </label> | |||
</div> | |||
<div class="twelve wide field"> | |||
<textarea id="Description" name="Description" rows="1" maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.new_place"}}' onchange="this.value=this.value.substring(0, 255)" onkeydown="this.value=this.value.substring(0, 255)" onkeyup="this.value=this.value.substring(0, 256)"></textarea> | |||
<textarea id="description" name="description" rows="1" maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.new_place"}}' onchange="this.value=this.value.substring(0, 255)" onkeydown="this.value=this.value.substring(0, 255)" onkeyup="this.value=this.value.substring(0, 256)"></textarea> | |||
</div> | |||
</div> | |||
<div class="unite min_title inline field"> | |||
@@ -364,9 +364,9 @@ | |||
$("#task_name").removeClass("error") | |||
} | |||
data['desc']= $('#Description').val() | |||
data['modelId'] = $('#ModelVersion').val() | |||
data['SrcEngine'] = $('#SrcEngine').val(); | |||
data['desc']= $('#description').val() | |||
data['modelId'] = $('#modelVersion').val() | |||
data['srcEngine'] = $('#srcEngine').val(); | |||
data['inputshape']= $('#inputshape').val(); | |||
if(inputshapeNotValid(data['inputshape'])){ | |||
@@ -379,10 +379,10 @@ | |||
} | |||
data['inputdataformat']= $('#inputdataformat').val(); | |||
data['DestFormat'] = $('#DestFormat').val(); | |||
data['NetOutputFormat']= $('#NetOutputFormat').val(); | |||
data['ModelFile'] = $('#ModelFile').val(); | |||
if(data['ModelFile']==""){ | |||
data['destFormat'] = $('#destFormat').val(); | |||
data['netOutputFormat']= $('#netOutputFormat').val(); | |||
data['modelFile'] = $('#modelFile').val(); | |||
if(data['modelFile']==""){ | |||
$('.ui.error.message').text("{{.i18n.Tr "repo.modelconvert.modelfileempty"}}") | |||
$('.ui.error.message').css('display','block') | |||
$("#ModelFile_Div").addClass("error") | |||
@@ -392,11 +392,11 @@ | |||
} | |||
$.post(`${repolink}/modelmanage/create_model_convert`,data,(result) => { | |||
console.log("result=" + result); | |||
if(result.result_code ==0){ | |||
if(result.code ==0){ | |||
$('.ui.modal.second').modal('hide'); | |||
window.location.reload(); | |||
}else{ | |||
$('.ui.error.message').text(result.message) | |||
$('.ui.error.message').text(result.msg) | |||
$('.ui.error.message').css('display','block') | |||
} | |||
}) | |||
@@ -456,7 +456,7 @@ | |||
$('#choice_version').dropdown({ | |||
onChange:function(value){ | |||
console.log("model version:" + value); | |||
$('#choice_version input[name="ModelVersion"]').val(value) | |||
$('#choice_version input[name="modelVersion"]').val(value) | |||
loadModelFile(value); | |||
} | |||
}) | |||
@@ -464,26 +464,26 @@ | |||
$('#choice_file').dropdown({ | |||
onChange:function(value){ | |||
console.log("model file:" + value); | |||
$('#choice_file input[name="ModelFile"]').val(value) | |||
$('#choice_file input[name="modelFile"]').val(value) | |||
} | |||
}) | |||
}) | |||
function srcEngineChanged(){ | |||
var ele = window.document.getElementById("SrcEngine"); | |||
var ele = window.document.getElementById("srcEngine"); | |||
var index=ele.selectedIndex; | |||
var options=ele.options; | |||
var option = options[index]; | |||
console.log("SrcEngine value=" + option); | |||
console.log("srcEngine value=" + option); | |||
let destFormatHtml = "<option name=\"ONNX\" value=\"0\">ONNX</option>"; | |||
let netOutputFormatHtml = "<option name=\"FP32\" value=\"0\">FP32</option>"; | |||
if(option==null || option =="undefined" || option.value == 0){ | |||
destFormatHtml += "<option name=\"TensorRT\" value=\"1\">TensorRT</option>" | |||
netOutputFormatHtml += "<option name=\"FP16\" value=\"1\">FP16</option>"; | |||
} | |||
$('#DestFormat').html(destFormatHtml); | |||
$('#NetOutputFormat').html(netOutputFormatHtml); | |||
$('#destFormat').html(destFormatHtml); | |||
$('#netOutputFormat').html(netOutputFormatHtml); | |||
} | |||
function loadModelList(){ | |||
@@ -509,7 +509,7 @@ | |||
if(modelId ==null || modelId ==""){ | |||
console.log("modelId is null"); | |||
}else{ | |||
$.get(`${repolink}/modelmanage/query_modelfile_for_predict?ID=${modelId}`, (data) => { | |||
$.get(`${repolink}/modelmanage/query_modelfile_for_predict?id=${modelId}`, (data) => { | |||
const n_length = data.length | |||
let file_html='' | |||
let firstFileName ='' | |||
@@ -526,7 +526,7 @@ | |||
} | |||
$("#model-file").append(file_html) | |||
$('#choice_file .default.text').text(firstFileName) | |||
$('#choice_file input[name="ModelFile"]').val(firstFileName) | |||
$('#choice_file input[name="modelFile"]').val(firstFileName) | |||
}) | |||
} | |||
@@ -550,19 +550,19 @@ | |||
n_length = versionList.length | |||
let train_html='' | |||
for (let i=0;i<n_length;i++){ | |||
train_html += `<div class="item" data-value="${versionList[i].ID}">${versionList[i].Version}</div>` | |||
train_html += `<div class="item" data-value="${versionList[i].id}">${versionList[i].version}</div>` | |||
train_html += '</div>' | |||
} | |||
$("#model-version").append(train_html) | |||
$('#choice_version .default.text').text(versionList[0].Version) | |||
$('#choice_version input[name="ModelVersion"]').val(versionList[0].ID) | |||
loadModelFile(versionList[0].ID); | |||
$('#choice_version .default.text').text(versionList[0].version) | |||
$('#choice_version input[name="modelVersion"]').val(versionList[0].id) | |||
loadModelFile(versionList[0].id); | |||
} | |||
setEngineValue(value); | |||
} | |||
function setEngineValue(value){ | |||
$('#SrcEngine').dropdown('clear'); | |||
$('#srcEngine').dropdown('clear'); | |||
console.log("setEngineValue value=" + value); | |||
let html = "" | |||
html +="<option name=\"PyTorch\" " + getSelected(0,value) + " value=\"0\">PyTorch</option>"; | |||
@@ -580,13 +580,13 @@ | |||
let nameMap = modelData.nameMap | |||
let versionList = nameMap[modelName] | |||
if(versionList != null && versionList.length >0){ | |||
if(versionList[0].Engine == engineOption){ | |||
if(versionList[0].engine == engineOption){ | |||
return "selected=\"selected\""; | |||
}else{ | |||
if((versionList[0].Engine==122 || versionList[0].Engine==37) && engineOption==2){ | |||
if((versionList[0].engine==122 || versionList[0].engine==37) && engineOption==2){ | |||
return "selected=\"selected\""; | |||
} | |||
if((versionList[0].Engine==121 || versionList[0].Engine==38) && engineOption==1){ | |||
if((versionList[0].engine==121 || versionList[0].engine==38) && engineOption==1){ | |||
return "selected=\"selected\""; | |||
} | |||
} | |||
@@ -138,20 +138,20 @@ | |||
<input type="hidden" name="_csrf" value=""> | |||
<div class="inline fields"> | |||
<div class="required two wide field right aligned"> | |||
<label for="JobId">{{.i18n.Tr "repo.model.manage.select.trainjob"}}</label> | |||
<label for="jobId">{{.i18n.Tr "repo.model.manage.select.trainjob"}}</label> | |||
</div> | |||
<div class="required thirteen wide inline field"> | |||
<div class="ui dropdown selection search loading" id="choice_model"> | |||
<input type="hidden" id="JobId" name="JobId" required> | |||
<input type="hidden" id="jobId" name="jobId" required> | |||
<div class="default text">{{.i18n.Tr "repo.model.manage.select.trainjob"}}</div> | |||
<i class="dropdown icon"></i> | |||
<div class="menu" id="job-name"> | |||
</div> | |||
</div> | |||
<label for="VersionName">{{.i18n.Tr "repo.model.manage.version"}}</label> | |||
<label for="versionName">{{.i18n.Tr "repo.model.manage.version"}}</label> | |||
<span> </span> | |||
<div class="ui dropdown selection search" id="choice_version"> | |||
<input type="hidden" id="VersionName" name="VersionName" required> | |||
<input type="hidden" id="versionName" name="versionName" required> | |||
<div class="default text">{{.i18n.Tr "repo.model.manage.select.version"}}</div> | |||
<i class="dropdown icon"></i> | |||
<div class="menu" id="job-version"> | |||
@@ -162,18 +162,18 @@ | |||
</div> | |||
<div class="required inline fields" id="modelname"> | |||
<div class="two wide field right aligned"> | |||
<label for="Name">{{.i18n.Tr "repo.model.manage.model_name"}}</label> | |||
<label for="name">{{.i18n.Tr "repo.model.manage.model_name"}}</label> | |||
</div> | |||
<div class="eight wide field"> | |||
<input id="name" name="Name" required maxlength="25" onkeyup="this.value=this.value.replace(/[, ]/g,'')"> | |||
<input id="name" name="name" required maxlength="25" onkeyup="this.value=this.value.replace(/[, ]/g,'')"> | |||
</div> | |||
</div> | |||
<div class="required inline fields" id="verionname"> | |||
<div class="required inline fields" id="verionName"> | |||
<div class="two wide field right aligned"> | |||
<label for="Version">{{.i18n.Tr "repo.model.manage.version"}}</label> | |||
<label for="version">{{.i18n.Tr "repo.model.manage.version"}}</label> | |||
</div> | |||
<div class="eight wide field"> | |||
<input id="version" name="Version" value="" readonly required maxlength="255"> | |||
<input id="version" name="version" value="" readonly required maxlength="255"> | |||
</div> | |||
</div> | |||
@@ -182,7 +182,7 @@ | |||
<label for="Engine">{{.i18n.Tr "repo.model.manage.engine"}}</label> | |||
</div> | |||
<div class="ui ten wide field dropdown selection search" id="choice_Engine"> | |||
<input type="hidden" id="Engine" name="Engine" required> | |||
<input type="hidden" id="engine" name="engine" required> | |||
<div class="default text newtext">{{.i18n.Tr "repo.model.manage.select.engine"}}</div> | |||
<i class="dropdown icon"></i> | |||
<div class="menu" id="job-Engine"> | |||
@@ -209,7 +209,7 @@ | |||
<label for="Label">{{.i18n.Tr "repo.model.manage.modellabel"}}  </label> | |||
</div> | |||
<div class="thirteen wide field"> | |||
<input id="label" name="Label" maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.label_place"}}'> | |||
<input id="label" name="label" maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.label_place"}}'> | |||
</div> | |||
</div> | |||
<div class="inline fields"> | |||
@@ -217,7 +217,7 @@ | |||
<label for="description">{{.i18n.Tr "repo.model.manage.modeldesc"}}  </label> | |||
</div> | |||
<div class="thirteen wide field"> | |||
<textarea id="Description" name="Description" rows="3" | |||
<textarea id="description" name="description" rows="3" | |||
maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.new_place"}}' | |||
onchange="this.value=this.value.substring(0, 255)" | |||
onkeydown="this.value=this.value.substring(0, 255)" | |||
@@ -331,7 +331,7 @@ | |||
centered: false, | |||
onShow: function () { | |||
$('#model_header').text({{.i18n.Tr "repo.model.manage.import_new_model"}}) | |||
$('input[name="Version"]').addClass('model_disabled') | |||
$('input[name="version"]').addClass('model_disabled') | |||
$('.ui.dimmer').css({ "background-color": "rgb(136, 136, 136,0.7)" }) | |||
$("#job-name").empty() | |||
createModelName() | |||
@@ -368,7 +368,7 @@ | |||
console.log("model version:" + value); | |||
if (modelData != null) { | |||
for (var i = 0; i < modelData.length; i++) { | |||
if (modelData[i].VersionName == value) { | |||
if (modelData[i].versionName == value) { | |||
setEngine(modelData[i]) | |||
loadModelFile(modelData[i]) | |||
break; | |||
@@ -406,7 +406,7 @@ | |||
$("#job-name").append(train_html) | |||
$("#choice_model").removeClass("loading") | |||
$('#choice_model .default.text').text(data[0].DisplayJobName) | |||
$('#choice_model input[name="JobId"]').val(data[0].JobID) | |||
$('#choice_model input[name="jobId"]').val(data[0].JobID) | |||
loadTrainVersion() | |||
}else{ | |||
$("#choice_model").removeClass("loading") | |||
@@ -414,8 +414,9 @@ | |||
}) | |||
} | |||
function loadTrainVersion(value) { | |||
let JobID = !value ? $('#choice_model input[name="JobId"]').val() : value | |||
$.get(`${repolink}/modelmanage/query_train_job_version?JobID=${JobID}`, (data) => { | |||
let tmp = $('#choice_model input[name="jobId"]').val(); | |||
let jobId = !value ? $('#choice_model input[name="jobId"]').val() : value | |||
$.get(`${repolink}/modelmanage/query_train_job_version?jobId=${jobId}`, (data) => { | |||
const n_length = data.length | |||
let train_html = ''; | |||
modelData = data; | |||
@@ -431,7 +432,7 @@ | |||
versionName = "V0001"; | |||
} | |||
$('#choice_version .default.text').text(versionName) | |||
$('#choice_version input[name="VersionName"]').val(versionName) | |||
$('#choice_version input[name="versionName"]').val(versionName) | |||
setEngine(data[0]) | |||
loadModelFile(data[0]) | |||
} | |||
@@ -453,7 +454,9 @@ | |||
type=0; | |||
} | |||
} | |||
$.get(`${repolink}/modelmanage/query_train_model?jobName=${trainJob.JobName}&type=${type}&VersionName=${trainJob.VersionName}`, (data) => { | |||
$.get(`${repolink}/modelmanage/query_train_model?jobName=${trainJob.JobName}&type=${type}&versionName=${trainJob.VersionName}`, (data) => { | |||
var cityObj = $("#modelSelectedFile"); | |||
cityObj.attr("value", ""); | |||
const n_length = data.length | |||
let file_html='' | |||
let firstFileName ='' | |||
@@ -518,12 +521,12 @@ | |||
} | |||
} | |||
} | |||
function setEngine(modelVersion) { | |||
console.log("modelVersion=" + modelVersion); | |||
function setEngine(trainJob) { | |||
console.log("trainJob=" + trainJob); | |||
$('#choice_Engine').dropdown('clear') | |||
$("#job-Engine").empty() | |||
if (modelVersion.EngineName != null && modelVersion.EngineName != "") { | |||
srcEngine = modelVersion.EngineName.split('-')[0] | |||
if (trainJob.EngineName != null && trainJob.EngineName != "") { | |||
srcEngine = trainJob.EngineName.split('-')[0] | |||
srcEngine = srcEngine.trim().toLowerCase(); | |||
let selectedText = "PyTorch"; | |||
let selectedValue = 0; | |||
@@ -548,7 +551,7 @@ | |||
itemHtml += "<option class=\"item\" data-value=\"3\">Other</option>" | |||
$('#choice_Engine .default.text').text(selectedText) | |||
$('#choice_Engine input[name="Engine"]').val(selectedValue) | |||
$('#choice_Engine input[name="engine"]').val(selectedValue) | |||
$("#job-Engine").append(itemHtml); | |||
$("#choice_Engine").removeClass('disabled'); | |||
} else { | |||
@@ -560,10 +563,9 @@ | |||
itemHtml += "<option class=\"item\" data-value=\"6\">MXNet</option>" | |||
itemHtml += "<option class=\"item\" data-value=\"3\">Other</option>" | |||
$('#choice_Engine .default.text').text("PyTorch"); | |||
$('#choice_Engine input[name="Engine"]').val(0) | |||
$('#choice_Engine input[name="engine"]').val(0) | |||
$("#job-Engine").append(itemHtml); | |||
$("#choice_Engine").removeClass('disabled'); | |||
} | |||
} | |||
</script> |
@@ -91,16 +91,16 @@ | |||
<tbody> | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.model.manage.model_name"}}</td> | |||
<td class="ti-text-form-content word-elipsis"><span id="ModelName" title=""></span></td> | |||
<td class="ti-text-form-content word-elipsis"><span id="modelName" title=""></span></td> | |||
</tr> | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.model.manage.version"}}</td> | |||
<td class="ti-text-form-content word-elipsis"><span id="Version" title=""></span></td> | |||
<td class="ti-text-form-content word-elipsis"><span id="version" title=""></span></td> | |||
</tr> | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.migrate_items_labels"}}</td> | |||
<td class="ti-text-form-content"> | |||
<div id="Label" style="overflow: hidden;width: 95%;"> | |||
<div id="label" style="overflow: hidden;width: 95%;"> | |||
</div> | |||
@@ -109,17 +109,17 @@ | |||
</tr> | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.model_size"}}</td> | |||
<td class="ti-text-form-content word-elipsis"><span id="Size" title=""></span></td> | |||
<td class="ti-text-form-content word-elipsis"><span id="size" title=""></span></td> | |||
</tr> | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.createtime"}}</td> | |||
<td class="ti-text-form-content word-elipsis"><span id="CreateTime" title=""></span></td> | |||
<td class="ti-text-form-content word-elipsis"><span id="createTime" title=""></span></td> | |||
</tr> | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.model.manage.description"}}</td> | |||
<td class="ti-text-form-content" > | |||
<div id="edit-td" style="display:flex"> | |||
<span id="Description" title="" class="iword-elipsis"></span> | |||
<span id="description" title="" class="iword-elipsis"></span> | |||
<i id="edit-pencil" data-id="" data-desc="" class="pencil alternate icon" style="cursor:pointer;vertical-align: top;" id="editor" onclick="editorFn(this)"></i> | |||
</div> | |||
</td> | |||
@@ -127,38 +127,38 @@ | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job"}}</td> | |||
<td class="ti-text-form-content word-elipsis"> | |||
<a id="DisplayJobNameHref" class="title" style="font-size: 14px;" target="_blank"> | |||
<span id="DisplayJobName" class="fitted" style="width: 90%;vertical-align: middle;"></span> | |||
<a id="displayJobNameHref" class="title" style="font-size: 14px;" target="_blank"> | |||
<span id="displayJobName" class="fitted" style="width: 90%;vertical-align: middle;"></span> | |||
</a> | |||
</td> | |||
</tr> | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.code_version"}}</td> | |||
<td class="ti-text-form-content word-elipsis"><span id="CodeBranch" title=""></span></td> | |||
<td class="ti-text-form-content word-elipsis"><span id="codeBranch" title=""></span></td> | |||
</tr> | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.start_file"}}</td> | |||
<td class="ti-text-form-content word-elipsis"><span id="BootFile" title=""></span></td> | |||
<td class="ti-text-form-content word-elipsis"><span id="bootFile" title=""></span></td> | |||
</tr> | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.train_dataset"}}</td> | |||
<td class="ti-text-form-content word-elipsis"><span id="DatasetName" title=""></span></td> | |||
<td class="ti-text-form-content word-elipsis"><span id="datasetName" title=""></span></td> | |||
</tr> | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.run_parameter"}}</td> | |||
<td class="ti-text-form-content word-elipsis"><span id="Parameters" title=""></span></td> | |||
<td class="ti-text-form-content word-elipsis"><span id="parameters" title=""></span></td> | |||
</tr> | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.AI_Engine"}}</td> | |||
<td class="ti-text-form-content word-elipsis"><span id="EngineName" title=""></span></td> | |||
<td class="ti-text-form-content word-elipsis"><span id="engineName" title=""></span></td> | |||
</tr> | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.standard"}}</td> | |||
<td class="ti-text-form-content word-elipsis"><span id="FlavorName" title=""></span></td> | |||
<td class="ti-text-form-content word-elipsis"><span id="flavorName" title=""></span></td> | |||
</tr> | |||
<tr> | |||
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.compute_node"}}</td> | |||
<td class="ti-text-form-content word-elipsis"><span id="WorkServerNumber" title=""></span></td> | |||
<td class="ti-text-form-content word-elipsis"><span id="workServerNumber" title=""></span></td> | |||
</tr> | |||
</tbody> | |||
</table> | |||
@@ -214,47 +214,47 @@ $(document).ready(loadInfo); | |||
function changeInfo(version){ | |||
$.get(`${url}show_model_info_api?name=${ID}`,(data)=>{ | |||
let versionData = data.filter((item)=>{ | |||
return item.Version === version | |||
return item.version === version | |||
}) | |||
let returnArray = [] | |||
returnArray = transObj(versionData) | |||
let [initObj,initModelAcc,id] = returnArray | |||
editorCancel('','') | |||
renderInfo(initObj,initModelAcc,id) | |||
loadModelFile(versionData[0].ID,versionData[0].Version,'','','init') | |||
loadModelFile(versionData[0].id,versionData[0].version,'','','init') | |||
}) | |||
} | |||
function loadInfo(){ | |||
$.get(`${url}show_model_info_api?name=${ID}`,(data)=>{ | |||
let html = '' | |||
for (let i=0;i<data.length;i++){ | |||
if(!data[i].IsCanOper){ | |||
if(!data[i].isCanOper){ | |||
$("#edit-pencil").css("display","none") | |||
} | |||
html += `<option value="${data[i].Version}">${data[i].Version}</option>` | |||
html += `<option value="${data[i].version}">${data[i].version}</option>` | |||
} | |||
$('#dropdown').append(html) | |||
let returnArray = [] | |||
returnArray = transObj(data) | |||
let [initObj,initModelAcc,id] = returnArray | |||
renderInfo(initObj,initModelAcc,id) | |||
loadModelFile(data[0].ID,data[0].Version,'','','init') | |||
loadModelFile(data[0].id,data[0].version,'','','init') | |||
}) | |||
} | |||
function getEngineName(model){ | |||
if(model.Engine == 0){ | |||
if(model.engine == 0){ | |||
return "PyTorch"; | |||
}else if(model.Engine == 1 || model.Engine == 121 || model.Engine == 38){ | |||
}else if(model.engine == 1 || model.engine == 121 || model.engine == 38){ | |||
return "TensorFlow"; | |||
}else if(model.Engine == 2 || model.Engine == 122 || model.Engine == 35 || model.Engine == 37){ | |||
}else if(model.engine == 2 || model.engine == 122 || model.engine == 35 || model.engine == 37){ | |||
return "MindSpore"; | |||
}else if(model.Engine == 3){ | |||
}else if(model.engine == 3){ | |||
return "Other"; | |||
}else if(model.Engine == 4){ | |||
}else if(model.engine == 4){ | |||
return "PaddlePaddle"; | |||
}else if(model.Engine == 5){ | |||
}else if(model.engine == 5){ | |||
return "OneFlow"; | |||
}else if(model.Engine == 6){ | |||
}else if(model.engine == 6){ | |||
return "MXNet"; | |||
} | |||
else{ | |||
@@ -262,36 +262,34 @@ function loadInfo(){ | |||
} | |||
} | |||
function transObj(data){ | |||
let {ID,Name,Version,Label,Size,Description,CreatedUnix,Accuracy,CodeBranch,CodeCommitID,TrainTaskInfo} = data[0] | |||
let modelAcc = JSON.parse(Accuracy) | |||
TrainTaskInfo = JSON.parse(TrainTaskInfo) | |||
// Parameters = JSON.parse(Parameters) | |||
let {Parameters} = TrainTaskInfo | |||
let EngineName = getEngineName(data[0]) | |||
Parameters = JSON.parse(Parameters) | |||
Parameters = Parameters.parameter.length === 0 ? '--':Parameters.parameter | |||
let size = tranSize(Size) | |||
let time = transTime(CreatedUnix) | |||
let {id,name,version,label,size,description,createdUnix,accuracy,codeBranch,codeCommitID,trainTaskInfo} = data[0] | |||
let modelAcc = JSON.parse(accuracy) | |||
trainTaskInfo = JSON.parse(trainTaskInfo) | |||
let engineName = getEngineName(data[0]) | |||
parameters = JSON.parse(trainTaskInfo.Parameters) | |||
parameters = parameters.parameter.length === 0 ? '--':parameters.parameter | |||
size = tranSize(size) | |||
let time = transTime(createdUnix) | |||
let initObj = { | |||
ModelName:Name || '--', | |||
Version:Version, | |||
Label:Label || '--', | |||
Size:size, | |||
CreateTime:time, | |||
Description:Description || '--', | |||
CodeBranch:CodeBranch || '--', | |||
CodeCommitID:CodeCommitID || '--', | |||
BootFile:TrainTaskInfo.BootFile || '--', | |||
DatasetName:TrainTaskInfo.DatasetName || '--', | |||
Parameters:TrainTaskInfo.Parameters || '--', | |||
FlavorName:TrainTaskInfo.FlavorName || '--', | |||
WorkServerNumber:TrainTaskInfo.WorkServerNumber || '1', | |||
Parameters:Parameters, | |||
EngineName:EngineName, | |||
DisplayJobName:TrainTaskInfo.DisplayJobName || '--', | |||
TrainJobVersionName:TrainTaskInfo.VersionName || '', | |||
CloudBrainJobID:TrainTaskInfo.JobID|| '', | |||
CloudBrainType:TrainTaskInfo.Type, | |||
modelName:name || '--', | |||
version:version, | |||
label:label || '--', | |||
size:size, | |||
createTime:time, | |||
description:description || '--', | |||
codeBranch:codeBranch || '--', | |||
codeCommitID:codeCommitID || '--', | |||
bootFile:trainTaskInfo.BootFile || '--', | |||
datasetName:trainTaskInfo.DatasetName || '--', | |||
parameters:trainTaskInfo.Parameters || '--', | |||
flavorName:trainTaskInfo.FlavorName || '--', | |||
workServerNumber:trainTaskInfo.WorkServerNumber || '--', | |||
parameters:parameters, | |||
engineName:engineName, | |||
displayJobName:trainTaskInfo.DisplayJobName || '--', | |||
trainJobVersionName:trainTaskInfo.VersionName || '', | |||
cloudBrainJobID:trainTaskInfo.JobID|| '', | |||
cloudBrainType:trainTaskInfo.Type, | |||
} | |||
let initModelAcc = { | |||
Accuracy: modelAcc.Accuracy || '--', | |||
@@ -299,7 +297,7 @@ function transObj(data){ | |||
Precision:modelAcc.Precision || '--', | |||
Recall: modelAcc.Recall || '--' | |||
} | |||
return [initObj,initModelAcc,ID] | |||
return [initObj,initModelAcc,id] | |||
} | |||
function transTime(time){ | |||
@@ -338,8 +336,8 @@ function editorSure(text,id){ | |||
let description=$('#textarea-value').val() | |||
let sourcetext = $('#textarea-value').val().replace(/\n/g,'enter;') | |||
let data = { | |||
ID:id, | |||
Description:description | |||
id:id, | |||
description:description | |||
} | |||
$.ajax({ | |||
url:`${url}modify_model`, | |||
@@ -351,14 +349,14 @@ function editorSure(text,id){ | |||
} | |||
function renderInfo(obj,accObj,id){ | |||
for(let key in obj){ | |||
if(key==="Description"){ | |||
if(key==="description"){ | |||
let descriptionText=obj[key].replace(/\r\n|\n/g,'enter;') | |||
$(`#${key}`).text(obj[key]) | |||
$(`#${key}`).attr("title",obj[key]) | |||
$('#edit-pencil').attr("data-id",id) | |||
$('#edit-pencil').attr("data-desc",descriptionText) | |||
} | |||
else if(key==="Label"){ | |||
else if(key==="label"){ | |||
$('#Label').empty() | |||
if(obj[key]==='--'){ | |||
$('#Label').text(obj[key]) | |||
@@ -372,33 +370,33 @@ function renderInfo(obj,accObj,id){ | |||
$('#Label').append(html) | |||
} | |||
} | |||
else if(key==="CodeCommitID"){ | |||
else if(key==="codeCommitID"){ | |||
let codeCommit = obj[key].slice(0,10) | |||
let html = `<a style="margin-left:1rem" class="ui label" title="${codeCommit}">${codeCommit}</a>` | |||
$('#CodeBranch').append(html) | |||
} | |||
else if(key==="DisplayJobName"){ | |||
let type=obj["CloudBrainType"] | |||
else if(key==="displayJobName"){ | |||
let type=obj["cloudBrainType"] | |||
let href="" | |||
if(type==1){ | |||
href=trainJobUrl + "modelarts/train-job/" + obj["CloudBrainJobID"] | |||
href=trainJobUrl + "modelarts/train-job/" + obj["cloudBrainJobID"] | |||
}else if(type==0){ | |||
href=trainJobUrl + "cloudbrain/train-job/" + obj["CloudBrainJobID"] | |||
href=trainJobUrl + "cloudbrain/train-job/" + obj["cloudBrainJobID"] | |||
}else if(type==2){ | |||
href=trainJobUrl + "grampus/train-job/" + obj["CloudBrainJobID"] | |||
} | |||
$(`#DisplayJobNameHref`).attr("href",href) | |||
$(`#DisplayJobNameHref`).attr("title",obj[key]) | |||
$(`#displayJobNameHref`).attr("href",href) | |||
$(`#displayJobNameHref`).attr("title",obj[key]) | |||
$(`#${key}`).text(obj[key]) | |||
let versionName = obj["TrainJobVersionName"] | |||
let versionName = obj["trainJobVersionName"] | |||
if(versionName!=""){ | |||
let html = `<span style="margin-left:1rem" class="ui label">${versionName}</span>` | |||
$('#DisplayJobName').append(html) | |||
$('#displayJobName').append(html) | |||
} | |||
} | |||
else if(key==="Parameters"){ | |||
else if(key==="parameters"){ | |||
if(obj[key]==='--'){ | |||
$(`#${key}`).text(obj[key]) | |||
}else{ | |||
@@ -13,7 +13,7 @@ | |||
:header-cell-style="tableHeaderStyle" | |||
> | |||
<el-table-column | |||
prop="Name" | |||
prop="name" | |||
:label="i18n.model_name" | |||
align="left" | |||
min-width="17%" | |||
@@ -25,105 +25,105 @@ | |||
<!-- <i class="el-icon-time"></i> --> | |||
<a | |||
class="text-over" | |||
:href="showinfoHref + scope.row.Name" | |||
:title="scope.row.Name" | |||
>{{ scope.row.Name }}</a | |||
:href="showinfoHref + scope.row.name" | |||
:title="scope.row.name" | |||
>{{ scope.row.name }}</a | |||
> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="Status" | |||
prop="status" | |||
:label="i18n.model_status" | |||
align="center" | |||
min-width="6.5%" | |||
> | |||
<template slot-scope="scope"> | |||
<span class="text-over" :title="scope.row.Status_title"> | |||
<i style="vertical-align: middle" :class="scope.row.Status"></i | |||
<span class="text-over" :title="scope.row.status_title"> | |||
<i style="vertical-align: middle" :class="scope.row.status"></i | |||
></span> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="Version" | |||
prop="version" | |||
:label="i18n.model_version" | |||
align="center" | |||
min-width="6%" | |||
> | |||
<template slot-scope="scope"> | |||
<span class="text-over" :title="scope.row.Version">{{ | |||
scope.row.Version | |||
<span class="text-over" :title="scope.row.version">{{ | |||
scope.row.version | |||
}}</span> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="VersionCount" | |||
prop="versionCount" | |||
:label="i18n.model_version_num" | |||
align="center" | |||
min-width="7%" | |||
> | |||
<template slot-scope="scope"> | |||
<span class="text-over" :title="scope.row.VersionCount">{{ | |||
scope.row.VersionCount | |||
<span class="text-over" :title="scope.row.versionCount">{{ | |||
scope.row.versionCount | |||
}}</span> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="Size" | |||
prop="size" | |||
:label="i18n.model_size" | |||
align="center" | |||
min-width="10%" | |||
> | |||
<template slot-scope="scope"> | |||
<span class="text-over">{{ renderSize(scope.row.Size) }}</span> | |||
<span class="text-over">{{ renderSize(scope.row.size) }}</span> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="EngineName" | |||
prop="engineName" | |||
:label="i18n.model_egine" | |||
align="center" | |||
min-width="8%" | |||
> | |||
<template slot-scope="scope"> | |||
<span class="text-over" :title="scope.row.EngineName">{{ | |||
scope.row.EngineName | |||
<span class="text-over" :title="scope.row.engineName">{{ | |||
scope.row.engineName | |||
}}</span> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="ComputeResource" | |||
prop="computeResource" | |||
:label="i18n.model_compute_resource" | |||
align="center" | |||
min-width="8%" | |||
> | |||
<template slot-scope="scope"> | |||
<span class="text-over">{{ scope.row.ComputeResource }}</span> | |||
<span class="text-over">{{ scope.row.computeResource }}</span> | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="CreatedUnix" | |||
prop="createdUnix" | |||
:label="i18n.model_create_time" | |||
align="center" | |||
min-width="13.75%" | |||
> | |||
<template slot-scope="scope"> | |||
{{ transTime(scope.row.CreatedUnix) }} | |||
{{ transTime(scope.row.createdUnix) }} | |||
</template> | |||
</el-table-column> | |||
<el-table-column | |||
prop="UserName" | |||
prop="userName" | |||
:label="i18n.model_creator" | |||
align="center" | |||
min-width="6.75%" | |||
> | |||
<template slot-scope="scope"> | |||
<a | |||
:href="!scope.row.UserName ? '#' : '/' + scope.row.UserName" | |||
:title="scope.row.UserName || defaultAvatarName" | |||
:href="!scope.row.userName ? '#' : '/' + scope.row.userName" | |||
:title="scope.row.userName || defaultAvatarName" | |||
> | |||
<img | |||
class="ui avatar image" | |||
:src="scope.row.UserRelAvatarLink || defaultAvatar" | |||
:src="scope.row.userRelAvatarLink || defaultAvatar" | |||
/> | |||
</a> | |||
</template> | |||
@@ -140,25 +140,25 @@ | |||
:style="{ | |||
visibility: !scope.row.Children ? 'visible' : 'hidden', | |||
}" | |||
:class="{ disabled: !scope.row.IsCanOper }" | |||
:class="{ disabled: !scope.row.isCanOper }" | |||
@click=" | |||
showcreateVue( | |||
scope.row.Name, | |||
scope.row.Version, | |||
scope.row.Label | |||
scope.row.name, | |||
scope.row.version, | |||
scope.row.label | |||
) | |||
" | |||
>{{ i18n.model_create_new_ver }}</a | |||
> | |||
<a | |||
:href="loadhref + scope.row.ID" | |||
:class="{ disabled: !scope.row.IsCanOper }" | |||
:href="loadhref + scope.row.id" | |||
:class="{ disabled: !scope.row.isCanOper }" | |||
>{{ i18n.model_download }}</a | |||
> | |||
<a | |||
:class="{ disabled: !scope.row.IsCanDelete }" | |||
:class="{ disabled: !scope.row.isCanDelete }" | |||
@click=" | |||
deleteModel(scope.row.ID, scope.row.cName, scope.row.rowKey) | |||
deleteModel(scope.row.id, scope.row.cName, scope.row.rowKey) | |||
" | |||
>{{ i18n.model_delete }}</a | |||
> | |||
@@ -219,17 +219,17 @@ export default { | |||
}, | |||
}) | |||
.then((res) => { | |||
let TrainTaskInfo; | |||
let trainTaskInfo; | |||
let tableData; | |||
tableData = res.data; | |||
for (let i = 0; i < tableData.length; i++) { | |||
TrainTaskInfo = JSON.parse(tableData[i].TrainTaskInfo); | |||
tableData[i].EngineName = this.getEngineName(tableData[i]); | |||
tableData[i].ComputeResource = TrainTaskInfo.ComputeResource; | |||
tableData[i].cName = tableData[i].Name; | |||
tableData[i].rowKey = tableData[i].ID + Math.random(); | |||
tableData[i].Name = ""; | |||
tableData[i].VersionCount = ""; | |||
trainTaskInfo = JSON.parse(tableData[i].trainTaskInfo); | |||
tableData[i].engineName = this.getEngineName(tableData[i]); | |||
tableData[i].computeResource = trainTaskInfo.ComputeResource; | |||
tableData[i].cName = tableData[i].name; | |||
tableData[i].rowKey = tableData[i].id + Math.random(); | |||
tableData[i].name = ""; | |||
tableData[i].versionCount = ""; | |||
tableData[i].Children = true; | |||
} | |||
resolve(tableData || []); | |||
@@ -258,10 +258,10 @@ export default { | |||
centered: false, | |||
onShow: function () { | |||
$("#model_header").text(title); | |||
$('input[name="Name"]').addClass("model_disabled"); | |||
$('input[name="Name"]').attr("readonly", "readonly"); | |||
$('input[name="name"]').addClass("model_disabled"); | |||
$('input[name="name"]').attr("readonly", "readonly"); | |||
$('input[name="modelSelectedFile"]').attr("readonly", "readonly"); | |||
$('input[name="Version"]').addClass("model_disabled"); | |||
$('input[name="version"]').addClass("model_disabled"); | |||
$(".ui.dimmer").css({ | |||
"background-color": "rgb(136, 136, 136,0.7)", | |||
}); | |||
@@ -274,8 +274,8 @@ export default { | |||
}, | |||
onHide: function () { | |||
document.getElementById("formId").reset(); | |||
$('input[name="Name"]').removeClass("model_disabled"); | |||
$('input[name="Name"]').removeAttr("readonly"); | |||
$('input[name="name"]').removeClass("model_disabled"); | |||
$('input[name="name"]').removeAttr("readonly"); | |||
$('input[name="modelSelectedFile"]').removeAttr("readonly"); | |||
var cityObj = $("#modelSelectedFile"); | |||
cityObj.attr("value", ""); | |||
@@ -290,8 +290,8 @@ export default { | |||
.modal("show"); | |||
}, | |||
check() { | |||
let jobid = document.getElementById("JobId").value; | |||
let versionname = document.getElementById("VersionName").value; | |||
let jobid = document.getElementById("jobId").value; | |||
let versionname = document.getElementById("versionName").value; | |||
let name = document.getElementById("name").value; | |||
let version = document.getElementById("version").value; | |||
let modelSelectedFile = | |||
@@ -333,8 +333,8 @@ export default { | |||
let context = this; | |||
let flag = this.check(); | |||
if (flag) { | |||
let cName = $("input[name='Name']").val(); | |||
let version = $("input[name='Version']").val(); | |||
let cName = $("input[name='name']").val(); | |||
let version = $("input[name='version']").val(); | |||
let data = $("#formId").serialize(); | |||
const initModel = $("input[name='initModel']").val(); | |||
let url_href = | |||
@@ -387,7 +387,7 @@ export default { | |||
let childrenIndex = store.states.lazyTreeNodeMap[ | |||
parentRow.rowKey | |||
].findIndex((child) => child.rowKey == row.rowKey); | |||
parentRow.VersionCount = parentRow.VersionCount - 1; | |||
parentRow.versionCount = parentRow.versionCount - 1; | |||
const parent = store.states.lazyTreeNodeMap[parentRow.rowKey]; | |||
if (parent.length === 1) { | |||
this.getModelList(); | |||
@@ -398,7 +398,7 @@ export default { | |||
} | |||
}, | |||
deleteModel(id, name, rowKey) { | |||
let row = { cName: name, ID: id, rowKey: rowKey }; | |||
let row = { cName: name, id: id, rowKey: rowKey }; | |||
let _this = this; | |||
let flag = 1; | |||
$(".ui.basic.modal.first") | |||
@@ -410,7 +410,7 @@ export default { | |||
_this.$axios | |||
.delete(_this.url + "delete_model", { | |||
params: { | |||
ID: id, | |||
id: id, | |||
}, | |||
}) | |||
.then((res) => { | |||
@@ -442,21 +442,21 @@ export default { | |||
.modal("show"); | |||
}, | |||
getEngineName(model) { | |||
if (model.Engine == 0) { | |||
if (model.engine == 0) { | |||
return "PyTorch"; | |||
} else if (model.Engine == 1 || model.Engine == 121) { | |||
} else if (model.engine == 1 || model.engine == 121) { | |||
return "TensorFlow"; | |||
} else if ( | |||
model.Engine == 2 || | |||
model.Engine == 122 || | |||
model.Engine == 35 | |||
model.engine == 2 || | |||
model.engine == 122 || | |||
model.engine == 35 | |||
) { | |||
return "MindSpore"; | |||
} else if (model.Engine == 4) { | |||
} else if (model.engine == 4) { | |||
return "PaddlePaddle"; | |||
} else if (model.Engine == 5) { | |||
} else if (model.engine == 5) { | |||
return "OneFlow"; | |||
} else if (model.Engine == 6) { | |||
} else if (model.engine == 6) { | |||
return "MXNet"; | |||
} else { | |||
return "Other"; | |||
@@ -480,34 +480,34 @@ export default { | |||
.then((res) => { | |||
$(".ui.grid").removeAttr("style"); | |||
$("#loadContainer").removeClass("loader"); | |||
let TrainTaskInfo; | |||
let trainTaskInfo; | |||
this.tableData = res.data.data; | |||
for (let i = 0; i < this.tableData.length; i++) { | |||
TrainTaskInfo = JSON.parse(this.tableData[i].TrainTaskInfo); | |||
this.tableData[i].cName = this.tableData[i].Name; | |||
this.tableData[i].rowKey = this.tableData[i].ID + Math.random(); | |||
this.tableData[i].EngineName = this.getEngineName( | |||
trainTaskInfo = JSON.parse(this.tableData[i].trainTaskInfo); | |||
this.tableData[i].cName = this.tableData[i].name; | |||
this.tableData[i].rowKey = this.tableData[i].id + Math.random(); | |||
this.tableData[i].engineName = this.getEngineName( | |||
this.tableData[i] | |||
); | |||
this.tableData[i].ComputeResource = TrainTaskInfo.ComputeResource; | |||
this.tableData[i].computeResource = trainTaskInfo.ComputeResource; | |||
this.tableData[i].hasChildren = | |||
res.data.data[i].VersionCount === 1 ? false : true; | |||
if (this.tableData[i].Status !== 1) { | |||
res.data.data[i].versionCount === 1 ? false : true; | |||
if (this.tableData[i].status !== 1) { | |||
countStatus++; | |||
} | |||
switch (this.tableData[i].Status) { | |||
switch (this.tableData[i].status) { | |||
case 1: | |||
this.tableData[i].Status = "WAITING"; | |||
this.tableData[i].Status_title = this.i18n.model_wait; | |||
this.tableData[i].status = "WAITING"; | |||
this.tableData[i].status_title = this.i18n.model_wait; | |||
break; | |||
case 2: | |||
this.tableData[i].Status = "FAILED"; | |||
this.tableData[i].Status_title = this.tableData[i].StatusDesc; | |||
this.tableData[i].status = "FAILED"; | |||
this.tableData[i].status_title = this.tableData[i].statusDesc; | |||
break; | |||
default: | |||
this.tableData[i].Status = "SUCCEEDED"; | |||
this.tableData[i].Status_title = this.i18n.model_success; | |||
this.tableData[i].status = "SUCCEEDED"; | |||
this.tableData[i].status_title = this.i18n.model_success; | |||
break; | |||
} | |||
} | |||
@@ -531,7 +531,7 @@ export default { | |||
}, | |||
computed: { | |||
loadhref() { | |||
return this.url + "downloadall?ID="; | |||
return this.url + "downloadall?id="; | |||
}, | |||
showinfoHref() { | |||
return this.url + "show_model_info?name="; | |||
@@ -695,9 +695,9 @@ export default async function initCloudrainSow() { | |||
if (value) { | |||
let html = ""; | |||
nameMap[value].forEach((element) => { | |||
let { TrainTaskInfo } = element; | |||
TrainTaskInfo = JSON.parse(TrainTaskInfo); | |||
html += `<div class="item" data-label="${element.Label}" data-id="${element.ID}" data-value="${element.Path}">${element.Version}</div>`; | |||
//let { trainTaskInfo } = element; | |||
//trainTaskInfo = JSON.parse(trainTaskInfo); | |||
html += `<div class="item" data-label="${element.label}" data-id="${element.id}" data-value="${element.path}">${element.version}</div>`; | |||
}); | |||
$("#model_name_version").append(html); | |||
const initVersionText = $( | |||
@@ -833,7 +833,7 @@ export default async function initCloudrainSow() { | |||
return new Promise((resolve, reject) => { | |||
$.get( | |||
`${RepoLink}/modelmanage/query_modelfile_for_predict`, | |||
{ ID: value }, | |||
{ id: value }, | |||
(data) => { | |||
resolve(data); | |||
} | |||