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

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. {{template "base/head" .}}
  2. <style>
  3. .unite {
  4. font-family: SourceHanSansSC-medium !important;
  5. color: rgba(16, 16, 16, 100) !important;
  6. }
  7. .title {
  8. font-size: 16px !important;
  9. padding-left: 3rem !important;
  10. }
  11. .min_title{
  12. font-size: 14px !important;
  13. margin-bottom: 2rem !important;
  14. }
  15. .width100 {
  16. width: 100% !important;
  17. }
  18. .width81 {
  19. margin-left: 1.5rem;
  20. width: 81% !important;
  21. }
  22. .width85 {
  23. width: 85% !important;
  24. margin-left: 10.5rem !important;
  25. align-items: center;
  26. }
  27. .width48 {
  28. width: 48.5% !important;
  29. }
  30. .nowrapx {
  31. white-space: nowrap !important;
  32. }
  33. .v-middle {
  34. vertical-align: middle;
  35. }
  36. </style>
  37. {{template "custom/global_mask" .}}
  38. <div class="repository">
  39. {{template "repo/header" .}}
  40. <div class="ui container">
  41. {{$Grampus := (or (eq (index (SubJumpablePath .Link) 1) "create_grampus_gpu") (eq (index (SubJumpablePath .Link) 1) "create_grampus_npu"))}}
  42. <div class="cloudbrain-type" style="display: none;" data-grampus="{{$Grampus}}" data-cloudbrain-type="{{.datasetType}}" data-repo-link="{{.RepoLink}}" data-flag-model="true" data-dataset-uuid="{{.attachment}}" data-dataset-name="{{.dataset_name}}" data-queue="{{.QueuesDetail}}" data-queue-start="{{.i18n.Tr "repo.wait_count_start"}}" data-queue-end="{{.i18n.Tr "repo.wait_count_end"}}"></div>
  43. {{template "base/alert" .}}
  44. <h4 class="ui top attached header">
  45. {{.i18n.Tr "repo.modelarts.evaluate_job.new_job"}}
  46. </h4>
  47. <div class="ui attached segment">
  48. <input type="hidden" name="benchmarkMode" value="{{.benchmarkMode}}">
  49. <form id="form_id" class="ui form alogrithm_form" action="{{.RepoLink}}/modelsafety/create" method="post">
  50. {{.CsrfTokenHtml}}
  51. <input type="hidden" name="compute_resource" value="{{.compute_resource}}">
  52. <input type="hidden" name="type" value="{{.type}}">
  53. <input type="hidden" id="ai_engine_name" name="engine_names" value="">
  54. <input type="hidden" id="ai_flaver_name" name="flaver_names" value="">
  55. <div class="required min_title inline field">
  56. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_scenes"}}</label>
  57. <div class="ui blue small menu compact selectcloudbrain">
  58. <a class="item alogrithm_benchmark"
  59. href="{{.RepoLink}}/cloudbrain/benchmark/create?benchmarkMode=alogrithm">{{.i18n.Tr "repo.cloudbrain.benchmark.algorithm"}}</a>
  60. <a class="item model_benchmark"
  61. href="{{.RepoLink}}/cloudbrain/benchmark/create?benchmarkMode=model">{{.i18n.Tr "repo.cloudbrain.benchmark.model"}}</a>
  62. <a class="item active model_safe_benchmark"
  63. href="{{.Link}}">{{.i18n.Tr "modelsafety.model_security_evaluation"}}</a>
  64. </div>
  65. </div>
  66. <!-- <div class="required unite min_title inline field">
  67. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_cluster"}}</label>
  68. <div class="ui blue mini menu compact selectcloudbrain">
  69. <a class="item {{if not $Grampus}}active{{end}}" href="{{.RepoLink}}/modelsafety/create_gpu">
  70. <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>
  71. {{.i18n.Tr "cloudbrain.resource_cluster_openi"}}
  72. </a>
  73. <a class="item {{if $Grampus}}active{{end}}" href="{{.RepoLink}}/modelsafety/create_grampus_gpu">
  74. <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>
  75. {{.i18n.Tr "cloudbrain.resource_cluster_c2net"}}(Beta)
  76. </a>
  77. </div>
  78. </div> -->
  79. <div class="inline min_title required field">
  80. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.compute_resource"}}</label>
  81. <div class="ui blue mini menu compact selectcloudbrain">
  82. <a class="{{if eq .datasetType 0}}active{{end}} item" href="{{.RepoLink}}/modelsafety/create_{{if $Grampus}}grampus_{{end}}gpu">
  83. <svg class="svg" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16"
  84. height="16">
  85. <path fill="none" d="M0 0h24v24H0z" />
  86. <path
  87. 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" />
  88. </svg>
  89. CPU/GPU
  90. </a>
  91. <a class="{{if eq .datasetType 1}}active{{end}} item" href="{{.RepoLink}}/modelsafety/create_{{if $Grampus}}grampus_{{end}}npu">
  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. Ascend NPU</a>
  99. </div>
  100. </div>
  101. <div>
  102. <div class="min_title inline field" style="margin-top:-10px;">
  103. <label class="label-fix-width" style="font-weight: normal;"></label>
  104. {{template "custom/task_wait_count" .}}
  105. </div>
  106. <div class="required min_title inline field">
  107. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>
  108. <input style="width: 80%;" name="display_job_name" id="trainjob_job_name"
  109. placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}"
  110. tabindex="3" autofocus required maxlength="36">
  111. <span class="tooltips" style="display: block;margin-left: 11.5rem;">{{.i18n.Tr "repo.cloudbrain_jobname_err"}}</span>
  112. </div>
  113. <div class="min_title inline field">
  114. <label class="label-fix-width" style="font-weight: normal;"
  115. for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}}</label>
  116. <textarea style="width: 80%;" id="description" name="description" rows="3" maxlength="254"
  117. placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}}
  118. onchange="this.value=this.value.substring(0, 255)"
  119. onkeydown="this.value=this.value.substring(0, 255)"
  120. onkeyup="this.value=this.value.substring(0, 255)">{{.description}}</textarea>
  121. </div>
  122. <input type="hidden" id="ai_model_version" name="model_version" value="{{$.model_version}}">
  123. <div class="required unite inline min_title fields" style="width: 96.8%;">
  124. <div class="required eight wide field">
  125. <label style="font-weight: normal;white-space: nowrap;width: 210px;text-align: right;">{{.i18n.Tr "repo.modelarts.infer_job.select_model"}}</label>
  126. <div class="ui fluid search selection dropdown" id="select_model">
  127. <input type="hidden" name="model_name" required>
  128. <div class="text"></div>
  129. <i class="dropdown icon"></i>
  130. <div class="menu" id="model_name">
  131. </div>
  132. </div>
  133. </div>
  134. <div class="three wide field">
  135. <div class="ui fluid search selection dropdown" id="select_model_version">
  136. <input type="hidden" name="train_url" required>
  137. <div class="text"></div>
  138. <i class="dropdown icon"></i>
  139. <div class="menu" id="model_name_version"></div>
  140. </div>
  141. </div>
  142. <div class="five wide field">
  143. <div class="ui fluid search selection dropdown" id="select_model_checkpoint">
  144. <input type="hidden" name="ckpt_name" required>
  145. <div class="text"></div>
  146. <i class="dropdown icon"></i>
  147. <div class="menu" id="model_checkpoint">
  148. </div>
  149. </div>
  150. </div>
  151. <span >
  152. <i class="question circle icon" data-content="{{.i18n.Tr "cloudbrain.model_file_postfix_rule"}}" data-position="top center" data-variation="inverted mini"></i>
  153. </span>
  154. </div>
  155. <div class="required inline min_title field " style="display: none;">
  156. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.resource_pool"}}</label>
  157. <select class="ui dropdown width48" id="trainjob_resource_pool" name="pool_id">
  158. {{range .resource_pools}}
  159. <option value="{{.ID}}">{{.Value}}</option>
  160. {{end}}
  161. </select>
  162. </div>
  163. {{if not $Grampus}}
  164. {{if eq .datasetType 0}}
  165. <div id="images-new-cb"></div>
  166. {{else}}
  167. <div class="required inline min_title fields" style="width: 95%;">
  168. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.AI_driver"}}</label>
  169. <div class="field" style="flex: 1.5;">
  170. <select class="ui dropdown width100" id="trainjob_engines">
  171. {{range .engines}}
  172. <option value="{{.Value}}">{{.Value}}</option>
  173. {{end}}
  174. </select>
  175. </div>
  176. <div class="field" style="flex: 2;" id="engine_name">
  177. <select class="ui dropdown width100" id="trainjob_engine_versions" name="engine_id">
  178. {{if .engine_id}}
  179. {{range .engine_versions}}
  180. {{if eq $.engine_id .ID}}
  181. <option value="{{.ID}}">{{.Value}}</option>
  182. {{end}}
  183. {{end}}
  184. {{range .engine_versions}}
  185. {{if ne $.engine_id .ID}}
  186. <option value="{{.ID}}">{{.Value}}</option>
  187. {{end}}
  188. {{end}}
  189. {{else}}
  190. {{range .engine_versions}}
  191. <option value="{{.ID}}">{{.Value}}</option>
  192. {{end}}
  193. {{end}}
  194. </select>
  195. </div>
  196. </div>
  197. {{end}}
  198. {{else}}
  199. {{if eq .datasetType 0}}
  200. <div id="images-new-grampus"></div>
  201. {{else}}
  202. <div class="required min_title inline field" id="engine_name">
  203. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.mirror"}}</label>
  204. <select class="ui dropdown width48" id="trainjob_images" name="image_id">
  205. {{if .image_id}}
  206. {{range .images}}
  207. {{if eq $.image_id .ID}}
  208. <option value="{{.ID}}">{{.Name}}</option>
  209. {{end}}
  210. {{end}}
  211. {{range .images}}
  212. {{if ne $.image_id .ID}}
  213. <option value="{{.ID}}">{{.Name}}</option>
  214. {{end}}
  215. {{end}}
  216. {{else}}
  217. {{range .images}}
  218. <option name="image_id" value="{{.ID}}">{{.Name}}</option>
  219. {{end}}
  220. {{end}}
  221. </select>
  222. </div>
  223. {{end}}
  224. {{end}}
  225. <div class="inline field min_title required">
  226. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.start_file"}}</label>
  227. <input style="width: 48.5%;" name="boot_file" id="trainjob_boot_file" value="{{.boot_file}}" tabindex="3" autofocus required maxlength="255">
  228. <span>
  229. <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>
  230. </span>
  231. <a href="https://git.openi.org.cn/OpenIOSSG/MNIST_PytorchExample_GPU" target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a>
  232. </div>
  233. <div class="inline field min_title required">
  234. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "modelsafety.base_data_set"}}</label>
  235. <select id="baseDataSet-sel" class="ui dropdown width48" name="src_dataset"></select>
  236. </div>
  237. <div class="inline field min_title required">
  238. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "modelsafety.combat_data_set"}}</label>
  239. <select id="combatDataSet-sel" class="ui dropdown width48 readonly" name="combat_dataset"></select>
  240. </div>
  241. <div class="inline min_title field required">
  242. <label class="label-fix-width" style="font-weight:normal;">{{.i18n.Tr "modelsafety.evaluation_indicators"}}</label>
  243. <input type="text" style="display:none;" name="evaluation_index" />
  244. <select id="job_indicators" class="ui dropdown width48 v-middle" multiple style='width:385px;'>
  245. <option value="ACC">ACC</option>
  246. <option value="CAV">CAV</option>
  247. <option value="ASS">ASS</option>
  248. <option value="ALDp">ALDp</option>
  249. <option value="ACAC">ACAC</option>
  250. <option value="ACTC">ACTC</option>
  251. <option value="PSD">PSD</option>
  252. <option value="CACC">CACC</option>
  253. </select>
  254. {{template "repo/modelsafety/indicators_descr".}}
  255. </div>
  256. <div class="inline min_title field">
  257. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.run_parameter"}}</label>
  258. <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;">
  259. <i class="plus square outline icon"></i>{{.i18n.Tr "repo.modelarts.train_job.add_run_parameter"}}
  260. </span>
  261. <input id="store_run_para" type="hidden" name="run_para_list">
  262. <div class="dynamic field" style="margin-top: 1rem;" data-params="{{.run_para_list}}" data-params-value="{{.i18n.Tr "repo.modelarts.train_job.parameter_value"}}" data-params-name="{{.i18n.Tr "repo.modelarts.train_job.parameter_name"}}"></div>
  263. </div>
  264. <div class="required min_title inline field">
  265. <label class="label-fix-width" style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
  266. <select id="__specs__" class="ui dropdown width48"
  267. placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' ovalue="{{.spec_id}}"
  268. {{if .CloudBrainPaySwitch}}blance="{{.PointAccount.Balance}}"{{end}}
  269. name="spec_id">
  270. </select>
  271. {{if .CloudBrainPaySwitch}}
  272. <div class="cloudbrain_resource_spec_blance_tip width48" style="padding:0 5px;margin:6px 0;margin-left:155px;font-size:12px;">
  273. <span>{{$.i18n.Tr "points.balance_of_points"}}<span style="color:red;margin: 0 3px">{{.PointAccount.Balance}}</span>{{$.i18n.Tr "points.points"}}</span><span>{{$.i18n.Tr "points.expected_time"}}<span style="color:red;margin: 0 3px" class="can-use-time"></span>{{$.i18n.Tr "points.hours"}}</span>
  274. <span style="float:right;">
  275. <i class="question circle icon link" data-position="right center" data-variation="mini"></i>
  276. <a href="{{AppSubUrl}}/reward/point/rule" target="_blank">{{$.i18n.Tr "points.points_acquisition_instructions"}}</a>
  277. </span>
  278. </div>
  279. {{end}}
  280. </div>
  281. <div class="inline unite min_title field">
  282. <label class="label-fix-width" style="font-weight: normal;"></label>
  283. <button class="ui create_train_job green button">
  284. {{.i18n.Tr "repo.cloudbrain.new"}}
  285. </button>
  286. <a class="ui button" href="{{.RepoLink}}/cloudbrain/benchmark">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
  287. </div>
  288. </div>
  289. </form>
  290. </div>
  291. </div>
  292. </div>
  293. {{template "base/footer" .}}
  294. <script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script>
  295. <script src="{{StaticUrlPrefix}}/js/cloudbrainNew.js?v={{MD5 AppVer}}" type="text/javascript"></script>
  296. <script>
  297. let form = document.getElementById('form_id');
  298. let createFlag = false
  299. form.onsubmit = function (e) {
  300. if(createFlag) return false
  301. createFlag = true
  302. }
  303. $('.menu .item').tab();
  304. var isValidate = false;
  305. function validate() {
  306. $('.ui.form')
  307. .form({
  308. on: 'blur',
  309. fields: {
  310. model_name:{
  311. identifier : 'model_name',
  312. rules: [
  313. {
  314. type: 'empty',
  315. }
  316. ]
  317. },
  318. train_url:{
  319. identifier : 'train_url',
  320. rules: [
  321. {
  322. type: 'empty',
  323. }
  324. ]
  325. },
  326. ckpt_name:{
  327. identifier : 'ckpt_name',
  328. rules: [
  329. {
  330. type: 'empty',
  331. }
  332. ]
  333. },
  334. },
  335. onSuccess: function () {
  336. // $('.ui.page.dimmer').dimmer('show')
  337. document.getElementById("mask").style.display = "block"
  338. isValidate = true;
  339. },
  340. onFailure: function (e) {
  341. isValidate = false;
  342. return false;
  343. }
  344. })
  345. }
  346. // validate()
  347. $('.ui.create_train_job.green.button').click(function (e) {
  348. validate()
  349. })
  350. ;(function() {
  351. var SPECS = {{ .train_specs }} || {{ .Specs }};
  352. var showPoint = {{ .CloudBrainPaySwitch }};
  353. window.renderSpecsSelect($('#__specs__'), SPECS, showPoint, {
  354. gpu_memory: {{$.i18n.Tr "cloudbrain.gpu_memory"}},
  355. free: {{$.i18n.Tr "cloudbrain.free"}},
  356. point_hr: {{$.i18n.Tr "cloudbrain.point_hr"}},
  357. memory: {{$.i18n.Tr "cloudbrain.memory"}},
  358. shared_memory: {{$.i18n.Tr "cloudbrain.shared_memory"}},
  359. });
  360. })();
  361. ;(function() {
  362. var baseDataSetName = {{.BaseDataSetName}} || '';
  363. var baseDataSetUUID = {{.BaseDataSetUUID}} || '';
  364. var combatDataSetName = {{.CombatDataSetName}} || '';
  365. var combatDataSetUUID = {{.CombatDataSetUUID}} || '';
  366. var baseDataSetSel = $('#baseDataSet-sel');
  367. var combatDataSetSel = $('#combatDataSet-sel');
  368. function initDataSetSelect(names, keys, selectEl) {
  369. selectEl.empty();
  370. var nameList = names.split(';');
  371. var keyList = keys.split(';')
  372. for (var i = 0, iLen = nameList.length; i < iLen; i++) {
  373. selectEl.append(`<option index="${i}" value="${keyList[i]}">${nameList[i]}</option>`);
  374. }
  375. selectEl.on('change', function() {
  376. var self = $(this);
  377. var selectIndex = self.find('option:selected').attr('index');
  378. var type = self.attr('id');
  379. if (type === 'baseDataSet-sel') {
  380. var val = combatDataSetSel.find('option[index="'+selectIndex+'"]').attr('value');
  381. combatDataSetSel.dropdown('set selected', val);
  382. } else {
  383. var val = baseDataSetSel.find('option[index="'+selectIndex+'"]').attr('value');
  384. baseDataSetSel.dropdown('set selected', val);
  385. }
  386. }).trigger('change');
  387. }
  388. initDataSetSelect(baseDataSetName, baseDataSetUUID, baseDataSetSel);
  389. initDataSetSelect(combatDataSetName, combatDataSetUUID, combatDataSetSel);
  390. $('#job_indicators').on('change', function() {
  391. var value = $(this).val();
  392. $('input[name="evaluation_index"]').val(value.join(';'));
  393. }).trigger('change');
  394. })();
  395. </script>