Browse Source

Merge remote-tracking branch 'origin/V20220616' into zouap_static

tags/v1.22.7.1
zouap 3 years ago
parent
commit
5adf563b35
14 changed files with 76 additions and 29 deletions
  1. +15
    -0
      models/dataset.go
  2. +1
    -1
      modules/modelarts/resty.go
  3. +1
    -0
      options/locale/locale_en-US.ini
  4. +2
    -1
      options/locale/locale_zh-CN.ini
  5. +7
    -0
      routers/home.go
  6. +1
    -1
      routers/repo/dataset.go
  7. +1
    -3
      templates/explore/datasets.tmpl
  8. +2
    -1
      templates/repo/create.tmpl
  9. +4
    -4
      templates/repo/datasets/index.tmpl
  10. +8
    -2
      templates/repo/modelarts/trainjob/show.tmpl
  11. +8
    -3
      templates/repo/modelmanage/index.tmpl
  12. +14
    -2
      templates/repo/modelmanage/showinfo.tmpl
  13. +1
    -1
      web_src/js/components/Model.vue
  14. +11
    -10
      web_src/js/index.js

+ 15
- 0
models/dataset.go View File

@@ -107,6 +107,7 @@ type SearchDatasetOptions struct {
Category string
Task string
License string
DatasetIDs []int64
ListOptions
SearchOrderBy
IsOwner bool
@@ -177,6 +178,12 @@ func SearchDatasetCondition(opts *SearchDatasetOptions) builder.Cond {
}
}

if len(opts.DatasetIDs) > 0 {
subCon := builder.NewCond()
subCon = subCon.And(builder.In("dataset.id", opts.DatasetIDs))
cond = cond.Or(subCon)
}

return cond
}

@@ -447,3 +454,11 @@ func IncreaseDownloadCount(datasetID int64) error {

return nil
}

func GetCollaboratorDatasetIdsByUserID(userID int64) []int64 {
var datasets []int64
_ = x.Table("dataset").Join("INNER", "collaboration", "dataset.repo_id = collaboration.repo_id and collaboration.mode>0 and collaboration.user_id=?", userID).
Cols("dataset.id").Find(&datasets)
return datasets

}

+ 1
- 1
modules/modelarts/resty.go View File

@@ -1131,7 +1131,7 @@ sendjob:
res, err := client.R().
SetAuthToken(TOKEN).
SetResult(&result).
Get(HOST + "/v1/" + setting.ProjectID + urlTrainJob + "/" + jobID + "/versions/" + versionID + "/pod/" + podName + "/metric-statistic")
Get(HOST + "/v1/" + setting.ProjectID + urlTrainJob + "/" + jobID + "/versions/" + versionID + "/pod/" + podName + "/metric-statistic?statistic_type=each")

if err != nil {
return nil, fmt.Errorf("resty GetTrainJobMetricStatistic: %v", err)


+ 1
- 0
options/locale/locale_en-US.ini View File

@@ -1092,6 +1092,7 @@ modelarts.train_job.fast_parameter_setting_config_link=fast_parameter_setting_co
modelarts.train_job.frames=frames
modelarts.train_job.algorithm_origin=Algorithm Origin
modelarts.train_job.AI_driver=AI Engine
modelarts.train_job.AI_Engine=AI Engine
modelarts.train_job.start_file=Start File
modelarts.train_job.boot_file_helper=The startup file is the entry file that your program executes, and it must be a file ending in .py
modelarts.train_job.dataset=Dataset


+ 2
- 1
options/locale/locale_zh-CN.ini View File

@@ -1102,6 +1102,7 @@ modelarts.train_job.fast_parameter_setting_config_link=这里
modelarts.train_job.frames=常用框架
modelarts.train_job.algorithm_origin=算法来源
modelarts.train_job.AI_driver=AI引擎
modelarts.train_job.AI_Engine=模型框架
modelarts.train_job.start_file=启动文件
modelarts.train_job.boot_file_helper=启动文件是您程序执行的入口文件,必须是以.py结尾的文件。比如train.py、main.py、example/train.py、case/main.py。
modelarts.train_job.boot_file_place=填写启动文件路径,默认为train.py
@@ -1197,7 +1198,7 @@ template.topics=主题
template.avatar=头像
template.issue_labels=任务标签
template.one_item=必须至少选择一个模板项
template.one_promise=创建项目需承诺使用协议
template.one_promise=创建项目需承诺遵守使用协议
template.invalid=必须选择一个模板项目
template.repo_adress=项目地址
template.repo_path=项目地址


+ 7
- 0
routers/home.go View File

@@ -343,6 +343,12 @@ func ExploreDatasets(ctx *context.Context) {
if ctx.User != nil && !ctx.User.IsAdmin {
ownerID = ctx.User.ID
}
var datasetsIds []int64
if ownerID > 0 {

datasetsIds = models.GetCollaboratorDatasetIdsByUserID(ownerID)
}

opts := &models.SearchDatasetOptions{
Keyword: keyword,
IncludePublic: true,
@@ -351,6 +357,7 @@ func ExploreDatasets(ctx *context.Context) {
Task: task,
License: license,
OwnerID: ownerID,
DatasetIDs: datasetsIds,
RecommendOnly: ctx.QueryBool("recommend"),
ListOptions: models.ListOptions{
Page: page,


+ 1
- 1
routers/repo/dataset.go View File

@@ -173,7 +173,7 @@ func DatasetIndex(ctx *context.Context) {
uploader, _ := models.GetUserByID(attachment.UploaderID)
attachment.Uploader = uploader
if !strings.HasSuffix(attachment.Name, ".zip") {
attachment.DecompressState = 3 //非zip文件
attachment.DecompressState = -1 //非zip文件
}

}


+ 1
- 3
templates/explore/datasets.tmpl View File

@@ -157,8 +157,6 @@
href="{{$.Link}}?sort=moststars&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.moststars"}}</a>
<a class="{{if eq .SortType "mostusecount"}}active{{end}} item"
href="{{$.Link}}?sort=mostusecount&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.mostusecount"}}</a>
<a class="{{if eq .SortType "fewestusecount"}}active{{end}} item"
href="{{$.Link}}?sort=fewestusecount&q={{$.Keyword}}&tab={{$.TabName}}&category={{$.Category}}&task={{$.Task}}&license={{$.License}}&recommend={{$.Recommend}}">{{.i18n.Tr "repo.issues.filter_sort.fewestusecount"}}</a>
</div>
</div>
</div>
@@ -201,7 +199,7 @@
</span>
{{else}}
<span
style="display: flex;align-items: center;justify-content: flex-end;cursor: pointer;font-size: 12px;font-weight: normal;flex: 1;">
style="display: flex;align-items: center;justify-content: flex-end;cursor: pointer;font-size: 12px;font-weight: normal;flex: 1;margin-left: 1.5rem;">

<div style="line-height: 1;margin-right: 4px;margin-bottom: -2px;">
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32"


+ 2
- 1
templates/repo/create.tmpl View File

@@ -155,7 +155,8 @@
<input class="hidden" name="auto_agree" type="checkbox">
<label
style="width: 76%;text-align: justify;line-height: 1.5;">{{.i18n.Tr "repo.use_repo_agreement"}}
<a href="/home/term/">{{.i18n.Tr "repo.openi_use_agreement"}}</a></label>
<a target="_blank"
href="/home/term/">{{.i18n.Tr "repo.openi_use_agreement"}}</a></label>
</div>
</div>
</div>


+ 4
- 4
templates/repo/datasets/index.tmpl View File

@@ -11,7 +11,7 @@

.dataset_title {
font-size: 14px;
max-width: 80%;
/* max-width: 80%; */
display: inline-block !important;
margin-left: 6px !important;
padding-right: 0 !important;
@@ -279,7 +279,7 @@
<el-tooltip class="item" effect="dark" placement="top" popper-class="diy-popper">
<div slot="content"><span class="wrap">

{{if ne .DecompressState 3}}{{$.i18n.Tr "dataset.unzip_status"}}:{{if eq .DecompressState 1}}{{$.i18n.Tr "dataset.unzip_successed"}}{{else if eq .DecompressState 0}}{{$.i18n.Tr "dataset.unzip_stared"}}{{else}}{{$.i18n.Tr "dataset.unzip_failed"}}{{end}}
{{if ne .DecompressState -1}}{{$.i18n.Tr "dataset.unzip_status"}}:{{if eq .DecompressState 1}}{{$.i18n.Tr "dataset.unzip_successed"}}{{else if eq .DecompressState 0 2}}{{$.i18n.Tr "dataset.unzip_stared"}}{{else}}{{$.i18n.Tr "dataset.unzip_failed"}}{{end}}
&nbsp;&nbsp;{{end}}<i
class="ri-download-line"></i>{{$.i18n.Tr "dataset.download"}}:{{.DownloadCount}}
{{if .Description}}&nbsp;&nbsp;{{$.i18n.Tr "dataset.description"}}:{{.Description}}{{end}}</span>
@@ -288,10 +288,10 @@
{{if eq .DecompressState 1}}
<i class="ri-folder-open-line" style="color: #5bb973;"
title='{{$.i18n.Tr "dataset.unzip_successed"}}'></i>
{{else if eq .DecompressState 0}}
{{else if eq .DecompressState 0 2}}
<i class="ri-folder-chart-2-line" style="color: #888888;"
title='{{$.i18n.Tr "dataset.unzip_stared"}}'></i>
{{else if eq .DecompressState 2}}
{{else if eq .DecompressState 3}}
<i class="ri-folder-forbid-line" style="color: #101010;"
title='{{$.i18n.Tr "dataset.unzip_failed"}}'></i>
{{else}}


+ 8
- 2
templates/repo/modelarts/trainjob/show.tmpl View File

@@ -487,8 +487,8 @@
</div>
<div class="ui tab" data-tab="second{{$k}}">
<div>
<a class='{{if and (.CanModify) (eq .Status "KILLED" "FAILED" "START_FAILED" "STOPPED" "COMPLETED") }}ti-download-file{{else}}disabled{{end}}'
<a id="{{.VersionName}}-log-down"
class='{{if and (.CanModify) (eq .Status "KILLED" "FAILED" "START_FAILED" "STOPPED" "COMPLETED") }}ti-download-file{{else}}disabled{{end}}'
href="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/download_log_file?version_name={{.VersionName}}">
<i class="ri-download-cloud-2-line"></i>
<span style="margin-left: 0.3rem;">{{$.i18n.Tr "repo.modelarts.download_log"}}</span>
@@ -734,6 +734,12 @@
// detail status and duration
$('#' + version_name + '-duration').text(data.JobDuration)
$('#' + version_name + '-status').text(data.JobStatus)
console.log(data)
if (["KILLED", "FAILED", "START_FAILED", "STOPPED", "COMPLETED"].includes(data.JobStatus)) {
$(`#${version_name}-log-down`).removeClass('disabled').addClass('ti-download-file')
$('#' + version_name + '-stop').addClass('disabled')
}

loadLog(version_name)




+ 8
- 3
templates/repo/modelmanage/index.tmpl View File

@@ -1,5 +1,10 @@
<!-- 头部导航栏 -->
{{template "base/head" .}}
<style>
.defaulttext{
color: rgba(0,0,0,.87)
}
</style>
<!-- 弹窗 -->
<div id="mask">
<div id="loadingPage">
@@ -140,7 +145,7 @@
<label>模型框架</label>
<div class="ui dropdown selection search width70" id="choice_Engine">
<input type="hidden" id="Engine" name="Engine" required>
<div class="default text">选择模型框架</div>
<div class="default defaulttext">选择模型框架</div>
<i class="dropdown icon"></i>
<div class="menu" id="job-Engine">
@@ -321,7 +326,7 @@
}
itemHtml += "<option class=\"item\" data-value=\"3\">Other</option>"
$('#choice_Engine .default.text').text(selectedText)
$('#choice_Engine .default.defaulttext').text(selectedText)
$('#choice_Engine input[name="Engine"]').val(selectedValue)
$("#job-Engine").append(itemHtml);
$("#choice_Engine").addClass('disabled')
@@ -330,7 +335,7 @@
itemHtml += "<option class=\"item\" data-value=\"1\">TensorFlow</option>"
itemHtml += "<option class=\"item\" data-value=\"2\">MindSpore</option>"
itemHtml += "<option class=\"item\" data-value=\"3\">Other</option>"
$('#choice_Engine .default.text').text("Pytorch");
$('#choice_Engine .default.defaulttext').text("Pytorch");
$('#choice_Engine input[name="Engine"]').val(0)
$("#job-Engine").append(itemHtml);
$("#choice_Engine").removeClass('disabled');


+ 14
- 2
templates/repo/modelmanage/showinfo.tmpl View File

@@ -141,7 +141,7 @@
<td class="ti-text-form-content word-elipsis"><span id="Parameters" title=""></span></td>
</tr>
<tr>
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.AI_driver"}}</td>
<td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.AI_Engine"}}</td>
<td class="ti-text-form-content word-elipsis"><span id="EngineName" title=""></span></td>
</tr>
<tr>
@@ -232,13 +232,25 @@ function loadInfo(){
renderInfo(initObj,initModelAcc,id)
loadModelFile(data[0].ID,data[0].Version,'','','init')
})
}
function getEngineName(model){
if(model.Engine == 0){
return "Pytorch";
}else if(model.Engine == 1 || model.Engine == 121){
return "TensorFlow";
}else if(model.Engine == 2 || model.Engine == 122){
return "MindSpore";
}else{
return "Other"
}
}
function transObj(data){
let {ID,Name,Version,Label,Size,Description,CreatedUnix,Accuracy,CodeBranch,CodeCommitID,TrainTaskInfo} = data[0]
let modelAcc = JSON.parse(Accuracy)
TrainTaskInfo = JSON.parse(TrainTaskInfo)
// Parameters = JSON.parse(Parameters)
let {Parameters,EngineName} = TrainTaskInfo
let {Parameters} = TrainTaskInfo
let EngineName = getEngineName(data[0])
Parameters = JSON.parse(Parameters)
Parameters = Parameters.parameter.length === 0 ? '--':Parameters.parameter
let size = tranSize(Size)


+ 1
- 1
web_src/js/components/Model.vue View File

@@ -60,7 +60,7 @@
</el-table-column>
<el-table-column
prop="EngineName"
label="AI引擎"
label="模型框架"
align="center"
min-width="8.5%"
>


+ 11
- 10
web_src/js/index.js View File

@@ -1214,7 +1214,7 @@ async function initRepository() {
files: $attachments
},
(data) => {
if (data.length === 0) {
if (data.length === 0 || data.content === '') {
$renderContent.html($('#no-content').html());
} else {
$renderContent.html(data.content);
@@ -1225,7 +1225,7 @@ async function initRepository() {
let imageShow = ''
const $content = $segment.parent();
if (!$content.find('.ui.small.images').length) {
if (data.attachments !== '') {
if (data.attachments !== '' && data.attachments) {
if ($content.find('.ui.middle.aligned').length === 0) {
imageShow += '<div class="ui clearing divider"></div>'
imageShow += '<div class="ui middle aligned padded grid">'
@@ -5093,8 +5093,9 @@ function initChartsNpu() {
data: []
},
grid: {
top: '30%',
top: '35%',
bottom: '2%',
x: '2%',
containLabel: true
},
tooltip: {
@@ -5119,8 +5120,7 @@ function initChartsNpu() {
name: '时间(min)'
},
yAxis: {
min: 0,
max: 100,

show: true,
name: '占有率(%)',
axisLine: {
@@ -5131,19 +5131,21 @@ function initChartsNpu() {

series: []
};
const sortBy = (arr, k) => arr.concat().sort((a, b) => (a[k] > b[k] ? 1 : a[k] < b[k] ? -1 : 0));
$('.metric_chart').click(function (e) {
let versionName = $(this).data('version')
console.log("11111", versionName)
let myCharts = echarts.init(document.getElementById(`metric-${versionName}`))
$.get(`${window.config.AppSubUrl}/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/metric_statistics?version_name=${versionName}&statistic_type=each`, (res) => {
$.get(`${window.config.AppSubUrl}/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/metric_statistics?version_name=${versionName}&statistic_type=each&metrics=`, (res) => {
let filterDta = res.MetricsInfo.filter((item) => {

return !(['recvBytesRate', 'diskWriteRate', 'sendBytesRate', 'diskReadRate'].includes(item.metric))
})
filterDta = sortBy(filterDta, "metric")
let legenData = filterDta.map((item) => {
return item.metric
})
let seriesData = filterDta.map((item) => {
let value = item.value.map((item) => { return item > 0 ? item : '0' })
let seriesOption = {
name: item.metric,
type: 'line',
@@ -5157,13 +5159,12 @@ function initChartsNpu() {
shadowBlur: 10,
shadowOffsetY: 8
},
data: item.value
data: value
}
return seriesOption
})
let xLength = res.MetricsInfo[0].value.length
console.log(legenData)
options.xAxis.data = Array.from({ length: xLength }, (_, index) => index + 1)
options.xAxis.data = Array.from({ length: xLength }, (_, index) => index)
options.legend.data = legenData
options.series = seriesData
options && myCharts.setOption(options);


Loading…
Cancel
Save