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