| @@ -679,7 +679,7 @@ func (repo *Repository) getAssignees(e Engine) (_ []*User, err error) { | |||
| userIDs[i] = accesses[i].UserID | |||
| } | |||
| if err = e.In("id", userIDs).Find(&users); err != nil { | |||
| if err = e.In("id", userIDs).OrderBy("name asc").Find(&users); err != nil { | |||
| return nil, err | |||
| } | |||
| } | |||
| @@ -8,6 +8,7 @@ import ( | |||
| "fmt" | |||
| "os" | |||
| "strings" | |||
| "text/template" | |||
| "code.gitea.io/gitea/models" | |||
| "code.gitea.io/gitea/modules/git" | |||
| @@ -34,7 +35,7 @@ func CreateRepository(doer, u *models.User, opts models.CreateRepoOptions) (_ *m | |||
| Name: opts.Name, | |||
| Alias: opts.Alias, | |||
| LowerName: strings.ToLower(opts.Name), | |||
| Description: opts.Description, | |||
| Description: template.HTMLEscapeString(opts.Description), | |||
| OriginalURL: opts.OriginalURL, | |||
| OriginalServiceType: opts.GitServiceType, | |||
| IsPrivate: opts.IsPrivate, | |||
| @@ -394,7 +394,7 @@ var ( | |||
| DefaultGitTreesPerPage int | |||
| DefaultMaxBlobSize int64 | |||
| }{ | |||
| EnableSwagger: true, | |||
| EnableSwagger: false, | |||
| SwaggerURL: "", | |||
| MaxResponseItems: 50, | |||
| DefaultPagingNum: 30, | |||
| @@ -3210,11 +3210,11 @@ wrong_specification=You cannot use this specification, please choose another ite | |||
| resource_use=Resource Occupancy | |||
| job_name_rule = Please enter letters, numbers, _ and - up to 64 characters and cannot end with a dash (-). | |||
| train_dataset_path_rule = The dataset location is stored in the environment variable <strong style="color:#010101">data_url</strong>, the pre-trained model is storaged in the environment <strong style="color:#010101">ckpt_url</strong>, and the output path is stored in the environment variable <strong style="color:#010101">train_url</strong>. | |||
| infer_dataset_path_rule = The dataset location is stored in the environment variable <strong style="color:#010101">data_url</strong>, and the output path is stored in the environment variable <strong style="color:#010101">result_url</strong>. | |||
| train_dataset_path_rule = The dataset location is stored in the run parameter <strong style="color:#010101">data_url</strong>, the pre-trained model is storaged in the run parameter <strong style="color:#010101">ckpt_url</strong>, and the output path is stored in the run parameter <strong style="color:#010101">train_url</strong>. | |||
| infer_dataset_path_rule = The dataset location is stored in the run parameter <strong style="color:#010101">data_url</strong>, and the output path is stored in the run parameter <strong style="color:#010101">result_url</strong>. | |||
| view_sample = View sample | |||
| inference_output_path_rule = The inference output path is stored in the environment variable result_url. | |||
| model_file_path_rule=The model file location is stored in the environment variable ckpt_url | |||
| inference_output_path_rule = The inference output path is stored in the run parameter result_url. | |||
| model_file_path_rule=The model file location is stored in the run parameter ckpt_url | |||
| model_file_postfix_rule = The supported format of the model file is [ckpt, pb, h5, json, pkl, pth, t7, pdparams, onnx, pbtxt, keras, mlmodel, cfg, pt] | |||
| model_convert_postfix_rule = The supported format of the model file is [.pth, .pkl, .onnx, .mindir, .ckpt, .pb] | |||
| delete_task = Delete task | |||
| @@ -3234,6 +3234,7 @@ point_hr = Point/hr | |||
| DEBUG = DEBUG | |||
| SNN4IMAGENET = BENCHMARK | |||
| BRAINSCORE = BENCHMARK | |||
| MODELSAFETY = BENCHMARK | |||
| TRAIN = TRAIN | |||
| INFERENCE = INFERENCE | |||
| BENCHMARK = BENCHMARK | |||
| @@ -3247,8 +3248,8 @@ Stopped_success_update_status_fail=Succeed in stopping th job, but failed to upd | |||
| load_code_failed=Fail to load code, please check if the right branch is selected. | |||
| error.dataset_select = dataset select error:the count exceed the limit or has same name | |||
| new_train_gpu_tooltips = The code is storaged in <strong style="color:#010101">%s</strong>, the dataset is storaged in <strong style="color:#010101">%s</strong>, the pre-trained model is storaged in the environment <strong style="color:#010101">%s</strong>, and please put your model into <strong style="color:#010101">%s</strong> then you can download it online | |||
| new_train_npu_tooltips = The code is storaged in <strong style="color:#010101">%s</strong>, the pre-trained model is storaged in the environment <strong style="color:#010101">%s</strong>, and please put your model into <strong style="color:#010101">%s</strong> then you can download it online | |||
| new_train_gpu_tooltips = The code is storaged in <strong style="color:#010101">%s</strong>, the dataset is storaged in <strong style="color:#010101">%s</strong>, the pre-trained model is storaged in the run parameter <strong style="color:#010101">%s</strong>, and please put your model into <strong style="color:#010101">%s</strong> then you can download it online | |||
| new_train_npu_tooltips = The code is storaged in <strong style="color:#010101">%s</strong>, the pre-trained model is storaged in the run parameter <strong style="color:#010101">%s</strong>, and please put your model into <strong style="color:#010101">%s</strong> then you can download it online | |||
| new_infer_gpu_tooltips = The dataset is stored in <strong style="color:#010101">%s</strong>, the model file is stored in <strong style="color:#010101">%s</strong>, please store the inference output in <strong style="color:#010101">%s</strong> for subsequent downloads. | |||
| [points] | |||
| @@ -3228,11 +3228,11 @@ card_type = 卡类型 | |||
| wrong_specification=您目前不能使用这个资源规格,请选择其他资源规格。 | |||
| job_name_rule = 请输入字母、数字、_和-,最长64个字符,且不能以中划线(-)结尾。 | |||
| train_dataset_path_rule = 数据集位置存储在环境变量<strong style="color:#010101">data_url</strong>中,预训练模型存放在环境变量<strong style="color:#010101">ckpt_url</strong>中,训练输出路径存储在环境变量<strong style="color:#010101">train_url</strong>中。 | |||
| infer_dataset_path_rule = 数据集位置存储在环境变量<strong style="color:#010101">data_url</strong>中,推理输出路径存储在环境变量<strong style="color:#010101">result_url</strong>中。 | |||
| train_dataset_path_rule = 数据集位置存储在运行参数 <strong style="color:#010101">data_url</strong> 中,预训练模型存放在运行参数 <strong style="color:#010101">ckpt_url</strong> 中,训练输出路径存储在运行参数 <strong style="color:#010101">train_url</strong> 中。 | |||
| infer_dataset_path_rule = 数据集位置存储在运行参数 <strong style="color:#010101">data_url</strong> 中,推理输出路径存储在运行参数 <strong style="color:#010101">result_url</strong> 中。 | |||
| view_sample = 查看样例 | |||
| inference_output_path_rule = 推理输出路径存储在环境变量result_url中。 | |||
| model_file_path_rule = 模型文件位置存储在环境变量ckpt_url中。 | |||
| inference_output_path_rule = 推理输出路径存储在运行参数 result_url 中。 | |||
| model_file_path_rule = 模型文件位置存储在运行参数 ckpt_url 中。 | |||
| model_file_postfix_rule = 模型文件支持的格式为 [ckpt, pb, h5, json, pkl, pth, t7, pdparams, onnx, pbtxt, keras, mlmodel, cfg, pt] | |||
| model_convert_postfix_rule = 模型文件支持的格式为 [.pth, .pkl, .onnx, .mindir, .ckpt, .pb] | |||
| delete_task = 删除任务 | |||
| @@ -3252,6 +3252,7 @@ point_hr = 积分/时 | |||
| DEBUG = 调试任务 | |||
| SNN4IMAGENET = 评测任务 | |||
| BRAINSCORE = 评测任务 | |||
| MODELSAFETY = 评测任务 | |||
| TRAIN = 训练任务 | |||
| INFERENCE = 推理任务 | |||
| BENCHMARK = 评测任务 | |||
| @@ -3266,9 +3267,9 @@ load_code_failed=代码加载失败,请确认选择了正确的分支。 | |||
| error.dataset_select = 数据集选择错误:数量超过限制或者有同名数据集 | |||
| new_train_gpu_tooltips =训练脚本存储在<strong style="color:#010101">%s</strong>中,数据集存储在<strong style="color:#010101">%s</strong>中,预训练模型存放在环境变量<strong style="color:#010101">%s</strong>中,训练输出请存储在<strong style="color:#010101">%s</strong>中以供后续下载。 | |||
| new_train_npu_tooltips =训练脚本存储在<strong style="color:#010101">%s</strong>中,预训练模型存放在环境变量<strong style="color:#010101">%s</strong>中,训练输出请存储在<strong style="color:#010101">%s</strong>中以供后续下载。 | |||
| new_infer_gpu_tooltips = 数据集存储在<strong style="color:#010101">%s</strong>中,模型文件存储在<strong style="color:#010101">%s</strong>中,推理输出请存储在<strong style="color:#010101">%s</strong>中以供后续下载。 | |||
| new_train_gpu_tooltips = 训练脚本存储在 <strong style="color:#010101">%s</strong> 中,数据集存储在 <strong style="color:#010101">%s</strong> 中,预训练模型存放在运行参数 <strong style="color:#010101">%s</strong> 中,训练输出请存储在 <strong style="color:#010101">%s</strong> 中以供后续下载。 | |||
| new_train_npu_tooltips = 训练脚本存储在 <strong style="color:#010101">%s</strong> 中,预训练模型存放在运行参数 <strong style="color:#010101">%s</strong> 中,训练输出请存储在 <strong style="color:#010101">%s</strong> 中以供后续下载。 | |||
| new_infer_gpu_tooltips = 数据集存储在 <strong style="color:#010101">%s</strong> 中,模型文件存储在 <strong style="color:#010101">%s</strong> 中,推理输出请存储在 <strong style="color:#010101">%s</strong> 中以供后续下载。 | |||
| [points] | |||
| points = 积分 | |||
| @@ -577,7 +577,6 @@ func getLogFromModelDir(jobName string, startLine int, endLine int, resultPath s | |||
| r := bufio.NewReader(reader) | |||
| for i := 0; i < endLine; i++ { | |||
| line, error := r.ReadString('\n') | |||
| log.Info("line=" + line) | |||
| if error == io.EOF { | |||
| log.Info("read file completed.") | |||
| break | |||
| @@ -7,6 +7,7 @@ package repo | |||
| import ( | |||
| "fmt" | |||
| "html/template" | |||
| "net/http" | |||
| "code.gitea.io/gitea/models" | |||
| @@ -118,7 +119,7 @@ func CreateFork(ctx *context.APIContext, form api.CreateForkOption) { | |||
| forker = org | |||
| } | |||
| fork, err := repo_service.ForkRepository(ctx.User, forker, repo, repo.Name, repo.Description, repo.Alias) | |||
| fork, err := repo_service.ForkRepository(ctx.User, forker, repo, repo.Name, template.HTMLEscapeString(repo.Description), repo.Alias) | |||
| if err != nil { | |||
| ctx.Error(http.StatusInternalServerError, "ForkRepository", err) | |||
| return | |||
| @@ -8,6 +8,7 @@ import ( | |||
| "net/http" | |||
| "net/url" | |||
| "path" | |||
| "regexp" | |||
| "strings" | |||
| "code.gitea.io/gitea/models" | |||
| @@ -85,6 +86,7 @@ func saveModelByParameters(jobId string, versionName string, name string, versio | |||
| accuracy["Precision"] = "" | |||
| accuracyJson, _ := json.Marshal(accuracy) | |||
| log.Info("accuracyJson=" + string(accuracyJson)) | |||
| aiTask.ContainerIp = "" | |||
| aiTaskJson, _ := json.Marshal(aiTask) | |||
| model := &models.AiModelManage{ | |||
| @@ -635,6 +637,7 @@ func ShowSingleModel(ctx *context.Context) { | |||
| userNameMap := queryUserName(userIds) | |||
| for _, model := range models { | |||
| removeIpInfo(model) | |||
| value := userNameMap[model.UserId] | |||
| if value != nil { | |||
| model.UserName = value.Name | |||
| @@ -644,6 +647,13 @@ func ShowSingleModel(ctx *context.Context) { | |||
| ctx.JSON(http.StatusOK, models) | |||
| } | |||
| func removeIpInfo(model *models.AiModelManage) { | |||
| reg, _ := regexp.Compile(`[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}\.[[:digit:]]{1,3}`) | |||
| taskInfo := model.TrainTaskInfo | |||
| taskInfo = reg.ReplaceAllString(taskInfo, "") | |||
| model.TrainTaskInfo = taskInfo | |||
| } | |||
| func queryUserName(intSlice []int64) map[int64]*models.User { | |||
| keys := make(map[int64]string) | |||
| uniqueElements := []int64{} | |||
| @@ -677,6 +687,7 @@ func ShowOneVersionOtherModel(ctx *context.Context) { | |||
| userNameMap := queryUserName(userIds) | |||
| for _, model := range aimodels { | |||
| removeIpInfo(model) | |||
| value := userNameMap[model.UserId] | |||
| if value != nil { | |||
| model.UserName = value.Name | |||
| @@ -793,6 +804,7 @@ func ShowModelPageInfo(ctx *context.Context) { | |||
| userNameMap := queryUserName(userIds) | |||
| for _, model := range modelResult { | |||
| removeIpInfo(model) | |||
| value := userNameMap[model.UserId] | |||
| if value != nil { | |||
| model.UserName = value.Name | |||
| @@ -866,6 +878,7 @@ func QueryModelListForPredict(ctx *context.Context) { | |||
| nameMap := make(map[string][]*models.AiModelManage) | |||
| for _, model := range modelResult { | |||
| removeIpInfo(model) | |||
| if _, value := nameMap[model.Name]; !value { | |||
| models := make([]*models.AiModelManage, 0) | |||
| models = append(models, model) | |||
| @@ -760,8 +760,8 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo | |||
| ctx.Data["ExitDiagnostics"] = taskRes.TaskStatuses[0].ExitDiagnostics | |||
| oldStatus := task.Status | |||
| task.Status = taskRes.TaskStatuses[0].State | |||
| task.ContainerIp = "" | |||
| task.ContainerID = taskRes.TaskStatuses[0].ContainerID | |||
| task.ContainerIp = taskRes.TaskStatuses[0].ContainerIP | |||
| models.ParseAndSetDurationFromCloudBrainOne(jobRes, task) | |||
| if task.DeletedAt.IsZero() { //normal record | |||
| @@ -837,6 +837,7 @@ func GrampusTrainJobShow(ctx *context.Context) { | |||
| ctx.NotFound(ctx.Req.URL.RequestURI(), nil) | |||
| return | |||
| } | |||
| task.ContainerIp = "" | |||
| if task.DeletedAt.IsZero() { //normal record | |||
| result, err := grampus.GetJob(task.JobID) | |||
| @@ -1795,7 +1795,7 @@ func TrainJobShow(ctx *context.Context) { | |||
| datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false)) | |||
| VersionListTasks[i].CanDel = cloudbrain.CanDeleteJob(ctx, &task.Cloudbrain) | |||
| VersionListTasks[i].CanModify = cloudbrain.CanModifyJob(ctx, &task.Cloudbrain) | |||
| VersionListTasks[i].ContainerIp = "" | |||
| //add spec | |||
| s, err := resource.GetCloudbrainSpec(task.Cloudbrain.ID) | |||
| if err != nil { | |||
| @@ -12,6 +12,7 @@ import ( | |||
| "path" | |||
| "regexp" | |||
| "strings" | |||
| "text/template" | |||
| "unicode/utf8" | |||
| "code.gitea.io/gitea/modules/validation" | |||
| @@ -212,7 +213,7 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) { | |||
| opts := models.GenerateRepoOptions{ | |||
| Name: form.RepoName, | |||
| Alias: form.Alias, | |||
| Description: form.Description, | |||
| Description: template.HTMLEscapeString(form.Description), | |||
| Private: form.Private, | |||
| GitContent: form.GitContent, | |||
| Topics: form.Topics, | |||
| @@ -8,6 +8,7 @@ package repo | |||
| import ( | |||
| "errors" | |||
| "fmt" | |||
| "html/template" | |||
| "io/ioutil" | |||
| "net/url" | |||
| "regexp" | |||
| @@ -129,7 +130,7 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { | |||
| // In case it's just a case change. | |||
| repo.Name = newRepoName | |||
| repo.LowerName = strings.ToLower(newRepoName) | |||
| repo.Description = form.Description | |||
| repo.Description = template.HTMLEscapeString(form.Description) | |||
| repo.Website = form.Website | |||
| repo.IsTemplate = form.Template | |||
| repo.Alias = newAlias | |||
| @@ -89,7 +89,7 @@ | |||
| <div class="row"> | |||
| <!-- 任务名 --> | |||
| {{$JobID := '0'}} | |||
| {{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK"}} | |||
| {{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK" "MODELSAFETY"}} | |||
| {{$JobID = .Cloudbrain.ID}} | |||
| {{else}} | |||
| {{$JobID = .JobID}} | |||
| @@ -110,6 +110,13 @@ | |||
| <span class="fitted" | |||
| style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| {{else if eq .JobType "MODELSAFETY"}} | |||
| <a class="title" | |||
| href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelsafety/{{$JobID}}/show" | |||
| title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
| <span class="fitted" | |||
| style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| {{else if eq .JobType "INFERENCE"}} | |||
| <a class="title" | |||
| href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .Cloudbrain.Type 1}}modelarts{{else if eq .Cloudbrain.Type 0}}cloudbrain{{end}}/inference-job/{{$JobID}}" | |||
| @@ -135,8 +142,7 @@ | |||
| </div> | |||
| <!-- 集群 --> | |||
| <div class="one wide column text center nowrap" style="width:6% !important;"> | |||
| <span | |||
| style="font-size: 12px;">{{if .Cluster}}{{.Cluster}}{{else}}--{{end}}</span> | |||
| <span style="font-size: 12px;" class="cluster_{{.DisplayJobName}}_{{$JobID}}">{{if .Cluster}}{{.Cluster}}{{else}}--{{end}}</span> | |||
| </div> | |||
| <!-- 任务状态 --> | |||
| <div class="two wide column text center nowrap" | |||
| @@ -171,8 +177,7 @@ | |||
| </div> | |||
| <!-- 智算中心 --> | |||
| <div class="one wide column text center nowrap" style="width:8% !important;"> | |||
| <span | |||
| style="font-size: 12px;">{{if .AiCenter}}{{.AiCenter}}{{else}}--{{end}}</span> | |||
| <span style="font-size: 12px;" class="aicenter_{{.DisplayJobName}}_{{$JobID}}">{{if .AiCenter}}{{.AiCenter}}{{else}}--{{end}}</span> | |||
| </div> | |||
| <!-- XPU类型 --> | |||
| <div class="one wide column text center nowrap" style="width:8% !important;"> | |||
| @@ -185,6 +190,17 @@ | |||
| var spanEl = document.querySelector('.card_type_{{.DisplayJobName}}_{{$JobID}}'); | |||
| spanEl.setAttribute('title', cardType); | |||
| spanEl.innerText = cardType; | |||
| var cluster = spec.Cluster || '--'; | |||
| var clusterName = document.querySelector('.cloudbrain_debug').dataset['cluster' + cluster[0] + cluster.toLocaleLowerCase().slice(1)] || '--'; | |||
| spanEl = document.querySelector('.cluster_{{.DisplayJobName}}_{{$JobID}}'); | |||
| spanEl.setAttribute('title', cluster); | |||
| spanEl.innerText = clusterName; | |||
| var aiCenter = spec.AiCenterName || '--'; | |||
| spanEl = document.querySelector('.aicenter_{{.DisplayJobName}}_{{$JobID}}'); | |||
| spanEl.setAttribute('title', aiCenter); | |||
| spanEl.innerText = aiCenter; | |||
| })(); | |||
| </script> | |||
| <!-- 创建者 --> | |||
| @@ -239,8 +255,19 @@ | |||
| </form> | |||
| </div> | |||
| {{end}} | |||
| <!-- 停止任务 --> | |||
| <!-- 停止任务 --> | |||
| <div class="ui compact buttons"> | |||
| {{if eq .JobType "MODELSAFETY"}} | |||
| <form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> | |||
| {{$.CsrfTokenHtml}} | |||
| <a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" | |||
| class='ui basic ai_stop {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "SUCCEEDED" "STOPPED" "STOPPING"}}disabled {{else}} blue {{end}}button' | |||
| data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelsafety/{{$JobID}}/stop' | |||
| data-jobid="{{$JobID}}"> | |||
| {{$.i18n.Tr "repo.stop"}} | |||
| </a> | |||
| </form> | |||
| {{else}} | |||
| {{if eq .JobType "DEBUG" "BENCHMARK" "SNN4IMAGENET" "BRAINSCORE"}} | |||
| <form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> | |||
| {{$.CsrfTokenHtml}} | |||
| @@ -259,6 +286,7 @@ | |||
| {{$.i18n.Tr "repo.stop"}} | |||
| </a> | |||
| {{end}} | |||
| {{end}} | |||
| </div> | |||
| <!-- 修改任务 --> | |||
| {{if eq .JobType "TRAIN"}} | |||
| @@ -269,17 +297,30 @@ | |||
| </div> | |||
| {{end}} | |||
| <!-- 删除任务 --> | |||
| <form class="ui compact buttons" id="delForm-{{$JobID}}" | |||
| action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}}/cloudbrain{{else if eq .JobType "DEBUG"}}{{if eq .ComputeResource "NPU"}}/modelarts/notebook{{else}}/cloudbrain{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}/modelarts/train-job{{else if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}/grampus/train-job{{end}}{{else if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{end}}{{end}}/{{$JobID}}/del?isadminpage=true' | |||
| method="post"> | |||
| {{$.CsrfTokenHtml}} | |||
| <a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{$JobID}}" | |||
| data-repopath="{{.Repo.OwnerName}}/{{.Repo.Name}}/modelarts/inference-job/{{$JobID}}/del_version?isadminpage=true" | |||
| data-version="" class="ui basic ai_delete blue button" | |||
| style="border-radius: .28571429rem;"> | |||
| {{$.i18n.Tr "repo.delete"}} | |||
| </a> | |||
| </form> | |||
| {{if eq .JobType "MODELSAFETY"}} | |||
| <form class="ui compact buttons" id="delForm-{{$JobID}}" | |||
| action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelsafety/{{$JobID}}/del?isadminpage=true' | |||
| method="post"> | |||
| {{$.CsrfTokenHtml}} | |||
| <a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{$JobID}}" | |||
| class="ui basic ai_delete blue button" | |||
| style="border-radius: .28571429rem;"> | |||
| {{$.i18n.Tr "repo.delete"}} | |||
| </a> | |||
| </form> | |||
| {{else}} | |||
| <form class="ui compact buttons" id="delForm-{{$JobID}}" | |||
| action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}}/cloudbrain{{else if eq .JobType "DEBUG"}}{{if eq .ComputeResource "NPU"}}/modelarts/notebook{{else}}/cloudbrain{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}/modelarts/train-job{{else if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}/grampus/train-job{{end}}{{else if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{end}}{{end}}/{{$JobID}}/del?isadminpage=true' | |||
| method="post"> | |||
| {{$.CsrfTokenHtml}} | |||
| <a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{$JobID}}" | |||
| data-repopath="{{.Repo.OwnerName}}/{{.Repo.Name}}/modelarts/inference-job/{{$JobID}}/del_version?isadminpage=true" | |||
| data-version="" class="ui basic ai_delete blue button" | |||
| style="border-radius: .28571429rem;"> | |||
| {{$.i18n.Tr "repo.delete"}} | |||
| </a> | |||
| </form> | |||
| {{end}} | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -253,7 +253,7 @@ | |||
| <div style="float: right;"> | |||
| {{if and ($.canDownload) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }} | |||
| <a class="ti-action-menu-item" id="{{.VersionName}}-create-model" | |||
| onclick="showcreate({{.}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||
| onclick="showcreate({DisplayJobName:{{.DisplayJobName}},JobName:{{.JobName}},JobID:{{.JobID}},VersionName:{{.VersionName}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||
| {{else}} | |||
| <a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||
| {{end}} | |||
| @@ -265,7 +265,7 @@ | |||
| <div style="float: right;"> | |||
| {{if and ($.canDownload) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }} | |||
| <a class="ti-action-menu-item" id="{{.VersionName}}-create-model" | |||
| onclick="showcreate({{.}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||
| onclick="showcreate({DisplayJobName:{{.DisplayJobName}},JobName:{{.JobName}},JobID:{{.JobID}},VersionName:{{.VersionName}},EngineName:{{.EngineName}},ComputeResource:{{.ComputeResource}},Type:{{.Type}}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||
| {{else}} | |||
| <a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||
| {{end}} | |||
| @@ -249,7 +249,7 @@ | |||
| {{$.CsrfTokenHtml}} | |||
| {{if and (.CanModify) (ne .Status "WAITING") ($.Permission.CanWrite $.UnitTypeModelManage) }} | |||
| <a class="ti-action-menu-item" id="{{.VersionName}}-create-model" | |||
| onclick="showcreate({{.}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||
| onclick="showcreate({DisplayJobName:{{.DisplayJobName}},JobName:{{.JobName}},JobID:{{.JobID}},VersionName:{{.VersionName}},EngineID:{{.EngineID}}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||
| {{else}} | |||
| <a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model">{{$.i18n.Tr "repo.modelarts.create_model"}}</a> | |||
| {{end}} | |||
| @@ -783,7 +783,6 @@ | |||
| } | |||
| let dirKey="isOnlyDir--:&"; | |||
| function loadSelectedModelFile(trainJob){ | |||
| console.log("trainJob=" + trainJob); | |||
| $('#choice_file').dropdown('clear') | |||
| $("#model-file").empty() | |||
| if(trainJob ==null || trainJob ==""){ | |||
| @@ -71,7 +71,7 @@ | |||
| <div class="row"> | |||
| <!-- 任务名 --> | |||
| {{$JobID := '0'}} | |||
| {{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK"}} | |||
| {{if eq .JobType "DEBUG" "SNN4IMAGENET" "BRAINSCORE" "BENCHMARK" "MODELSAFETY"}} | |||
| {{$JobID = .Cloudbrain.ID}} | |||
| {{else}} | |||
| {{$JobID = .JobID}} | |||
| @@ -92,6 +92,13 @@ | |||
| <span class="fitted" | |||
| style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| {{else if eq .JobType "MODELSAFETY"}} | |||
| <a class="title" | |||
| href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelsafety/{{$JobID}}/show" | |||
| title="{{.DisplayJobName}}" style="font-size: 14px;padding-right:0px"> | |||
| <span class="fitted" | |||
| style="width: 90%;vertical-align: middle;">{{.DisplayJobName}}</span> | |||
| </a> | |||
| {{else if eq .JobType "INFERENCE"}} | |||
| <a class="title" | |||
| href="{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .Cloudbrain.Type 1}}modelarts{{else if eq .Cloudbrain.Type 0}}cloudbrain{{end}}/inference-job/{{$JobID}}" | |||
| @@ -117,8 +124,7 @@ | |||
| </div> | |||
| <!-- 集群 --> | |||
| <div class="one wide column text center nowrap" style="width:8% !important;"> | |||
| <span | |||
| style="font-size: 12px;">{{if .Cluster}}{{.Cluster}}{{else}}--{{end}}</span> | |||
| <span style="font-size: 12px;" class="cluster_{{.DisplayJobName}}_{{$JobID}}">{{if .Cluster}}{{.Cluster}}{{else}}--{{end}}</span> | |||
| </div> | |||
| <!-- 任务状态 --> | |||
| <div class="two wide column text center nowrap" | |||
| @@ -155,8 +161,7 @@ | |||
| <!-- 智算中心 --> | |||
| <div class="one wide column text center nowrap" style="width:8% !important;"> | |||
| <span | |||
| style="font-size: 12px;">{{if .AiCenter}}{{.AiCenter}}{{else}}--{{end}}</span> | |||
| <span style="font-size: 12px;" class="aicenter_{{.DisplayJobName}}_{{$JobID}}">{{if .AiCenter}}{{.AiCenter}}{{else}}--{{end}}</span> | |||
| </div> | |||
| <!-- XPU类型 --> | |||
| <div class="one wide column text center nowrap" style="width:10% !important;"> | |||
| @@ -169,6 +174,17 @@ | |||
| var spanEl = document.querySelector('.card_type_{{.DisplayJobName}}_{{$JobID}}'); | |||
| spanEl.setAttribute('title', cardType); | |||
| spanEl.innerText = cardType; | |||
| var cluster = spec.Cluster || '--'; | |||
| var clusterName = document.querySelector('.cloudbrain_debug').dataset['cluster' + cluster[0] + cluster.toLocaleLowerCase().slice(1)] || '--'; | |||
| spanEl = document.querySelector('.cluster_{{.DisplayJobName}}_{{$JobID}}'); | |||
| spanEl.setAttribute('title', cluster); | |||
| spanEl.innerText = clusterName; | |||
| var aiCenter = spec.AiCenterName || '--'; | |||
| spanEl = document.querySelector('.aicenter_{{.DisplayJobName}}_{{$JobID}}'); | |||
| spanEl.setAttribute('title', aiCenter); | |||
| spanEl.innerText = aiCenter; | |||
| })(); | |||
| </script> | |||
| <!-- 项目 --> | |||
| @@ -202,23 +218,35 @@ | |||
| {{end}} | |||
| <!-- 停止任务 --> | |||
| <div class="ui compact buttons"> | |||
| {{if eq .JobType "DEBUG" "BENCHMARK" "SNN4IMAGENET" "BRAINSCORE"}} | |||
| <form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> | |||
| {{$.CsrfTokenHtml}} | |||
| {{if eq .JobType "MODELSAFETY"}} | |||
| <form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> | |||
| {{$.CsrfTokenHtml}} | |||
| <a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" | |||
| class='ui basic ai_stop {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "SUCCEEDED" "STOPPED" "STOPPING" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' | |||
| data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelsafety/{{$JobID}}/stop' | |||
| data-jobid="{{$JobID}}"> | |||
| {{$.i18n.Tr "repo.stop"}} | |||
| </a> | |||
| </form> | |||
| {{else}} | |||
| {{if eq .JobType "DEBUG" "BENCHMARK" "SNN4IMAGENET" "BRAINSCORE"}} | |||
| <form id="stopForm-{{$JobID}}" style="margin-left:-1px;"> | |||
| {{$.CsrfTokenHtml}} | |||
| <a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" | |||
| class='ui basic ai_stop {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "SUCCEEDED" "STOPPED" "STOPPING" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' | |||
| data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else if eq .JobType "BENCHMARK" }}/cloudbrain/benchmark{{else if eq .ComputeResource "NPU" }}/modelarts/notebook{{end}}/{{$JobID}}/stop' | |||
| data-jobid="{{$JobID}}"> | |||
| {{$.i18n.Tr "repo.stop"}} | |||
| </a> | |||
| </form> | |||
| {{else}} | |||
| <a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" | |||
| class='ui basic ai_stop {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "SUCCEEDED" "STOPPED" "STOPPING" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' | |||
| data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .ComputeResource "CPU/GPU"}}/cloudbrain{{else if eq .JobType "BENCHMARK" }}/cloudbrain/benchmark{{else if eq .ComputeResource "NPU" }}/modelarts/notebook{{end}}/{{$JobID}}/stop' | |||
| data-jobid="{{$JobID}}"> | |||
| class='ui basic ai_stop_version {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "STOPPED" "SUCCEEDED" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' | |||
| data-repopath='{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 1}}modelarts/inference-job{{else}}cloudbrain/train-job{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}modelarts/train-job{{else if eq .Cloudbrain.Type 0}}cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}grampus/train-job{{end}}{{end}}' | |||
| data-jobid="{{$JobID}}" data-version="{{.VersionName}}"> | |||
| {{$.i18n.Tr "repo.stop"}} | |||
| </a> | |||
| </form> | |||
| {{else}} | |||
| <a style="padding: 0.5rem 1rem;" id="ai-stop-{{$JobID}}" | |||
| class='ui basic ai_stop_version {{if eq .Status "KILLED" "FAILED" "START_FAILED" "KILLING" "COMPLETED" "STOPPED" "SUCCEEDED" "CREATE_FAILED"}}disabled {{else}} blue {{end}}button' | |||
| data-repopath='{{.Repo.OwnerName}}/{{.Repo.Name}}/{{if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 1}}modelarts/inference-job{{else}}cloudbrain/train-job{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}modelarts/train-job{{else if eq .Cloudbrain.Type 0}}cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}grampus/train-job{{end}}{{end}}' | |||
| data-jobid="{{$JobID}}" data-version="{{.VersionName}}"> | |||
| {{$.i18n.Tr "repo.stop"}} | |||
| </a> | |||
| {{end}} | |||
| {{end}} | |||
| </div> | |||
| {{if eq .JobType "BENCHMARK"}} | |||
| @@ -228,7 +256,6 @@ | |||
| {{$.i18n.Tr "repo.score"}} | |||
| </a> | |||
| </div> | |||
| {{end}} | |||
| <!-- 修改任务 --> | |||
| {{if eq .JobType "TRAIN"}} | |||
| @@ -239,6 +266,18 @@ | |||
| </div> | |||
| {{end}} | |||
| <!-- 删除任务 --> | |||
| {{if eq .JobType "MODELSAFETY"}} | |||
| <form class="ui compact buttons" id="delForm-{{$JobID}}" | |||
| action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/modelsafety/{{$JobID}}/del?ishomepage=true' | |||
| method="post"> | |||
| {{$.CsrfTokenHtml}} | |||
| <a style="padding: 0.5rem 1rem;margin-left:0.2rem" id="ai-delete-{{$JobID}}" | |||
| class="ui basic ai_delete blue button" | |||
| style="border-radius: .28571429rem;"> | |||
| {{$.i18n.Tr "repo.delete"}} | |||
| </a> | |||
| </form> | |||
| {{else}} | |||
| <form class="ui compact buttons" id="delForm-{{$JobID}}" | |||
| action='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}{{if eq .JobType "BENCHMARK"}}/cloudbrain/benchmark{{else if or (eq .JobType "SNN4IMAGENET") (eq .JobType "BRAINSCORE")}}/cloudbrain{{else if eq .JobType "DEBUG"}}{{if eq .ComputeResource "NPU"}}/modelarts/notebook{{else}}/cloudbrain{{end}}{{else if eq .JobType "TRAIN"}}{{if eq .Cloudbrain.Type 1}}/modelarts/train-job{{else if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{else if eq .Cloudbrain.Type 2}}/grampus/train-job{{end}}{{else if eq .JobType "INFERENCE"}}{{if eq .Cloudbrain.Type 0}}/cloudbrain/train-job{{end}}{{end}}/{{$JobID}}/del?ishomepage=true' | |||
| method="post"> | |||
| @@ -250,6 +289,8 @@ | |||
| {{$.i18n.Tr "repo.delete"}} | |||
| </a> | |||
| </form> | |||
| {{end}} | |||
| </div> | |||
| </div> | |||
| </div> | |||