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 21 kB

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
3 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
3 years ago
3 years ago
3 years ago
3 years ago
3 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
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
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
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 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
2 years ago
3 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
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
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
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  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. margin-left: 1.5rem !important;
  31. width: 81% !important;
  32. }
  33. .add {
  34. font-size: 18px;
  35. padding: 0.5rem;
  36. border: 1px solid rgba(187, 187, 187, 100);
  37. border-radius: 0px 5px 5px 0px;
  38. line-height: 21px;
  39. text-align: center;
  40. color: #C2C7CC;
  41. }
  42. .min {
  43. font-size: 18px;
  44. padding: 0.5rem;
  45. border: 1px solid rgba(187, 187, 187, 100);
  46. border-radius: 5px 0px 0px 5px;
  47. line-height: 21px;
  48. text-align: center;
  49. color: #C2C7CC;
  50. }
  51. .label-fix-width{
  52. width: 140px !important;
  53. text-align: right;
  54. font-family: SourceHanSansSC-medium !important;
  55. color: rgba(16, 16, 16, 100) !important;
  56. font-size: 14px !important;
  57. }
  58. </style>
  59. {{template "custom/global_mask" .}}
  60. <div class="repository">
  61. {{template "repo/header" .}}
  62. <div class="ui container">
  63. <div class="cloudbrain-type" style="display: none;" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-queue="{{.QueuesDetail}}" data-queue-start="{{.i18n.Tr "repo.wait_count_start"}}" data-queue-end="{{.i18n.Tr "repo.wait_count_end"}}"></div>
  64. {{template "base/alert" .}}
  65. <h4 class="ui top attached header">
  66. {{.i18n.Tr "repo.modelarts.train_job.new"}}
  67. </h4>
  68. <div class="ui attached segment">
  69. <!-- equal width -->
  70. <form id="form_id" class="ui form" action="{{.Link}}" method="post">
  71. {{.CsrfTokenHtml}}
  72. <input type="hidden" name="action" value="update">
  73. <input type="hidden" id="ai_image_name" value="{{.image}}">
  74. <h4 class="train-job-title ui header ">{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:</h4>
  75. <div class="required unite min_title inline field">
  76. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_cluster"}}</label>
  77. <div class="ui blue mini menu compact selectcloudbrain">
  78. <a class="active item" href="{{.RepoLink}}/cloudbrain/train-job/create">
  79. <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>
  80. {{.i18n.Tr "cloudbrain.resource_cluster_openi"}}
  81. </a>
  82. <a class="item" href="{{.RepoLink}}/grampus/train-job/npu/create">
  83. <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>
  84. {{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}(Beta)
  85. </a>
  86. </div>
  87. </div>
  88. <div class="required min_title inline field">
  89. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.compute_resource"}}</label>
  90. <div class="ui blue mini menu compact selectcloudbrain">
  91. <a class="active item" href="{{.RepoLink}}/cloudbrain/train-job/create">
  92. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
  93. height="16">
  94. <path fill="none" d="M0 0h24v24H0z" />
  95. <path
  96. 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" />
  97. </svg>
  98. CPU/GPU
  99. </a>
  100. <a class="item" href="{{.RepoLink}}/modelarts/train-job/create">
  101. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
  102. height="16">
  103. <path fill="none" d="M0 0h24v24H0z" />
  104. <path
  105. 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" />
  106. </svg>
  107. Ascend NPU</a>
  108. </div>
  109. {{template "custom/wait_count_train" Dict "ctx" $ "type" .train_gpu_types}}
  110. <div style="display: flex;align-items: center;margin-left: 155px;margin-top: 0.5rem;">
  111. <i class="ri-error-warning-line" style="color: #f2711c;margin-right: 0.5rem;"></i>
  112. <span style="color: #888;font-size: 12px;">{{.i18n.Tr "cloudbrain.new_train_gpu_tooltips" "/code" "/dataset" "/model" | Safe}}</span>
  113. </div>
  114. </div>
  115. <div class="required min_title inline field">
  116. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>
  117. <input style="width: 60%;" name="display_job_name" id="display_job_name"
  118. placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}"
  119. tabindex="3" onkeyup="this.value=this.value.replace(/[, ]/g,'')" autofocus required
  120. maxlength="36">
  121. <span class="tooltips" style="display: block;margin-left: 11.5rem;">{{.i18n.Tr "repo.cloudbrain_jobname_err"}}</span>
  122. </div>
  123. <div class="inline min_title field">
  124. <label class="label-fix-width" style="font-weight: normal;"
  125. 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. <div class="inline required field" style="display: none;">
  155. <label>{{.i18n.Tr "cloudbrain.task_type"}}</label>
  156. <select id="cloudbrain_job_type" class="ui search dropdown" placeholder="选择任务类型" style='width:385px'
  157. name="job_type">
  158. <option name="job_type" value="TRAIN">TRAIN</option>
  159. </select>
  160. </div>
  161. <div class="required min_title inline field">
  162. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.gpu_type"}}</label>
  163. <select id="cloudbrain_gpu_type" class="ui search width806 dropdown gpu-type" placeholder="选择GPU类型"
  164. style='width:385px' name="gpu_type">
  165. {{if .gpu_type}}
  166. {{range .train_gpu_types}}
  167. {{if eq $.gpu_type .Queue}}
  168. <option value="{{.Queue}}">{{.Value}}</option>
  169. {{end}}
  170. {{end}}
  171. {{range .train_gpu_types}}
  172. {{if ne $.gpu_type .Queue}}
  173. <option value="{{.Queue}}">{{.Value}}</option>
  174. {{end}}
  175. {{end}}
  176. {{else}}
  177. {{range .train_gpu_types}}
  178. <option value="{{.Queue}}">{{.Value}}</option>
  179. {{end}}
  180. {{end}}
  181. </select>
  182. </div>
  183. <div id="images-new-cb">
  184. </div>
  185. <div class="inline field min_title required">
  186. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.start_file"}}</label>
  187. {{if .boot_file}}
  188. <input style="width: 48.5%;" name="boot_file" id="trainjob_boot_file" value="{{.boot_file}}"
  189. tabindex="3" autofocus required maxlength="255">
  190. {{else}}
  191. <input style="width: 48.5%;" name="boot_file" id="trainjob_boot_file" value="" tabindex="3"
  192. autofocus required maxlength="255">
  193. {{end}}
  194. <span>
  195. <i class="question circle icon link"
  196. data-content={{.i18n.Tr "repo.modelarts.train_job.boot_file_helper"}}
  197. data-position="right center" data-variation="mini"></i>
  198. </span>
  199. <a href="https://git.openi.org.cn/OpenIOSSG/MNIST_PytorchExample_GPU" target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a>
  200. </div>
  201. <div id="select-multi-dataset">
  202. </div>
  203. <span class="tooltips" style="margin-left: 11.5rem;margin-bottom: 1rem;"></span>
  204. <div class="inline min_title field">
  205. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.run_parameter"}}</label>
  206. <span id="add_run_para"
  207. style="margin-left: 0.5rem;cursor:pointer;color: rgba(3, 102, 214, 100);font-size: 14px;line-height: 26px;font-family: SourceHanSansSC-medium;"><i
  208. class="plus square outline icon"></i>{{.i18n.Tr "repo.modelarts.train_job.add_run_parameter"}}</span>
  209. <input id="store_run_para" type="hidden" name="run_para_list">
  210. <div class="dynamic field" style="margin-top: 1rem;" data-params="{{.run_para_list}}">
  211. </div>
  212. </div>
  213. <div class="required min_title inline field">
  214. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
  215. <select id="cloudbrain_resource_spec" class="ui search dropdown" placeholder="选择资源规格"
  216. style='width:385px' name="resource_spec_id">
  217. {{if .resource_spec_id}}
  218. {{range .train_resource_specs}}
  219. {{if eq $.resource_spec_id .Id}}
  220. <option value="{{.Id}}">{{$.i18n.Tr "cloudbrain.gpu_num"}}:{{.GpuNum}},{{$.i18n.Tr "cloudbrain.cpu_num"}}:{{.CpuNum}},{{$.i18n.Tr "cloudbrain.memory"}}(MB):{{.MemMiB}},{{$.i18n.Tr "cloudbrain.shared_memory"}}(MB):{{.ShareMemMiB}}</option>
  221. {{end}}
  222. {{end}}
  223. {{range .train_resource_specs}}
  224. {{if ne $.resource_spec_id .Id}}
  225. <option value="{{.Id}}">{{$.i18n.Tr "cloudbrain.gpu_num"}}:{{.GpuNum}},{{$.i18n.Tr "cloudbrain.cpu_num"}}:{{.CpuNum}},{{$.i18n.Tr "cloudbrain.memory"}}(MB):{{.MemMiB}},{{$.i18n.Tr "cloudbrain.shared_memory"}}(MB):{{.ShareMemMiB}}</option>
  226. {{end}}
  227. {{end}}
  228. {{else}}
  229. {{range .train_resource_specs}}
  230. <option name="resource_spec_id" value="{{.Id}}">
  231. {{$.i18n.Tr "cloudbrain.gpu_num"}}:{{.GpuNum}},{{$.i18n.Tr "cloudbrain.cpu_num"}}:{{.CpuNum}},{{$.i18n.Tr "cloudbrain.memory"}}(MB):{{.MemMiB}},{{$.i18n.Tr "cloudbrain.shared_memory"}}(MB):{{.ShareMemMiB}}</option>
  232. {{end}}
  233. {{end}}
  234. </select>
  235. </div>
  236. <div class="inline field" style="padding: 1rem 0;">
  237. <label class="label-fix-width"></label>
  238. <button class="ui create_train_job green button">
  239. {{.i18n.Tr "repo.cloudbrain.new"}}
  240. </button>
  241. <a class="ui button"
  242. href="{{.RepoLink}}/modelarts/train-job">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
  243. </div>
  244. <!-- 模态框 -->
  245. </form>
  246. </div>
  247. </div>
  248. </div>
  249. {{template "base/footer" .}}
  250. <script>
  251. let form = document.getElementById('form_id');
  252. let createFlag = false
  253. form.onsubmit = function (e) {
  254. if(createFlag) return false
  255. createFlag = true
  256. }
  257. $('select.dropdown')
  258. .dropdown();
  259. $('.menu .item')
  260. .tab();
  261. $(document).keydown(function(event){
  262. switch(event.keyCode){
  263. case 13:return false;
  264. }
  265. });
  266. $(document).ready(function(){
  267. let params = $('.dynamic.field').data('params')
  268. params&&params.parameter.forEach((item,index)=>{
  269. Add_parameter(index,flag=true,item)
  270. })
  271. })
  272. // 参数增加、删除、修改、保存
  273. function Add_parameter(i,flag=false,paramsObject={}) {
  274. let value = ''
  275. value += `<div class="two fields width85" id= "para${i}">`
  276. value += '<div class="field">'
  277. let placeholder_value='{{.i18n.Tr "repo.modelarts.train_job.parameter_value"}}'
  278. let placeholder_name='{{.i18n.Tr "repo.modelarts.train_job.parameter_name"}}'
  279. if(flag){
  280. value +=`<input type="text" class="shipping_first-name" value="${paramsObject.label}">`
  281. }else{
  282. value +='<input type="text" class="shipping_first-name" required placeholder="' + placeholder_name+ '">'
  283. }
  284. value += '</div>'
  285. value += '<div class="field">'
  286. if(flag){
  287. value +=`<input type="text" class="shipping_last-name" value="${paramsObject.value}">`
  288. }else{
  289. value +='<input type="text" class="shipping_last-name" required placeholder="' + placeholder_value + '">'
  290. }
  291. value += '</div>'
  292. value += '<span><i class="trash icon"></i></span>'
  293. value += '</div>'
  294. $(".dynamic.field").append(value)
  295. }
  296. $('#add_run_para').click(function () {
  297. var len = $(".dynamic.field .two.fields").length
  298. Add_parameter(len)
  299. });
  300. $(".dynamic.field").on("click", ".trash.icon", function () {
  301. var index = $(this).parent().parent().index()
  302. $(this).parent().parent().remove()
  303. var len = $(".dynamic.field .two.fields").length
  304. $(".dynamic.field .two.fields").each(function () {
  305. var cur_index = $(this).index()
  306. $(this).attr('id', 'para' + cur_index)
  307. })
  308. });
  309. $('.question.circle.icon').hover(function () {
  310. $(this).popup('show')
  311. });
  312. $('select.dropdown')
  313. .dropdown();
  314. function validate() {
  315. $('.ui.form')
  316. .form({
  317. on: 'blur',
  318. fields: {
  319. boot_file: {
  320. identifier: 'boot_file',
  321. rules: [
  322. {
  323. type: 'regExp[/.+\.py$/g]',
  324. }
  325. ]
  326. },
  327. display_job_name: {
  328. identifier: 'display_job_name',
  329. rules: [
  330. {
  331. type: 'regExp[/^[a-z0-9][a-z0-9-_]{1,34}[a-z0-9-]$/]',
  332. }
  333. ]
  334. },
  335. attachment: {
  336. identifier: 'attachment',
  337. rules: [
  338. {
  339. type: 'empty',
  340. }
  341. ]
  342. },
  343. work_server_number: {
  344. identifier: 'work_server_number',
  345. rules: [
  346. {
  347. type: 'integer[1..25]',
  348. }
  349. ]
  350. },
  351. branch_name: {
  352. identifier: 'branch_name',
  353. rules: [
  354. {
  355. type: 'empty',
  356. }
  357. ]
  358. }
  359. },
  360. onSuccess: function () {
  361. // $('.ui.page.dimmer').dimmer('show')
  362. document.getElementById("mask").style.display = "block"
  363. },
  364. onFailure: function (e) {
  365. return false;
  366. }
  367. })
  368. }
  369. document.onreadystatechange = function () {
  370. if (document.readyState === "complete") {
  371. document.getElementById("mask").style.display = "none"
  372. }
  373. }
  374. function send_run_para() {
  375. var run_parameters = []
  376. var msg = {}
  377. $(".dynamic.field .two.fields").each(function () {
  378. var para_name = $(this).find('input.shipping_first-name').val()
  379. var para_value = $(this).find('input.shipping_last-name').val()
  380. run_parameters.push({ "label": para_name, "value": para_value })
  381. })
  382. msg["parameter"] = run_parameters
  383. msg = JSON.stringify(msg)
  384. $('#store_run_para').val(msg)
  385. }
  386. validate();
  387. $('.ui.create_train_job.green.button').click(function (e) {
  388. send_run_para();
  389. validate();
  390. })
  391. </script>