Reviewed-on: https://git.openi.org.cn/OpenI/aiforge/pulls/2801 Reviewed-by: zhoupzh <zhoupzh@pcl.ac.cn>pull/2811/head
@@ -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 { | |||
@@ -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 | |||
@@ -1221,6 +1222,7 @@ model_Evaluation_not_created = Model evaluation has not been created | |||
repo_not_initialized = Code version: You have not initialized the code repository, please <a href="%s"> initialized </a> 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 <a href="https://git.openi.org.cn/zeizei/OpenI_Learning"> OpenI_Learning </a> 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. | |||
@@ -965,6 +965,7 @@ unfavorite=取消收藏 | |||
favorite=收藏 | |||
disassociate=取消关联 | |||
benchmark_dataset_tip=说明:先使用数据集功能上传模型,然后从数据集列表选模型。 | |||
file_deleted=文件已经被删除 | |||
[repo] | |||
owner=拥有者 | |||
@@ -1234,6 +1235,7 @@ model_Evaluation_not_created = 未创建过评测任务 | |||
repo_not_initialized = 代码版本:您还没有初始化代码仓库,请先<a href=%s>创建代码版本</a>; | |||
debug_task_running_limit = 运行时长:最长不超过4个小时,超过4个小时将自动停止; | |||
dataset_desc = 数据集:云脑1提供 CPU / GPU 资源,云脑2提供 Ascend NPU 资源,调试使用的数据集也需要上传到对应的环境; | |||
platform_instructions = 使用说明:可以参考启智AI协作平台<a href="https://git.openi.org.cn/zeizei/OpenI_Learning">小白训练营课程</a>。 | |||
platform_instructions1 = 使用说明:可以参考启智AI协作平台 | |||
platform_instructions2 = 小白训练营课程 | |||
platform_instructions3 = 。 | |||
@@ -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 | |||
@@ -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 | |||
@@ -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) | |||
@@ -500,7 +500,13 @@ | |||
<tbody> | |||
{{range $m ,$n := $.datasetDownload}} | |||
<tr> | |||
<td style="word-wrap: break-word;word-break: break-all;"><a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a></td> | |||
<td style="word-wrap: break-word;word-break: break-all;"> | |||
{{if eq .IsDelete true}} | |||
{{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) | |||
{{else}} | |||
<a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a> | |||
{{end}} | |||
</td> | |||
</tr> | |||
{{end}} | |||
@@ -498,7 +498,13 @@ | |||
<tbody> | |||
{{range $m ,$n := $.datasetDownload}} | |||
<tr> | |||
<td style="word-wrap: break-word;word-break: break-all;"><a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a></td> | |||
<td style="word-wrap: break-word;word-break: break-all;"> | |||
{{if eq .IsDelete true}} | |||
{{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) | |||
{{else}} | |||
<a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a> | |||
{{end}} | |||
</td> | |||
</tr> | |||
{{end}} | |||
@@ -464,7 +464,13 @@ | |||
<tbody> | |||
{{range $m ,$n := $.datasetDownload}} | |||
<tr> | |||
<td style="word-wrap: break-word;word-break: break-all;"><a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a></td> | |||
<td style="word-wrap: break-word;word-break: break-all;"> | |||
{{if eq .IsDelete true}} | |||
{{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) | |||
{{else}} | |||
<a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a> | |||
{{end}} | |||
</td> | |||
</tr> | |||
{{end}} | |||
@@ -419,7 +419,12 @@ | |||
<td class="ti-text-form-content"> | |||
<div class="text-span text-span-w"> | |||
{{range $m ,$n := $.datasetDownload}} | |||
<a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a> | |||
{{if eq .IsDelete true}} | |||
{{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) | |||
{{else}} | |||
<a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a> | |||
{{end}} | |||
{{end}} | |||
</div> | |||
</td> | |||
@@ -441,7 +441,14 @@ td, th { | |||
<tbody> | |||
{{range $m ,$n := $.datasetDownload}} | |||
<tr> | |||
<td style="word-wrap: break-word;word-break: break-all;"><a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a></td> | |||
<td style="word-wrap: break-word;word-break: break-all;"> | |||
{{if eq .IsDelete true}} | |||
{{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) | |||
{{else}} | |||
<a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a> | |||
{{end}} | |||
</td> | |||
</tr> | |||
{{end}} | |||
@@ -439,7 +439,14 @@ | |||
<tbody> | |||
{{range $.datasetDownload}} | |||
<tr> | |||
<td style="word-wrap: break-word;word-break: break-all;"><a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a></td> | |||
<td style="word-wrap: break-word;word-break: break-all;"> | |||
{{if eq .IsDelete true}} | |||
{{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) | |||
{{else}} | |||
<a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a> | |||
{{end}} | |||
</td> | |||
<td style="word-wrap: break-word;word-break: break-all;">{{.DatasetDownloadLink}}</td> | |||
<td class="center aligned"><a class="ui poping up clipboard" id="clipboard-btn-dataset" data-original="{{$.i18n.Tr "repo.copy_link"}}" data-success="{{$.i18n.Tr "repo.copy_link_success"}}" data-error="{{$.i18n.Tr "repo.copy_link_error"}}" data-content="{{$.i18n.Tr "repo.copy_link"}}" data-variation="inverted tiny" data-clipboard-text="{{.DatasetDownloadLink}}">{{$.i18n.Tr "dataset.download_copy"}}</a></td> | |||
</tr> | |||
@@ -489,7 +489,13 @@ | |||
{{if eq $k $m}} | |||
{{range $f ,$g := $n}} | |||
<tr> | |||
<td style="word-wrap: break-word;word-break: break-all;"><a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a></td> | |||
<td style="word-wrap: break-word;word-break: break-all;"> | |||
{{if eq .IsDelete true}} | |||
{{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}}) | |||
{{else}} | |||
<a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a> | |||
{{end}} | |||
</td> | |||
</tr> | |||
{{end}} | |||
{{end}} | |||