Browse Source

update

tags/v1.22.10.1^2
chenshihai 3 years ago
parent
commit
2d0fb9ced3
3 changed files with 198 additions and 182 deletions
  1. +10
    -0
      templates/repo/modelsafety/new.tmpl
  2. +185
    -181
      templates/repo/modelsafety/show.tmpl
  3. +3
    -1
      web_src/js/features/cloudrbanin.js

+ 10
- 0
templates/repo/modelsafety/new.tmpl View File

@@ -58,6 +58,8 @@
{{.CsrfTokenHtml}}
<input type="hidden" name="compute_resource" value="{{.compute_resource}}">
<input type="hidden" name="type" value="{{.type}}">
<input type="hidden" id="ai_engine_name" name="engine_names" value="">
<input type="hidden" id="ai_flaver_name" name="flaver_names" value="">
<div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_scenes"}}</label>
<div class="ui blue small menu compact selectcloudbrain">
@@ -158,6 +160,14 @@
<i class="question circle icon" data-content="{{.i18n.Tr "cloudbrain.model_file_postfix_rule"}}" data-position="top center" data-variation="inverted mini"></i>
</span>
</div>
<div class="required inline min_title field " style="display: none;">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.resource_pool"}}</label>
<select class="ui dropdown width48" id="trainjob_resource_pool" name="pool_id">
{{range .resource_pools}}
<option value="{{.ID}}">{{.Value}}</option>
{{end}}
</select>
</div>
{{if not $Grampus}}
{{if eq .datasetType 0}}
<div id="images-new-cb"></div>


+ 185
- 181
templates/repo/modelsafety/show.tmpl View File

@@ -69,7 +69,7 @@
}

.tab_2_content {
min-height: 425px;
min-height: 600px;
margin-left: 10px;
}

@@ -217,14 +217,12 @@
{{$.i18n.Tr "repo.modelarts.evaluate_job"}}
</a>
<div class="divider"> / </div>
<div class="active section">{{.displayJobName}}</div>
<div class="active section" vfield="DisplayJobName"></div>
</div>
</h4>
{{range $k ,$v := .version_list_task}}
<div class="ui accordion border-according" id="accordion{{.VersionName}}"
data-repopath="{{$.RepoRelPath}}/cloudbrain" data-jobid="{{.ID}}" data-version="{{.VersionName}}">
<input type="hidden" id="jobId_input" name="jobId_input" value="{{.JobID}}">
<div class="{{if eq $k 0}}active{{end}} title padding0">
<div class="ui accordion border-according" id="accordion" data-repopath="{{$.RepoRelPath}}/cloudbrain" data-jobid="" vdatajobid="ID" data-version="">
<input type="hidden" id="jobId_input" name="jobId_input" value="" vvalue="JobID">
<div class="active title padding0">
<div class="according-panel-heading">
<div class="accordion-panel-title">
<i class="dropdown icon"></i>
@@ -232,35 +230,30 @@
<span>
<div class="ac-display-inblock title_text acc-margin-bottom">
<span class="cti-mgRight-sm">
<td>{{TimeSinceUnix1 .CreatedUnix}}</td>
<span vtime="CreatedUnix"></span>
</span>

<span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}:
<span id="{{.VersionName}}-status-span"><i id="icon"
style="vertical-align: middle;" class="{{.Status}}"></i><span id="text"
style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span>
<span id="-status-span">
<i id="icon" style="vertical-align: middle;" class="{{.Status}}" vclass="Status"></i>
<span id="text" style="margin-left: 0.4em;font-size: 12px;" vfield="Status"></span>
</span>
</span>
<span
class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}:</span>
<span class="cti-mgRight-sm uc-accordionTitle-black"
id="{{.VersionName}}-duration-span">{{$.duration}}</span>

<span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}:</span>
<span class="cti-mgRight-sm uc-accordionTitle-black" id="-duration-span" vfield="TrainJobDuration"></span>
</div>
</span>
</span>
</div>
</div>
</div>
<div class="{{if eq $k 0}}active{{end}} content">
<div class="active content">
<div class="content-pad">
<div class="ui pointing secondary menu" style="border-bottom: 1px solid rgba(34,36,38,.15);">
<a class="active item"
data-tab="first{{$k}}">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a>
<a class="item log_bottom" data-tab="second{{$k}}"
data-version="{{.VersionName}}">{{$.i18n.Tr "repo.modelarts.log"}}</a>
<a class="active item" data-tab="first0">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a>
<a class="item log_bottom" data-tab="second0" data-version="">{{$.i18n.Tr "repo.modelarts.log"}}</a>
<a class="item log_bottom" data-tab="third0" data-version="">评测结果</a>
</div>
<div class="ui tab active" data-tab="first{{$k}}">
<div class="ui tab active" data-tab="first0">
<div style="padding-top: 10px;">
<div class="tab_2_content">
<div class="ac-grid ac-grid-col2">
@@ -272,79 +265,49 @@
{{$.i18n.Tr "repo.cloudbrain_task"}}
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w">
{{.DisplayJobName}}
</div>
<div class="text-span text-span-w" vfield="DisplayJobName"></div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.status"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-status">
{{.Status}}
</div>
<div class="text-span text-span-w" id="-status" vfield="Status"></div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.createtime"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w">
<span style="font-size: 12px;" class="">
{{TimeSinceUnix1 .CreatedUnix}}
</span>
<span style="font-size: 12px;" class="v-field" vtime="CreatedUnix"></span>
</div>
</td>
</tr>

<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain.time.starttime"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w"
id="{{.VersionName}}-startTime">
{{if not (eq .StartTime 0)}}
{{TimeSinceUnix1 .StartTime}}
{{else}}
--
{{end}}
</div>
<div class="text-span text-span-w v-field" vtime="StartTime" id="-startTime"></div>
</td>
</tr>

<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain.time.endtime"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w"
id="{{.VersionName}}-EndTime">
{{if not (eq .EndTime 0)}}
{{TimeSinceUnix1 .EndTime}}
{{else}}
--
{{end}}
</div>
<div class="text-span text-span-w v-field" vtime="EndTime" id="-EndTime"></div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w"
id="{{.VersionName}}-duration">
{{$.duration}}
</div>
<div class="text-span text-span-w" vfield="TrainJobDuration" id="-duration"></div>
</td>
</tr>
<tr class="ti-no-ng-animate">
@@ -353,107 +316,85 @@
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
<div class="text-span text-span-w" id="-mirror">
<span class="ui poping up clipboard" data-position="top center" id="clipboard-btn" style="cursor:pointer"
data-clipboard-text="{{.Image}}"
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"
vdataclipboardtext="Image"
>
<span title="{{.Image}}">{{.Image}}</span>
</span>
<span vtitle="Image" vfield="Image" ></span></span>
</div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_scenes"}}

{{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_scenes"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w"
id="{{.VersionName}}-BenchmarkTypeName">
{{.BenchmarkType}}
</div>
<div class="text-span text-span-w" vfield="BenchmarkType"></div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_type"}}

{{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_type"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w"
id="{{.VersionName}}-BenchmarkTypeName">
{{.BenchmarkTypeName}}
</div>
<div class="text-span text-span-w" vfield="BenchmarkTypeName"></div>
</td>
</tr>



</tbody>
</table>
</div>
<div class="ac-grid-col">
<table class="ti-form">
<tbody class="ti-text-form">


<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}}
原始数据集
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w">
{{if eq .JobType "BENCHMARK"}}
train.py
{{else}}
--
{{end}}
</div>
<div class="text-span text-span-w" vdataset0="DatasetName"></div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_test"}}
对抗数据集
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w">
{{if eq .JobType "BENCHMARK"}}
test.py
{{else}}
--
{{end}}
</div>
<div class="text-span text-span-w" vdataset1="DatasetName"></div>
</td>
</tr>

<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.train_job.description"}}
{{$.i18n.Tr "repo.modelarts.train_job.run_parameter"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w" title="{{.Description}}">
{{if .Description}}
{{.Description}}
{{else}}
--
{{end}}
</div>
<div class="text-span text-span-w" vtitle="Parameters" vfield="Parameters"></div>
</td>
</tr>
</tbody>
</table>
</div>
<div class="ac-grid-col">
<table class="ti-form">
<tbody class="ti-text-form">
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.code_version"}}
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w" vfield="BranchName"></div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.train_job.description"}}
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w" vtitle="Description" vfield="Description"></div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "cloudbrain.gpu_type"}}
</td>

<td class="ti-text-form-content resorce_type">
<div class="text-span text-span-w"></div>
</td>
@@ -462,59 +403,60 @@
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.train_job.standard"}}
</td>

<td class="ti-text-form-content spec">
<div class="text-span text-span-w"></div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.model_manager"}}
{{$.i18n.Tr "repo.modelarts.model_name"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
{{.DatasetName}}
</div>
<div class="text-span text-span-w" vfield="ModelName"></div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain_creator"}}
{{$.i18n.Tr "repo.modelconvert.modelversion"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w" id="{{.VersionName}}-mirror">
{{if .User}}
{{.User.Name}}
{{else}}
--
{{end}}
</div>
<div class="text-span text-span-w" vfield="ModelVersion"></div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{if eq .BenchmarkTypeName "BRAINSCORE"}}
{{$.i18n.Tr "cloudbrain.brain_area"}}
{{else}}
{{$.i18n.Tr "repo.cloudbrain.benchmark.evaluate_child_type"}}
{{end}}
{{$.i18n.Tr "repo.modelarts.infer_job_model_file"}}
</td>

<td class="ti-text-form-content">
<div class="text-span text-span-w"
id="{{.VersionName}}-BenchmarkChildTypeName">

{{if $.BenchmarkChildTypeName}}
{{$.BenchmarkChildTypeName}}
{{else}}
--
{{end}}
</div>
<div class="text-span text-span-w" vfield="CkptName"></div>
</td>
</tr>

<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.cloudbrain_creator"}}
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w" id="-mirror" vfield="User.Name"></div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
{{$.i18n.Tr "repo.modelarts.train_job.start_file"}}
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w v-field" vfield="BootFile"></div>
</td>
</tr>
<tr class="ti-no-ng-animate">
<td class="ti-no-ng-animate ti-text-form-label text-width80">
评测指标
</td>
<td class="ti-text-form-content">
<div class="text-span text-span-w v-field">--</div>
</td>
</tr>
</tbody>
</table>
</div>
@@ -523,49 +465,92 @@

</div>
</div>
<div class="ui tab" data-tab="second{{$k}}">
<div class="ui tab" data-tab="second0">
<div>
<a id="{{.VersionName}}-log-down"
class='{{if $.canDownload}}ti-download-file{{else}}disabled{{end}}'
href="/api/v1/repos/{{$.RepoRelPath}}/cloudbrain/{{.ID}}/download_log_file">
<i class="ri-download-cloud-2-line"></i>
<span style="margin-left: 0.3rem;">{{$.i18n.Tr "repo.modelarts.download_log"}}</span>
</a>
</div>
<div
<a id="-log-down"
class='{{if $.canDownload}}ti-download-file{{else}}disabled{{end}}'
href="/api/v1/repos/{{$.RepoRelPath}}/cloudbrain/{{.ID}}/download_log_file">
<i class="ri-download-cloud-2-line"></i>
<span style="margin-left: 0.3rem;">{{$.i18n.Tr "repo.modelarts.download_log"}}</span>
</a>
</div>
<div
style="position: relative;border: 1px solid rgba(0,0,0,.2);padding: 0 10px;margin-top: 10px;">
<span>
<a title="滚动到顶部" style="position: absolute; right: -32px;cursor: pointer;"
class="log_top" data-version="{{.VersionName}}"><i class="icon-to-top"></i></a>
class="log_top" data-version=""><i class="icon-to-top"></i></a>
</span>
<span class="log-info-{{.VersionName}}">
<span class="log-info-">
<a title="滚动到底部" style="position: absolute; bottom: 10px;right: -32px;cursor: pointer;"
class="log_bottom" data-version="{{.VersionName}}"><i
class="log_bottom" data-version=""><i
class="icon-to-bottom"></i></a>
</span>
<div class="ui message message{{.VersionName}}" style="display: none;">
<div class="ui message message" style="display: none;">
<div id="header"></div>
</div>
<div class="ui attached log log-scroll" id="log{{.VersionName}}" data-version="{{.VersionName}}"
<div class="ui attached log log-scroll" id="log" data-version=""
style="height: 300px !important; overflow: auto;">
<div class="ui inverted active dimmer">
<div class="ui loader"></div>
</div>
<input type="hidden" name="end_line" value>
<input type="hidden" name="start_line" value>
<pre id="log_file{{.VersionName}}"></pre>
<pre id="log_file"></pre>
</div>
</div>
</div>
</div>
</div>
<div class="ui tab" data-tab="third0">
<div class="__res_container">
<div class="__res_title">
<div class="__res_title_icon"></div>
<div class="__res_title_txt">
<div class="__res_title_txt1">ACC-fgsm_cifar10_1000</div>
<div class="__res_title_txt2">Accuracy: 精确度,计算模型预测精准率,该指标越高,说明评测结果越好。</div>
</div>
<div>
<div class="__res_table_container">
<table>
<tr>
<th>ACC</th>
<th>params1</th>
<th>params2</th>
<th>params3</th>
<th>params4</th>
<th>params5</th>
<th>params6</th>
<th>params7</th>
</tr>
<tr>
<td>非定向</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
</tr>
<tr>
<td>定向</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
<td>100</td>
</tr>
</table>
</div>
<div class="__res_chart_container">

</div>
</div>
</div>
</div>
</div>
</div>
{{end}} {{template "base/paginate" .}}
{{template "base/paginate" .}}
</div>
<!-- 确认模态框 -->
<div id="deletemodel">
@@ -587,11 +572,11 @@
</div>
</div>
</div>


</div>
{{template "base/footer" .}}

<script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script>

<script>
;(function() {
var SPEC = {{ $.Spec }};
@@ -608,13 +593,13 @@
})();
</script>
<script>
$('.menu .item').tab()

$(document).ready(function () {
$('.ui.accordion').accordion({ selector: { trigger: '.icon' } });
});
$(document).ready(function () {
$('.secondary.menu .item').tab();
$('.ui.accordion').accordion({ selector: { trigger: '.icon' } });
$('.pointing.secondary.menu .item').tab({
onVisible: function(tabPath) {
console.log(tabPath);
},
});
});

let userName
@@ -629,6 +614,7 @@
})

function loadLog(version_name) {
console.log('loadLog');
document.getElementById("mask").style.display = "block"
$.get(`/api/v1/repos/${userName}/${repoPath}/cloudbrain/${jobName}/log?version_name=${version_name}&lines=50&order=asc`, (data) => {
$('input[name=end_line]').val(data.EndLine)
@@ -639,23 +625,41 @@
console.log(err);
document.getElementById("mask").style.display = "none"
});
}

}
</script>
<script>
;(function() {
function paddingZeros(str, len) {
str = str.toString();
if (str.length < len) {
str = new Array(len - str.length).fill('0').join('') + str;
}
return str;
}
function timeFormat(date) {
return `${date.getFullYear()}-${paddingZeros(date.getMonth() + 1, 2)}-${paddingZeros(date.getDate(), 2)} ${paddingZeros(date.getHours(), 2)}:${paddingZeros(date.getMinutes(), 2)}:${paddingZeros(date.getSeconds(), 2)}`;
}
$.ajax({
url: window.location.href.replace('/show', ''),
type: "get",
data: {},
contentType: "application/json; charset=utf-8",
success(res) {
console.log(res);
for (var key in res) {
$(`[vfield="${key}"]`).text(res[key]);
$(`[vclass="${key}"]`).addClass(res[key]);
$(`[vtime="${key}"]`).text(res[key] ? timeFormat(new Date(res[key] * 1000)) : '--');
$(`[vtitle="${key}"]`).attr('title', res[key]);
$(`[vdataset0="${key}"]`).text(res[key] ? res[key].toString().split(';')[0] : '');
$(`[vdataset1="${key}"]`).text(res[key] ? res[key].toString().split(';')[1] : '');
$(`[vdataclipboardtext="${key}"]`).attr('data-clipboard-text', res[key]);
$(`[vvalue="${key}"]`).val(res[key]);
$(`[vdatajobid="${key}"]`).attr('data-jobid', res[key]);
}
},
error(err) {
console.log(err);
},
});
})();
})();
</script>

+ 3
- 1
web_src/js/features/cloudrbanin.js View File

@@ -8,6 +8,7 @@ export default async function initCloudrain() {
function loadJobStatus() {
$(".job-status").each((index, job) => {
const ID = job.dataset.jobid;
if (!ID) return;
const repoPath = job.dataset.repopath;
// const computeResource = job.dataset.resource
const versionname = job.dataset.version;
@@ -144,6 +145,7 @@ export default async function initCloudrain() {
function loadShowJobStatus() {
$(".ui.accordion.border-according").each((index, job) => {
const jobID = job.dataset.jobid;
if (!jobID) return;
const repoPath = job.dataset.repopath;
const versionname = job.dataset.version;
// ['IMAGE_FAILED','SUBMIT_FAILED','DELETE_FAILED','KILLED','COMPLETED','FAILED','CANCELED','LOST','START_FAILED']
@@ -152,7 +154,7 @@ export default async function initCloudrain() {
// || job.textContent.trim() == 'CANCELED' || job.textContent.trim() == 'LOST') {
// return
// }
let status = $(`#${versionname}-status-span`).text();
let status = $(`#${versionname}-status-span`).text().trim();

if (
[


Loading…
Cancel
Save