Browse Source

提交代码,增加模型框架选项。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.7.1
zouap 3 years ago
parent
commit
347c5880ae
2 changed files with 43 additions and 5 deletions
  1. +2
    -2
      templates/repo/modelmanage/convertIndex.tmpl
  2. +41
    -3
      templates/repo/modelmanage/index.tmpl

+ 2
- 2
templates/repo/modelmanage/convertIndex.tmpl View File

@@ -78,7 +78,7 @@
</span> </span>
</div> </div>
<div class="two wide column center padding0"> <div class="two wide column center padding0">
<span style="font-size: 12px;">{{if eq .SrcEngine 0}}Pytorch {{else if eq .SrcEngine 1}}Tensorflow{{else if eq .SrcEngine 2}}MindSpore {{end}}</span>
<span style="font-size: 12px;">{{if eq .SrcEngine 0}}Pytorch {{else if eq .SrcEngine 1}}TensorFlow{{else if eq .SrcEngine 2}}MindSpore {{end}}</span>
</div> </div>
<div class="two wide column center padding0"> <div class="two wide column center padding0">
<span style="font-size: 12px;">{{if eq .DestFormat 0}}ONNX {{else if eq .DestFormat 1}}TensorRT {{end}}</span> <span style="font-size: 12px;">{{if eq .DestFormat 0}}ONNX {{else if eq .DestFormat 1}}TensorRT {{end}}</span>
@@ -222,7 +222,7 @@
<span>&nbsp;&nbsp;</span> <span>&nbsp;&nbsp;</span>
<select id="SrcEngine" class="ui search dropdown" placeholder="" style='width:385px' name="SrcEngine"> <select id="SrcEngine" class="ui search dropdown" placeholder="" style='width:385px' name="SrcEngine">
<option name="Pytorch" value="0">Pytorch</option> <option name="Pytorch" value="0">Pytorch</option>
<option name="Tensorflow" value="1">Tensorflow</option>
<option name="TensorFlow" value="1">TensorFlow</option>
<option name="MindSpore" value="2">MindSpore</option> <option name="MindSpore" value="2">MindSpore</option>
</select> </select>
</div> </div>


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

@@ -135,6 +135,14 @@
<label>模型版本</label> <label>模型版本</label>
<input style="width: 45%;" id="version" name="Version" value="" readonly required maxlength="255"> <input style="width: 45%;" id="version" name="Version" value="" readonly required maxlength="255">
</div> </div>
<div class="unite min_title inline field required">
<label>模型框架</label>
<select id="Engine" class="ui search dropdown" placeholder="" style='width:385px' name="Engine">
<option name="Pytorch" value="0">Pytorch</option>
<option name="TensorFlow" value="1">TensorFlow</option>
<option name="MindSpore" value="2">MindSpore</option>
</select>
</div>
<div class="inline field"> <div class="inline field">
<label>模型标签</label> <label>模型标签</label>
<input style="width: 83%;margin-left: 7px;" id="label" name="Label" maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.label_place"}}'> <input style="width: 83%;margin-left: 7px;" id="label" name="Label" maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.label_place"}}'>
@@ -166,7 +174,7 @@
let repoId = {{$repository}} let repoId = {{$repository}}
const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config; const {_AppSubUrl, _StaticUrlPrefix, csrf} = window.config;
$('input[name="_csrf"]').val(csrf) $('input[name="_csrf"]').val(csrf)
let modelData;
function createModelName(){ function createModelName(){
let repoName = location.pathname.split('/')[2] let repoName = location.pathname.split('/')[2]
let modelName = repoName + '_model_' + Math.random().toString(36).substr(2, 4) let modelName = repoName + '_model_' + Math.random().toString(36).substr(2, 4)
@@ -205,7 +213,21 @@
$(".ui.dropdown.selection.search.width70").addClass("loading") $(".ui.dropdown.selection.search.width70").addClass("loading")
$('#choice_version').dropdown('clear') $('#choice_version').dropdown('clear')
$("#job-version").empty() $("#job-version").empty()
loadTrainVersion(value)
loadTrainVersion(value)
}
})

$('#choice_version').dropdown({
onChange:function(value){
console.log("model version:" + value);
if(modelData != null){
for(var i=0; i < modelData.length;i++){
if(modelData[i].VersionName == value){
setEngine(modelData[i])
break;
}
}
}
} }
}) })
}) })
@@ -245,7 +267,8 @@
let JobID = !value ?$('#choice_model input[name="JobId"]').val(): value let JobID = !value ?$('#choice_model input[name="JobId"]').val(): value
$.get(`${repolink}/modelmanage/query_train_job_version?JobID=${JobID}`, (data) => { $.get(`${repolink}/modelmanage/query_train_job_version?JobID=${JobID}`, (data) => {
const n_length = data.length const n_length = data.length
let train_html=''
let train_html='';
modelData = data;
for (let i=0;i<n_length;i++){ for (let i=0;i<n_length;i++){
train_html += `<div class="item" data-value="${data[i].VersionName}">${data[i].VersionName}</div>` train_html += `<div class="item" data-value="${data[i].VersionName}">${data[i].VersionName}</div>`
train_html += '</div>' train_html += '</div>'
@@ -259,9 +282,24 @@
} }
$('#choice_version .default.text').text(versionName) $('#choice_version .default.text').text(versionName)
$('#choice_version input[name="VersionName"]').val(versionName) $('#choice_version input[name="VersionName"]').val(versionName)
setEngine(data[0])
} }


}) })
} }

function setEngine(modelVersion){
if(modelVersion.EngineName != null){
srcEngine = modelVersion.EngineName.split('-')[0]
if(srcEngine =='TensorFlow'){
$('#Engine').val(1)
}else if(srcEngine =='MindSpore'){
$('#Engine').val(2)
}
$("#Engine").attr("disabled","disabled");
}else{
$("#Engine").removeAttr("disabled");
}
}
</script> </script>



Loading…
Cancel
Save