Browse Source

fix issue

tags/v1.22.7.2^2
zhoupzh 3 years ago
parent
commit
8a35e507fe
2 changed files with 88 additions and 45 deletions
  1. +31
    -15
      templates/repo/cloudbrain/inference/new.tmpl
  2. +57
    -30
      templates/repo/modelarts/inferencejob/new.tmpl

+ 31
- 15
templates/repo/cloudbrain/inference/new.tmpl View File

@@ -59,16 +59,13 @@
{{.CsrfTokenHtml}}
<input type="hidden" name="action" value="update">
<input type="hidden" id="ai_image_name" value="{{.image}}">
{{if $.model_version}}
<input type="hidden" id="ai_model_version" name="model_version" value="{{$.model_version}}">
{{else}}
<input type="hidden" id="ai_model_version" name="model_version" value="">
{{end}}
{{if $.label_names}}
<input type="hidden" id="ai_model_label" name="label_names" value="{{$.label_names}}">
{{else}}
<input type="hidden" id="ai_model_label" name="label_names" value="">
{{end}}

<input type="hidden" id="failed_train_url" value="{{$.train_url}}">
<input type="hidden" id="failed_model_name" value="{{$.model_name}}">
<input type="hidden" id="failed_model_version" value="{{$.model_version}}">
<input type="hidden" id="failed_ckpt_name" value="{{$.ckpt_name}}">
<input type="hidden" id="failed_train_url" value="{{$.train_url}}">
<h4 class="unite title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4>
<div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.compute_resource"}}</label>
@@ -298,6 +295,7 @@
<script>
const RepoLink = {{.RepoLink}}
let nameMap,nameList
let faildModelName = $('#failed_model_name').val()
// 获取模型列表和模型名称对应的模型版本
$.get(`${RepoLink}/modelmanage/query_model_for_predict?type=0`, (data) => {
modelVersion()
@@ -312,14 +310,21 @@
const initModelVersion = nameMap[nameList[0]][0]
const initTrainTaskInfo = JSON.parse(initModelVersion.TrainTaskInfo)
$('#model_name').append(html)
$("#select_model").dropdown('set text',nameList[0])
$("#select_model").dropdown('set value',nameList[0],nameList[0])
if(faildModelName){
$("#select_model").dropdown('set text',faildModelName)
$("#select_model").dropdown('set value',faildModelName,faildModelName)
}else{
$("#select_model").dropdown('set text',nameList[0])
$("#select_model").dropdown('set value',nameList[0],nameList[0])
}
}

$('#select_model').removeClass("loading")
})
// 根据选中的模型名称获取相应的模型版本
function modelVersion(){
let faildModelVersion = $('#failed_model_version').val()
let faildTrainUrl = $('#failed_train_url').val()
$('#select_model').dropdown({
onChange: function(value, text, $selectedItem) {
$("#select_model_version").addClass("loading")
@@ -334,8 +339,14 @@
$("#select_model_version").removeClass("loading")
const initVersionText = $('#model_name_version div.item:first-child').text()
const initVersionValue = $('#model_name_version div.item:first-child').data('value')
$("#select_model_version").dropdown('set text',initVersionText)
$("#select_model_version").dropdown('set value',initVersionValue,initVersionText,$('#model_name_version div.item:first-child'))
if(faildModelVersion&&faildTrainUrl){
console.log("-0-0-0-0-0-")
$("#select_model_version").dropdown('set text',faildModelVersion)
$("#select_model_version").dropdown('set value',faildTrainUrl,faildModelVersion,$('#model_name_version div.item:first-child'))
}else{
$("#select_model_version").dropdown('set text',initVersionText)
$("#select_model_version").dropdown('set value',initVersionValue,initVersionText,$('#model_name_version div.item:first-child'))
}
}
})
}
@@ -361,8 +372,13 @@
$("#select_model_checkpoint").removeClass("loading")
const initVersionText = $('#model_checkpoint div.item:first-child').text()
const initVersionValue = $('#model_checkpoint div.item:first-child').data('value')
$("#select_model_checkpoint").dropdown('set text',initVersionText)
$("#select_model_checkpoint").dropdown('set value',initVersionValue,initVersionText,$('#model_name_version div.item:first-child'))
if(faildCkptName){
$("#select_model_checkpoint").dropdown('set text',faildCkptName)
$("#select_model_checkpoint").dropdown('set value',faildCkptName,faildCkptName,$('#model_name_version div.item:first-child'))
}else{
$("#select_model_checkpoint").dropdown('set text',initVersionText)
$("#select_model_checkpoint").dropdown('set value',initVersionValue,initVersionText,$('#model_name_version div.item:first-child'))
}
})




+ 57
- 30
templates/repo/modelarts/inferencejob/new.tmpl View File

@@ -58,16 +58,14 @@
<input type="hidden" name="action" value="update">
<input type="hidden" id="ai_engine_name" name="engine_names" value="">
<input type="hidden" id="ai_flaver_name" name="flaver_names" value="">
{{if $.model_version}}
<input type="hidden" id="ai_model_version" name="model_version" value="{{$.model_version}}">
{{else}}
<input type="hidden" id="ai_model_version" name="model_version" value="">
{{end}}
{{if $.label_names}}
<input type="hidden" id="ai_model_label" name="label_names" value="{{$.label_names}}">
{{else}}
<input type="hidden" id="ai_model_label" name="label_names" value="">
{{end}}

<input type="hidden" id="failed_train_url" value="{{$.train_url}}">
<input type="hidden" id="failed_model_name" value="{{$.model_name}}">
<input type="hidden" id="failed_model_version" value="{{$.model_version}}">
<input type="hidden" id="failed_ckpt_name" value="{{$.ckpt_name}}">
<input type="hidden" id="failed_train_url" value="{{$.train_url}}">

<h4 class="unite title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4>
<div class="required min_title inline field">
<label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.compute_resource"}}</label>
@@ -107,7 +105,7 @@
{{end}}
</div>
<div class="ui divider"></div>
{{$.model_name}} {{$.model_version}}
<!-- 模型相关配置 -->
<h4 class="unite title ui header ">{{.i18n.Tr "repo.modelarts.train_job.parameter_setting"}}:</h4>
<div class="required unite inline min_title fields" style="width: 96.8%;">
@@ -314,31 +312,44 @@
const RepoLink = {{.RepoLink}}
const url_href = window.location.pathname.split('create')[0]
let nameMap,nameList
let faildModelName = $('#failed_model_name').val()
$(".ui.button").attr('href',url_href)
// 获取模型列表和模型名称对应的模型版本
$.get(`${RepoLink}/modelmanage/query_model_for_predict?type=1`, (data) => {
$(document).ready(function(){
modelVersion()
modelCkpt()
nameMap = data.nameMap
nameList = data.nameList
let html = ''
nameList.forEach(element => {
html += `<div class="item" data-value=${element}>${element}</div>`
});
if(nameList.length!==0){
const initModelVersion = nameMap[nameList[0]][0]
const initTrainTaskInfo = JSON.parse(initModelVersion.TrainTaskInfo)
$('#model_name').append(html)
$("#select_model").dropdown('set text',nameList[0])
$("#select_model").dropdown('set value',nameList[0],nameList[0])
}
$.get(`${RepoLink}/modelmanage/query_model_for_predict?type=1`, (data) => {
nameMap = data.nameMap
nameList = data.nameList
let html = ''
nameList.forEach(element => {
html += `<div class="item" data-value=${element}>${element}</div>`
});
if(nameList.length!==0){
const initModelVersion = nameMap[nameList[0]][0]
const initTrainTaskInfo = JSON.parse(initModelVersion.TrainTaskInfo)
$('#model_name').append(html)
if(faildModelName){
$("#select_model").dropdown('set text',faildModelName)
$("#select_model").dropdown('set value',faildModelName,faildModelName)
}else{
$("#select_model").dropdown('set text',nameList[0])
$("#select_model").dropdown('set value',nameList[0],nameList[0])
}
}

$('#select_model').removeClass("loading")
$('#select_model').removeClass("loading")
})
})
// 根据选中的模型名称获取相应的模型版本
function modelVersion(){
let faildModelVersion = $('#failed_model_version').val()
let faildTrainUrl = $('#failed_train_url').val()
$('#select_model').dropdown({
onChange: function(value, text, $selectedItem) {
faildModelVersion = ''
faildTrainUrl=''
console.log("-----------------")
$("#select_model_version").addClass("loading")
$('#model_name_version').empty()
@@ -352,15 +363,26 @@
$("#select_model_version").removeClass("loading")
const initVersionText = $('#model_name_version div.item:first-child').text()
const initVersionValue = $('#model_name_version div.item:first-child').data('value')
$("#select_model_version").dropdown('set text',initVersionText)
$("#select_model_version").dropdown('set value',initVersionValue,initVersionText,$('#model_name_version div.item:first-child'))
if(faildModelVersion&&faildTrainUrl){
console.log("-0-0-0-0-0-")
$("#select_model_version").dropdown('set text',faildModelVersion)
$("#select_model_version").dropdown('set value',faildTrainUrl,faildModelVersion,$('#model_name_version div.item:first-child'))
}else{
$("#select_model_version").dropdown('set text',initVersionText)
$("#select_model_version").dropdown('set value',initVersionValue,initVersionText,$('#model_name_version div.item:first-child'))
}
}
})
}
// 根据选中的模型版本获取相应的模型权重文件
function modelCkpt(){
let faildCkptName = $('#failed_ckpt_name').val()
$('#select_model_version').dropdown({
onChange: function(value, text, $selectedItem) {
faildCkptName=''
console.log("===========----------")
const dataID = $selectedItem[0].getAttribute("data-id")
const label = $selectedItem[0].getAttribute("data-label")
$("#select_model_checkpoint").addClass("loading")
@@ -379,8 +401,14 @@
$("#select_model_checkpoint").removeClass("loading")
const initVersionText = $('#model_checkpoint div.item:first-child').text()
const initVersionValue = $('#model_checkpoint div.item:first-child').data('value')
$("#select_model_checkpoint").dropdown('set text',initVersionText)
$("#select_model_checkpoint").dropdown('set value',initVersionValue,initVersionText,$('#model_name_version div.item:first-child'))
if(faildCkptName){
$("#select_model_checkpoint").dropdown('set text',faildCkptName)
$("#select_model_checkpoint").dropdown('set value',faildCkptName,faildCkptName,$('#model_name_version div.item:first-child'))
}else{
$("#select_model_checkpoint").dropdown('set text',initVersionText)
$("#select_model_checkpoint").dropdown('set value',initVersionValue,initVersionText,$('#model_name_version div.item:first-child'))
}
})


@@ -449,7 +477,6 @@
let name2=$("#flaver_name .text").text()
$("input#ai_engine_name").val(name1)
$("input#ai_flaver_name").val(name2)

}
function validate(){
$('.ui.form')


Loading…
Cancel
Save