diff --git a/models/cloudbrain.go b/models/cloudbrain.go index a53bf0287..29b55b97e 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -1092,6 +1092,7 @@ type DatasetDownload struct { DatasetName string `json:"dataset_name"` DatasetDownloadLink string `json:"dataset_download_link"` RepositoryLink string `json:"repository_link"` + IsDelete bool `json:"is_delete"` } type DataSource struct { diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 0368739cf..5eac4cf2e 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -959,6 +959,7 @@ unfavorite=Unlike favorite=Like disassociate=Disassociate benchmark_dataset_tip=Note: first use the dataset function to upload the model, and then select the model from the dataset list. +file_deleted=The file has been deleted [repo] owner = Owner @@ -1140,7 +1141,7 @@ modelarts.train_job.compute_node=Compute Node modelarts.create_model = Create Model modelarts.model_label=Model Label modelarts.infer_dataset = Inference Dataset - +modelarts.train_job.label_place=Input labels, multiple labels are separated by spaces modelarts.train_job.basic_info=Basic Info modelarts.train_job.job_status=Job Status @@ -1221,7 +1222,10 @@ model_Evaluation_not_created = Model evaluation has not been created repo_not_initialized = Code version: You have not initialized the code repository, please initialized first ; debug_task_running_limit =Running time: no more than 4 hours, it will automatically stop if it exceeds 4 hours; dataset_desc = Dataset: Cloud Brain 1 provides CPU/GPU,Cloud Brain 2 provides Ascend NPU.And dataset also needs to be uploaded to the corresponding environment; -platform_instructions = Instructions for use: You can refer to the OpenI_Learning course of Openi AI collaboration platform. +platform_instructions = Instructions for use: You can refer to the OpenI_Learning course of Qizhi AI collaboration platform. +platform_instructions1 = Instructions for use: You can refer to the +platform_instructions2 = OpenI_Learning +platform_instructions3 = course of Openi AI collaboration platform. model_not_exist = Model file: You do not have a model file yet, please generate and export the model through the training task first ; benchmark_leaderboards = Benchmark leaderboards @@ -1244,11 +1248,11 @@ model.convert=Model Transformation model.list=Model List model.manage.create_new_convert_task=Create Model Transformation Task -model.manage.notcreatemodel=No model has been created. +model.manage.notcreatemodel=No model has been created model.manage.init1=Code version: You have not initialized the code repository, please model.manage.init2=initialized first ; model.manage.createtrainjob_tip=Training task: you haven't created a training task, please create it first -model.manage.createtrainjob=Training task +model.manage.createtrainjob=Training task. model.manage.delete=Delete Model model.manage.delete_confirm=Are you sure to delete this model? Once this model is deleted, it cannot be restored. model.manage.select.trainjob=Select train task @@ -1260,9 +1264,9 @@ model.manage.modellabel=Model label model.manage.modeldesc=Model description model.manage.baseinfo=Base Information modelconvert.notcreate=No model conversion task has been created. -modelconvert.importfirst1=Please import first -modelconvert.importfirst2=download model -modelconvert.importfirst3=, then converts it. +modelconvert.importfirst1=Please import the +modelconvert.importfirst2=model +modelconvert.importfirst3=first, then converts it. modelconvert.download=Download modelconvert.taskname=Task name modelconvert.modelname=Model name diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index c6cb6a576..2fbd3ab52 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -965,6 +965,7 @@ unfavorite=取消收藏 favorite=收藏 disassociate=取消关联 benchmark_dataset_tip=说明:先使用数据集功能上传模型,然后从数据集列表选模型。 +file_deleted=文件已经被删除 [repo] owner=拥有者 @@ -1235,6 +1236,10 @@ repo_not_initialized = 代码版本:您还没有初始化代码仓库,请先 debug_task_running_limit = 运行时长:最长不超过4个小时,超过4个小时将自动停止; dataset_desc = 数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境; platform_instructions = 使用说明:可以参考启智AI协作平台小白训练营课程。 +platform_instructions1 = 使用说明:可以参考启智AI协作平台 +platform_instructions2 = 小白训练营课程 +platform_instructions3 = 。 + model_not_exist = 模型文件:您还没有模型文件,请先通过训练任务产生并 导出模型 ; benchmark_leaderboards = 基准测试排行榜 @@ -1261,7 +1266,7 @@ model.manage.notcreatemodel=未创建过模型 model.manage.init1=代码版本:您还没有初始化代码仓库,请先 model.manage.init2=创建代码版本; model.manage.createtrainjob_tip=训练任务:您还没创建过训练任务,请先创建 -model.manage.createtrainjob=训练任务 +model.manage.createtrainjob=训练任务。 model.manage.delete=删除模型 model.manage.delete_confirm=你确认删除该模型么?此模型一旦删除不可恢复。 model.manage.select.trainjob=选择训练任务 @@ -1274,7 +1279,7 @@ model.manage.modeldesc=模型描述 model.manage.baseinfo=基本信息 modelconvert.notcreate=未创建过模型转换任务 modelconvert.importfirst1=请您先导入 -modelconvert.importfirst2=模型下载 +modelconvert.importfirst2=模型 modelconvert.importfirst3=,然后再对其进行转换。 modelconvert.download=下载 modelconvert.taskname=任务名称 diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index c1e89dde5..2d8bebf4b 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -928,7 +928,7 @@ func cloudBrainShow(ctx *context.Context, tpName base.TplName, jobType models.Jo } } - ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, false) + ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false) ctx.Data["task"] = task labelName := strings.Fields(task.LabelName) ctx.Data["LabelName"] = labelName diff --git a/routers/repo/grampus.go b/routers/repo/grampus.go index 33e111df2..6fc77a454 100755 --- a/routers/repo/grampus.go +++ b/routers/repo/grampus.go @@ -713,7 +713,7 @@ func GrampusTrainJobShow(ctx *context.Context) { taskList := make([]*models.Cloudbrain, 0) taskList = append(taskList, task) ctx.Data["version_list_task"] = taskList - ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, false) + ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false) ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) ctx.Data["displayJobName"] = task.DisplayJobName diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 40e8076fb..4a9b8c56f 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -285,7 +285,7 @@ func NotebookShow(ctx *context.Context) { datasetDownload := make([]models.DatasetDownload, 0) if ctx.IsSigned { if task.Uuid != "" && task.UserID == ctx.User.ID { - datasetDownload = GetCloudBrainDataSetInfo(task.Uuid, true) + datasetDownload = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, true) } } user, err := models.GetUserByID(task.UserID) @@ -331,34 +331,43 @@ func NotebookShow(ctx *context.Context) { ctx.HTML(200, tplModelArtsNotebookShow) } -func GetCloudBrainDataSetInfo(uuid string, isNeedDown bool) []models.DatasetDownload { +func GetCloudBrainDataSetInfo(uuid string, datasetname string, isNeedDown bool) []models.DatasetDownload { datasetDownload := make([]models.DatasetDownload, 0) uuidList := strings.Split(uuid, ";") - for _, uuidStr := range uuidList { + datasetnameList := strings.Split(datasetname, ";") + for i, uuidStr := range uuidList { + name := "" + link := "" + isDelete := false attachment, err := models.GetAttachmentByUUID(uuidStr) if err != nil { log.Error("GetAttachmentByUUID failed:%v", err.Error()) - return datasetDownload - } - dataset, err := models.GetDatasetByID(attachment.DatasetID) - if err != nil { - log.Error("GetDatasetByID failed:%v", err.Error()) - return datasetDownload - } - repo, err := models.GetRepositoryByID(dataset.RepoID) - if err != nil { - log.Error("GetRepositoryByID failed:%v", err.Error()) - return datasetDownload + name = datasetnameList[i] + isDelete = true + } else { + name = attachment.Name + dataset, err := models.GetDatasetByID(attachment.DatasetID) + if err != nil { + log.Error("GetDatasetByID failed:%v", err.Error()) + } else { + repo, err := models.GetRepositoryByID(dataset.RepoID) + if err != nil { + log.Error("GetRepositoryByID failed:%v", err.Error()) + } else { + link = repo.Link() + "/datasets" + } + } } url := "" if isNeedDown { url = attachment.S3DownloadURL() } datasetDownload = append(datasetDownload, models.DatasetDownload{ - DatasetName: attachment.Name, + DatasetName: name, DatasetDownloadLink: url, - RepositoryLink: repo.Link() + "/datasets", + RepositoryLink: link, + IsDelete: isDelete, }) } return datasetDownload @@ -1810,7 +1819,7 @@ func TrainJobShow(ctx *context.Context) { } else { VersionListTasks[i].Parameters = "" } - datasetList = append(datasetList, GetCloudBrainDataSetInfo(task.Uuid, false)) + 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) } @@ -2526,7 +2535,7 @@ func InferenceJobShow(ctx *context.Context) { ctx.Data["displayJobName"] = task.DisplayJobName ctx.Data["task"] = task ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) - ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, false) + ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false) tempUids := []int64{} tempUids = append(tempUids, task.UserID) JobCreater, err := models.GetUserNamesByIDs(tempUids) diff --git a/templates/repo/cloudbrain/inference/show.tmpl b/templates/repo/cloudbrain/inference/show.tmpl index 848ccfc20..3ec01417e 100644 --- a/templates/repo/cloudbrain/inference/show.tmpl +++ b/templates/repo/cloudbrain/inference/show.tmpl @@ -500,7 +500,13 @@
{{range $m ,$n := $.datasetDownload}}