You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

new.tmpl 20 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. {{template "base/head" .}}
  2. <style>
  3. .train-job-title {
  4. font-family: SourceHanSansSC-medium !important;
  5. color: rgba(16, 16, 16, 100) !important;
  6. font-size: 16px !important;
  7. padding-left: 3rem !important;
  8. }
  9. .min_title{
  10. font-size: 14px !important;
  11. margin-bottom: 2rem !important;
  12. }
  13. .width{
  14. width:100% !important;
  15. }
  16. .width80{
  17. width: 80.7% !important;
  18. margin-left: 10px;
  19. }
  20. .width806{
  21. width: 80.6% !important;
  22. margin-left: -2px;
  23. }
  24. .width85{
  25. width: 85% !important;
  26. margin-left: 10.5rem !important;
  27. align-items: center;
  28. }
  29. .width81{
  30. width: 81% !important;
  31. }
  32. .width48{
  33. width: 48.5% !important;
  34. }
  35. .add{font-size: 18px;
  36. padding: 0.5rem;
  37. border: 1px solid rgba(187, 187, 187, 100);
  38. border-radius: 0px 5px 5px 0px;
  39. line-height: 21px;
  40. text-align: center;
  41. color: #C2C7CC;
  42. }
  43. .min{
  44. font-size: 18px;
  45. padding: 0.5rem;
  46. border: 1px solid rgba(187, 187, 187, 100);
  47. border-radius: 5px 0px 0px 5px;
  48. line-height: 21px;
  49. text-align: center;
  50. color: #C2C7CC;
  51. }
  52. .label-fix-width{
  53. width: 140px !important;
  54. text-align: right;
  55. font-family: SourceHanSansSC-medium !important;
  56. color: rgba(16, 16, 16, 100) !important;
  57. font-size: 14px !important;
  58. }
  59. </style>
  60. {{template "custom/global_mask" .}}
  61. <div class="repository">
  62. {{template "repo/header" .}}
  63. <div class="ui container">
  64. <div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-flag-model="true" data-dataset-uuid="{{.uuid}}" data-dataset-name="{{.dataset_name}}"></div>
  65. {{template "base/alert" .}}
  66. <h4 class="ui top attached header">
  67. {{.i18n.Tr "repo.modelarts.train_job.new"}}
  68. </h4>
  69. <div class="ui attached segment">
  70. <!-- equal width -->
  71. <form id="form_id" class="ui form" action="{{.Link}}" method="post">
  72. {{.CsrfTokenHtml}}
  73. <input type="hidden" name="action" value="update">
  74. <input type="hidden" id="ai_engine_name" name="engine_name" value="">
  75. <input type="hidden" id="ai_flavor_name" name="flavor_name" value="">
  76. <input type="hidden" id="ai_image_name" value="{{.image}}">
  77. <input type="hidden" id="fail_dataset_name" value="{{$.dataset_name}}">
  78. <input type="hidden" id="fail_dataset_uuid" value="{{$.attachment}}">
  79. <h4 class="train-job-title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4>
  80. <div class="required min_title inline field">
  81. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_cluster"}}</label>
  82. <div class="ui blue mini menu compact selectcloudbrain">
  83. <a class="item" href="{{.RepoLink}}/cloudbrain/train-job/create">
  84. <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg>
  85. {{.i18n.Tr "cloudbrain.resource_cluster_openi"}}
  86. </a>
  87. <a class="active item" href="{{.RepoLink}}/grampus/train-job/{{if.NPUEnabled}}npu{{else}}gpu{{end}}/create">
  88. <svg class="svg" sxmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16"><path fill="none" d="M0 0h24v24H0z"></path><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm-2.29-2.333A17.9 17.9 0 0 1 8.027 13H4.062a8.008 8.008 0 0 0 5.648 6.667zM10.03 13c.151 2.439.848 4.73 1.97 6.752A15.905 15.905 0 0 0 13.97 13h-3.94zm9.908 0h-3.965a17.9 17.9 0 0 1-1.683 6.667A8.008 8.008 0 0 0 19.938 13zM4.062 11h3.965A17.9 17.9 0 0 1 9.71 4.333 8.008 8.008 0 0 0 4.062 11zm5.969 0h3.938A15.905 15.905 0 0 0 12 4.248 15.905 15.905 0 0 0 10.03 11zm4.259-6.667A17.9 17.9 0 0 1 15.973 11h3.965a8.008 8.008 0 0 0-5.648-6.667z"></path></svg>
  89. {{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}(Beta)
  90. </a>
  91. </div>
  92. </div>
  93. <div class="required min_title inline field">
  94. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.compute_resource"}}</label>
  95. <div class="ui blue mini menu compact selectcloudbrain">
  96. <a {{if.GPUEnabled}}class="active item" href="{{.RepoLink}}/grampus/train-job/gpu/create"{{else}}href="javascript:return false;" class="item disabled" {{end}}>
  97. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
  98. <path fill="none" d="M0 0h24v24H0z"/>
  99. <path d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z"/>
  100. </svg>
  101. CPU/GPU
  102. </a>
  103. <a {{if.NPUEnabled}}class="item" href="{{.RepoLink}}/grampus/train-job/npu/create"{{else}}href="javascript:return false;" class="item disabled" {{end}} >
  104. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">
  105. <path fill="none" d="M0 0h24v24H0z"/>
  106. <path d="M3 2.992C3 2.444 3.445 2 3.993 2h16.014a1 1 0 0 1 .993.992v18.016a.993.993 0 0 1-.993.992H3.993A1 1 0 0 1 3 21.008V2.992zM19 11V4H5v7h14zm0 2H5v7h14v-7zM9 6h6v2H9V6zm0 9h6v2H9v-2z"/>
  107. </svg>
  108. Ascend NPU</a>
  109. </div>
  110. </div>
  111. <div class="min_title inline field" style="margin-top:-10px;">
  112. <label class="label-fix-width" style="font-weight: normal;"></label>
  113. {{template "custom/task_wait_count" .}}
  114. <div style="display: flex;align-items: center;margin-left: 156px;margin-top: 0.5rem;">
  115. <i class="ri-error-warning-line" style="color: #f2711c;margin-right: 0.5rem;"></i>
  116. <span style="color: #888;font-size: 12px;">{{.i18n.Tr "cloudbrain.new_train_gpu_tooltips" "/tmp/code" "/tmp/dataset" "/tmp/output" | Safe}}</span>
  117. </div>
  118. </div>
  119. <div class="required min_title inline field">
  120. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>
  121. <input style="width: 60%;" name="display_job_name" id="display_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" tabindex="3" onkeyup="this.value=this.value.replace(/[, ]/g,'')" autofocus required maxlength="36">
  122. <span class="tooltips" style="margin-left: 11.5rem;display: block;">{{.i18n.Tr "repo.cloudbrain_jobname_err"}}</span>
  123. </div>
  124. <div class="min_title inline field">
  125. <label class="label-fix-width" style="font-weight: normal;" for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}}</label>
  126. {{if .description}}
  127. <textarea style="width: 80%;" id="description" name="description" rows="3" maxlength="255" placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}}>{{.description}}</textarea>
  128. {{else}}
  129. <textarea style="width: 80%;" id="description" name="description" rows="3" maxlength="255" placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}} onchange="this.value=this.value.substring(0, 255)" onkeydown="this.value=this.value.substring(0, 255)" onkeyup="this.value=this.value.substring(0, 255)"></textarea>
  130. {{end}}
  131. </div>
  132. <div class="ui divider"></div>
  133. <h4 class="train-job-title ui header ">{{.i18n.Tr "repo.modelarts.train_job.parameter_setting"}}:</h4>
  134. <div class="required min_title inline field">
  135. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.code_version"}}</label>
  136. <select class="ui dropdown width80 left2" id="code_version" name="branch_name">
  137. {{if .branch_name}}
  138. <option name="branch_name" value="{{.branch_name}}">{{.branch_name}}</option>
  139. {{range $k, $v :=.Branches}}
  140. {{ if ne $v $.branch_name }}
  141. <option name="branch_name" value="{{$v}}">{{$v}}</option>
  142. {{end}}
  143. {{end}}
  144. {{else}}
  145. <option name="branch_name" value="{{.branchName}}">{{.branchName}}</option>
  146. {{range $k, $v :=.Branches}}
  147. {{ if ne $v $.branchName }}
  148. <option name="branch_name" value="{{$v}}">{{$v}}</option>
  149. {{end}}
  150. {{end}}
  151. {{end}}
  152. </select>
  153. </div>
  154. {{template "custom/select_model" .}}
  155. <div id="images-new-grampus">
  156. </div>
  157. <div class="inline min_title field required">
  158. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.start_file"}}</label>
  159. {{if .boot_file}}
  160. <input style="width: 48.5%;" name="boot_file" id="trainjob_boot_file" value="{{.boot_file}}" tabindex="3" autofocus required maxlength="255" >
  161. {{else}}
  162. <input style="width: 48.5%;" name="boot_file" id="trainjob_boot_file" value="" tabindex="3" autofocus required maxlength="255" >
  163. {{end}}
  164. <span>
  165. <i class="question circle icon link" data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}} data-position="right center" data-variation="mini"></i>
  166. </span>
  167. <a href="https://git.openi.org.cn/OpenIOSSG/MNIST_PytorchExample_GPU/src/branch/master/train_for_c2net.py" target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a>
  168. </div>
  169. <div id="select-multi-dataset">
  170. </div>
  171. <span class="tooltips" style="margin-left: 11.5rem;margin-bottom: 1rem;"></span>
  172. <div class="inline min_title field">
  173. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.run_parameter"}}</label>
  174. <span id="add_run_para" style="margin-left: 0.5rem;cursor:pointer;color: rgba(3, 102, 214, 100);font-size: 14px;line-height: 26px;font-family: SourceHanSansSC-medium;"><i class="plus square outline icon"></i>{{.i18n.Tr "repo.modelarts.train_job.add_run_parameter"}}</span>
  175. <input id="store_run_para" type="hidden" name="run_para_list">
  176. <div class="dynamic field" style="margin-top: 1rem;" data-params="{{.run_para_list}}">
  177. </div>
  178. </div>
  179. <!--<div class="required min_title inline field" id="flavor_name">
  180. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.standard"}}</label>
  181. <select class="ui dropdown width81" id="trainjob-flavor" style='width:385px' name="flavor">
  182. {{if .flavor}}
  183. {{range .flavor_infos}}
  184. {{if eq $.flavor .ID}}
  185. <option value="{{.ID}}">{{.Name}}</option>
  186. {{end}}
  187. {{end}}
  188. {{range .flavor_infos}}
  189. {{if ne $.flavor .ID}}
  190. <option value="{{.ID}}">{{.Name}}</option>
  191. {{end}}
  192. {{end}}
  193. {{else}}
  194. {{range .flavor_infos}}
  195. <option name="flavor" value="{{.ID}}">{{.Name}}</option>
  196. {{end}}
  197. {{end}}
  198. </select>
  199. </div>-->
  200. <div class="required min_title inline field" id="flavor_name">
  201. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.standard"}}</label>
  202. <select class="ui dropdown width48" id="__specs__" style='width:385px' name="spec_id" ovalue="{{.spec_id}}"></select>
  203. </div>
  204. <div class="inline min_title field">
  205. <label class="label-fix-width"></label>
  206. <button class="ui create_train_job green button">
  207. {{.i18n.Tr "repo.cloudbrain.new"}}
  208. </button>
  209. <a class="ui button" href="{{.RepoLink}}/modelarts/train-job">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
  210. </div>
  211. <!-- 模态框 -->
  212. </form>
  213. </div>
  214. </div>
  215. </div>
  216. {{template "base/footer" .}}
  217. <script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script>
  218. <script>
  219. let form = document.getElementById('form_id');
  220. let createFlag = false
  221. form.onsubmit = function (e) {
  222. if(createFlag) return false
  223. createFlag = true
  224. }
  225. $('select.dropdown')
  226. .dropdown();
  227. $('.menu .item')
  228. .tab();
  229. $(document).ready(function(){
  230. let params = $('.dynamic.field').data('params')
  231. params&&params.parameter.forEach((item,index)=>{
  232. Add_parameter(index,flag=true,item)
  233. })
  234. })
  235. // 参数增加、删除、修改、保存
  236. function Add_parameter(i,flag=false,paramsObject={}) {
  237. let value = ''
  238. value += `<div class="two fields width85" id= "para${i}">`
  239. value += '<div class="field">'
  240. let placeholder_value='{{.i18n.Tr "repo.modelarts.train_job.parameter_value"}}'
  241. let placeholder_name='{{.i18n.Tr "repo.modelarts.train_job.parameter_name"}}'
  242. if(flag){
  243. value +=`<input type="text" class="shipping_first-name" value="${paramsObject.label}">`
  244. }else{
  245. value +='<input type="text" class="shipping_first-name" required placeholder="' + placeholder_name+ '">'
  246. }
  247. value += '</div>'
  248. value += '<div class="field">'
  249. if(flag){
  250. value +=`<input type="text" class="shipping_last-name" value="${paramsObject.value}">`
  251. }else{
  252. value +='<input type="text" class="shipping_last-name" required placeholder="' + placeholder_value+ '">'
  253. }
  254. value += '</div>'
  255. value += '<span><i class="trash icon"></i></span>'
  256. value += '</div>'
  257. $(".dynamic.field").append(value)
  258. }
  259. $('#add_run_para').click(function () {
  260. var len = $(".dynamic.field .two.fields").length
  261. Add_parameter(len)
  262. });
  263. $(".dynamic.field").on("click", ".trash.icon", function () {
  264. var index = $(this).parent().parent().index()
  265. $(this).parent().parent().remove()
  266. var len = $(".dynamic.field .two.fields").length
  267. $(".dynamic.field .two.fields").each(function () {
  268. var cur_index = $(this).index()
  269. $(this).attr('id', 'para' + cur_index)
  270. })
  271. });
  272. $('.question.circle.icon').hover(function(){
  273. $(this).popup('show')
  274. });
  275. $('select.dropdown')
  276. .dropdown();
  277. var isValidate = false;
  278. function validate(){
  279. $('.ui.form')
  280. .form({
  281. on: 'blur',
  282. fields: {
  283. boot_file: {
  284. identifier : 'boot_file',
  285. rules: [
  286. {
  287. type: 'regExp[/.+\.py$/g]',
  288. }
  289. ]
  290. },
  291. display_job_name:{
  292. identifier : 'display_job_name',
  293. rules: [
  294. {
  295. type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]',
  296. }
  297. ]
  298. },
  299. attachment:{
  300. identifier : 'attachment',
  301. rules: [
  302. {
  303. type: 'empty',
  304. }
  305. ]
  306. },
  307. flavor:{
  308. identifier : 'flavor',
  309. rules: [
  310. {
  311. type: 'empty',
  312. }
  313. ]
  314. },
  315. work_server_number: {
  316. identifier : 'work_server_number',
  317. rules: [
  318. {
  319. type : 'integer[1..25]',
  320. }
  321. ]
  322. },
  323. spec_id: {
  324. identifier: 'spec_id',
  325. rules: [{ type: 'empty' }]
  326. }
  327. },
  328. onSuccess: function(){
  329. // $('.ui.page.dimmer').dimmer('show')
  330. document.getElementById("mask").style.display = "block"
  331. isValidate = true;
  332. },
  333. onFailure: function(e){
  334. isValidate = false;
  335. return false;
  336. }
  337. })
  338. }
  339. document.onreadystatechange = function() {
  340. if (document.readyState === "complete") {
  341. document.getElementById("mask").style.display = "none"
  342. }
  343. }
  344. function send_run_para() {
  345. var run_parameters = []
  346. var msg = {}
  347. $(".dynamic.field .two.fields").each(function () {
  348. var para_name = $(this).find('input.shipping_first-name').val()
  349. var para_value = $(this).find('input.shipping_last-name').val()
  350. run_parameters.push({ "label": para_name, "value": para_value })
  351. })
  352. msg["parameter"] = run_parameters
  353. msg = JSON.stringify(msg)
  354. $('#store_run_para').val(msg)
  355. }
  356. function get_name(){
  357. let name1=$("#engine_name .text").text()
  358. let name2=$("#flavor_name .text").text()
  359. $("input#ai_engine_name").val(name1)
  360. $("input#ai_flavor_name").val(name2)
  361. }
  362. validate();
  363. $('.ui.create_train_job.green.button').click(function(e) {
  364. get_name()
  365. send_run_para()
  366. validate();
  367. })
  368. ;(function() {
  369. var SPECS = {{ .Specs }};
  370. var showPoint = true;
  371. renderSpecsSelect($('#__specs__'), SPECS, showPoint, {
  372. gpu_memory: {{$.i18n.Tr "cloudbrain.gpu_memory"}},
  373. free: {{$.i18n.Tr "cloudbrain.free"}},
  374. point_hr: {{$.i18n.Tr "cloudbrain.point_hr"}},
  375. memory: {{$.i18n.Tr "cloudbrain.memory"}},
  376. shared_memory: {{$.i18n.Tr "cloudbrain.shared_memory"}},
  377. });
  378. })();
  379. </script>