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

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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. padding-left: 6rem !important;
  14. margin-bottom: 2rem !important;
  15. }
  16. .width{
  17. width:100% !important;
  18. }
  19. .width80{
  20. width: 80.7% !important;
  21. margin-left: 10px;
  22. }
  23. .width85{
  24. width: 85% !important;
  25. margin-left: 4.5rem !important;
  26. }
  27. .width81{
  28. margin-left: 1.5rem;
  29. width: 81% !important;
  30. }
  31. .add{font-size: 18px;
  32. padding: 0.5rem;
  33. border: 1px solid rgba(187, 187, 187, 100);
  34. border-radius: 0px 5px 5px 0px;
  35. line-height: 21px;
  36. text-align: center;
  37. color: #C2C7CC;
  38. }
  39. .min{
  40. font-size: 18px;
  41. padding: 0.5rem;
  42. border: 1px solid rgba(187, 187, 187, 100);
  43. border-radius: 5px 0px 0px 5px;
  44. line-height: 21px;
  45. text-align: center;
  46. color: #C2C7CC;
  47. }
  48. .nowrapx {
  49. white-space: nowrap !important;
  50. }
  51. </style>
  52. <!-- <div class="ui page dimmer">
  53. <div class="ui text loader">{{.i18n.Tr "loading"}}</div>
  54. </div> -->
  55. <div id="mask">
  56. <div id="loadingPage">
  57. <div class="rect1"></div>
  58. <div class="rect2"></div>
  59. <div class="rect3"></div>
  60. <div class="rect4"></div>
  61. <div class="rect5"></div>
  62. </div>
  63. </div>
  64. <div class="repository">
  65. {{template "repo/header" .}}
  66. <div class="ui container">
  67. {{template "base/alert" .}}
  68. <h4 class="ui top attached header">
  69. {{.i18n.Tr "repo.modelarts.evaluate_job.new_job"}}
  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. <div class="required unite min_title inline field">
  77. <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>
  78. <input style="width: 80%;" name="display_job_name" id="trainjob_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.display_job_name}}" tabindex="3" autofocus required maxlength="254">
  79. </div>
  80. <div class="unite min_title inline field">
  81. <label style="font-weight: normal;" for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}}&nbsp;&nbsp;</label>
  82. <textarea style="width: 80%;" id="description" name="description" rows="3" maxlength="254" 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)">{{.description}}</textarea>
  83. </div>
  84. <div class="required unite min_title inline field">
  85. <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.gpu_type"}}</label>
  86. <select id="cloudbrain_gpu_type" class="ui search dropdown" placeholder="选择GPU类型" style='width:385px' name="gpu_type">
  87. {{range .benchmark_gpu_types}}
  88. <option value="{{.Queue}}">{{.Value}}</option>
  89. {{end}}
  90. </select>
  91. </div>
  92. <div class="required unite inline min_title fields" style="width: 90%;">
  93. <div class="required eight wide field">
  94. <label style="font-weight: normal;white-space: nowrap;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_type"}}</label>
  95. <span>&nbsp;</span>
  96. <select class="ui fluid selection search dropdown" id="benchmark_types_id" name="benchmark_types_id" >
  97. {{range .benchmark_types}}
  98. {{if eq .Id $.benchmarkTypeID}}
  99. <option value="{{.Id}}" selected="true">{{.First}}</option>
  100. {{else}}
  101. <option value="{{.Id}}">{{.First}}</option>
  102. {{end}}
  103. {{end}}
  104. </select>
  105. </div>
  106. <div class="eight wide field" id="engine_name">
  107. <input type="hidden" id="benchmark_child_types_id_hidden" name="benchmark_child_types_id_hidden" value="{{.benchmark_child_types_id_hidden}}">
  108. <label style="font-weight: normal;white-space: nowrap;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_child_type"}}</label>
  109. <select class="ui fluid selection dropdown nowrapx" id="benchmark_child_types_id" style='width: 100%;' name="benchmark_child_types_id">
  110. </select>
  111. </div>
  112. </div>
  113. <div id="images-new-cb">
  114. </div>
  115. <div class="required unite min_title inline field">
  116. <label style="font-weight: normal;">{{.i18n.Tr "cloudbrain.resource_specification"}}</label>
  117. <select id="cloudbrain_resource_spec" class="ui search dropdown" placeholder="{{.i18n.Tr "cloudbrain.select_specification"}}" style='width:385px' name="resource_spec_id">
  118. {{range .benchmark_resource_specs}}
  119. <option name="resource_spec_id" 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>
  120. {{end}}
  121. </select>
  122. </div>
  123. <div class="inline unite min_title field required">
  124. <label style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}}</label>
  125. <input disabled="disabled" style="width: 33.5%;" name="train_file" id="train_file" value="train.py" tabindex="3" autofocus required maxlength="254" >
  126. <a id="train_href_id" href="https://git.openi.org.cn/CV_benchmark/CV_reID_benchmark" target="_blank">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}}</a>
  127. </div>
  128. <div class="inline unite min_title field required">
  129. <label style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_test"}}</label>
  130. <input disabled="disabled" style="width: 33.5%;" name="test_file" id="test_file" value="test.py" tabindex="3" autofocus required maxlength="254" >
  131. <a id="test_href_id" href="https://git.openi.org.cn/CV_benchmark/CV_reID_benchmark" target="_blank">{{.i18n.Tr "cloudbrain.view_sample"}}</a>
  132. </div>
  133. <div class="inline unite min_title field">
  134. <button class="ui create_train_job green button">
  135. {{.i18n.Tr "repo.cloudbrain.new"}}
  136. </button>
  137. <a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
  138. </div>
  139. <!-- 模态框 -->
  140. </form>
  141. </div>
  142. </div>
  143. </div>
  144. {{template "base/footer" .}}
  145. <script>
  146. let repolink = {{.RepoLink}}
  147. let url_href = window.location.pathname.split('create')[0]
  148. $(".ui.button").attr('href',url_href)
  149. $('.menu .item')
  150. .tab();
  151. $('#benchmark_types_id').change(function(){
  152. setChildType();
  153. })
  154. function setChildType(){
  155. let type_id = $('#benchmark_types_id').val();
  156. if(type_id == 3){
  157. $('#train_href_id').attr('href','https://git.openi.org.cn/CV_benchmark/CV_MOT_benchmark');
  158. $('#test_href_id').attr('href','https://git.openi.org.cn/CV_benchmark/CV_MOT_benchmark');
  159. }else{
  160. $('#train_href_id').attr('href','https://git.openi.org.cn/CV_benchmark/CV_reID_benchmark');
  161. $('#test_href_id').attr('href','https://git.openi.org.cn/CV_benchmark/CV_reID_benchmark');
  162. }
  163. let child_selected_id = $('#benchmark_child_types_id_hidden').val();
  164. $.get(`${repolink}/cloudbrain/benchmark/get_child_types?benchmark_type_id=${type_id}`, (data) => {
  165. const n_length = data['child_types'].length
  166. let html=''
  167. for (let i=0;i<n_length;i++){
  168. if(child_selected_id == data['child_types'][i].id){
  169. html += `<option value="${data['child_types'][i].id}" selected="true">${data['child_types'][i].value}</option>`;
  170. }else{
  171. html += `<option value="${data['child_types'][i].id}">${data['child_types'][i].value}</option>`;
  172. }
  173. }
  174. document.getElementById("benchmark_child_types_id").innerHTML=html;
  175. })
  176. }
  177. document.onreadystatechange = function() {
  178. if (document.readyState === "complete") {
  179. setChildType();
  180. }
  181. }
  182. function validate(){
  183. $('.ui.form')
  184. .form({
  185. on: 'blur',
  186. inline:true,
  187. fields: {
  188. image:{
  189. identifier : 'image',
  190. rules: [
  191. {
  192. type: 'empty',
  193. prompt : '选择一个镜像'
  194. }
  195. ]
  196. }
  197. },
  198. onSuccess: function(){
  199. // $('.ui.page.dimmer').dimmer('show')
  200. document.getElementById("mask").style.display = "block"
  201. },
  202. onFailure: function(e){
  203. return false;
  204. }
  205. })
  206. }
  207. $('.ui.create_train_job.green.button').click(function(e) {
  208. validate()
  209. })
  210. </script>