| @@ -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 { | |||
| @@ -947,6 +947,9 @@ 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("/:id", repo.GetCloudbrainModelConvertTask) | |||
| m.Get("/:id/log", repo.CloudbrainForModelConvertGetLog) | |||
| m.Get("/:id/modelartlog", repo.TrainJobForModelConvertGetLog) | |||
| @@ -0,0 +1,30 @@ | |||
| package repo | |||
| import ( | |||
| "code.gitea.io/gitea/modules/context" | |||
| "code.gitea.io/gitea/modules/log" | |||
| routerRepo "code.gitea.io/gitea/routers/repo" | |||
| ) | |||
| func CreateNewModel(ctx *context.APIContext) { | |||
| log.Info("create new model by api.") | |||
| ctx.Context.SetParams("JobId", ctx.Query("jobId")) | |||
| ctx.Context.SetParams("VersionName", ctx.Query("versionName")) | |||
| ctx.Context.SetParams("Name", ctx.Query("name")) | |||
| ctx.Context.SetParams("Version", ctx.Query("version")) | |||
| ctx.Context.SetParams("Engine", ctx.Query("engine")) | |||
| ctx.Context.SetParams("modelSelectedFile", ctx.Query("modelSelectedFile")) | |||
| ctx.Context.SetParams("Label", ctx.Query("label")) | |||
| ctx.Context.SetParams("Description", ctx.Query("description")) | |||
| routerRepo.SaveModel(ctx.Context) | |||
| } | |||
| func ShowModelManageApi(ctx *context.APIContext) { | |||
| routerRepo.ShowModelPageInfo(ctx.Context) | |||
| } | |||
| func DeleteModel(ctx *context.APIContext) { | |||
| routerRepo.DeleteModel(ctx.Context) | |||
| } | |||
| @@ -72,27 +72,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 | |||
| } | |||
| @@ -103,8 +103,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 | |||
| } | |||
| @@ -117,8 +117,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 | |||
| } | |||
| @@ -148,7 +148,7 @@ func SaveModelConvert(ctx *context.Context) { | |||
| go goCreateTask(modelConvert, ctx, task) | |||
| ctx.JSON(200, map[string]string{ | |||
| "result_code": "0", | |||
| "code": "0", | |||
| }) | |||
| } | |||
| @@ -588,11 +588,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" | |||
| @@ -741,7 +741,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/" | |||
| @@ -175,7 +175,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 | |||
| @@ -197,13 +197,13 @@ 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) | |||
| @@ -293,13 +293,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", | |||
| }) | |||
| } | |||
| } | |||
| @@ -356,7 +360,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 { | |||
| @@ -489,7 +493,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) | |||
| @@ -521,7 +528,10 @@ func QueryTrainModelList(ctx *context.Context) { | |||
| log.Info("query train job list. start.") | |||
| jobName := ctx.Query("jobName") | |||
| taskType := ctx.QueryInt("type") | |||
| VersionName := ctx.Query("VersionName") | |||
| VersionName := ctx.Query("versionName") | |||
| if VersionName == "" { | |||
| VersionName = ctx.Query("VersionName") | |||
| } | |||
| if taskType == models.TypeCloudBrainTwo { | |||
| objectkey := path.Join(setting.TrainJobModelPath, jobName, setting.OutPutPath, VersionName) + "/" | |||
| modelDbResult, err := storage.GetAllObjectByBucketAndPrefix(setting.Bucket, objectkey) | |||
| @@ -614,7 +624,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) | |||
| @@ -830,8 +840,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 { | |||
| @@ -896,7 +906,10 @@ func QueryModelListForPredict(ctx *context.Context) { | |||
| } | |||
| func QueryModelFileForPredict(ctx *context.Context) { | |||
| id := ctx.Query("ID") | |||
| id := ctx.Query("id") | |||
| if id == "" { | |||
| id = ctx.Query("ID") | |||
| } | |||
| model, err := models.QueryModelById(id) | |||
| if err == nil { | |||
| if model.Type == models.TypeCloudBrainTwo { | |||
| @@ -917,7 +930,10 @@ func QueryModelFileForPredict(ctx *context.Context) { | |||
| } | |||
| 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 { | |||
| @@ -366,7 +366,7 @@ | |||
| data['desc']= $('#Description').val() | |||
| data['modelId'] = $('#ModelVersion').val() | |||
| data['SrcEngine'] = $('#SrcEngine').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') | |||
| } | |||
| }) | |||
| @@ -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 ='' | |||
| @@ -578,13 +578,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; | |||
| @@ -400,13 +400,13 @@ | |||
| if(n_length > 0){ | |||
| let train_html = '' | |||
| for (let i = 0; i < n_length; i++) { | |||
| train_html += `<div class="item" data-value="${data[i].JobID}">${data[i].DisplayJobName}</div>` | |||
| train_html += `<div class="item" data-value="${data[i].jobId}">${data[i].displayJobName}</div>` | |||
| train_html += '</div>' | |||
| } | |||
| $("#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 .default.text').text(data[0].displayJobName) | |||
| $('#choice_model input[name="jobId"]').val(data[0].jobId) | |||
| loadTrainVersion() | |||
| }else{ | |||
| $("#choice_model").removeClass("loading") | |||
| @@ -414,24 +414,24 @@ | |||
| }) | |||
| } | |||
| function loadTrainVersion(value) { | |||
| let JobID = !value ? $('#choice_model input[name="JobId"]').val() : value | |||
| $.get(`${repolink}/modelmanage/query_train_job_version?JobID=${JobID}`, (data) => { | |||
| 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; | |||
| for (let i = 0; i < n_length; i++) { | |||
| train_html += `<div class="item" data-value="${data[i].VersionName}">${data[i].VersionName}</div>` | |||
| train_html += `<div class="item" data-value="${data[i].versionName}">${data[i].versionName}</div>` | |||
| train_html += '</div>' | |||
| } | |||
| if (data.length) { | |||
| $("#job-version").append(train_html) | |||
| $("#choice_version").removeClass("loading") | |||
| var versionName = data[0].VersionName; | |||
| var versionName = data[0].versionName; | |||
| if (versionName == null || versionName == "") { | |||
| 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 +453,7 @@ | |||
| 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) => { | |||
| const n_length = data.length | |||
| let file_html='' | |||
| let firstFileName ='' | |||
| @@ -522,8 +522,8 @@ | |||
| console.log("modelVersion=" + modelVersion); | |||
| $('#choice_Engine').dropdown('clear') | |||
| $("#job-Engine").empty() | |||
| if (modelVersion.EngineName != null && modelVersion.EngineName != "") { | |||
| srcEngine = modelVersion.EngineName.split('-')[0] | |||
| if (modelVersion.engineName != null && modelVersion.engineName != "") { | |||
| srcEngine = modelVersion.engineName.split('-')[0] | |||
| srcEngine = srcEngine.trim().toLowerCase(); | |||
| let selectedText = "PyTorch"; | |||
| let selectedValue = 0; | |||
| @@ -548,7 +548,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,7 +560,7 @@ | |||
| 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'); | |||
| } | |||
| @@ -221,40 +221,40 @@ function changeInfo(version){ | |||
| 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,36 @@ 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) | |||
| 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 {parameters} = trainTaskInfo | |||
| let engineName = getEngineName(data[0]) | |||
| parameters = JSON.parse(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 || '--', | |||
| 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 || '--', | |||
| @@ -338,8 +338,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 +351,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 +372,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="; | |||