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

3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  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. </style>
  49. <!-- <div class="ui page dimmer">
  50. <div class="ui text loader">{{.i18n.Tr "loading"}}</div>
  51. </div> -->
  52. <div id="mask">
  53. <div id="loadingPage">
  54. <div class="rect1"></div>
  55. <div class="rect2"></div>
  56. <div class="rect3"></div>
  57. <div class="rect4"></div>
  58. <div class="rect5"></div>
  59. </div>
  60. </div>
  61. <div class="repository">
  62. {{template "repo/header" .}}
  63. <div class="ui container">
  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 class="ui form" action="{{.Link}}" method="post">
  71. {{.CsrfTokenHtml}}
  72. <input type="hidden" name="action" value="update">
  73. <div class="required unite min_title inline field">
  74. <label style="font-weight: normal;">{{.i18n.Tr "repo.modelarts.train_job.job_name"}}</label>
  75. <input style="width: 60%;" name="job_name" id="trainjob_job_name" placeholder={{.i18n.Tr "repo.modelarts.train_job.job_name"}} value="{{.job_name}}" tabindex="3" autofocus required maxlength="254">
  76. </div>
  77. <div class="unite min_title inline field">
  78. <label style="font-weight: normal;" for="description">{{.i18n.Tr "repo.modelarts.train_job.description"}}&nbsp;&nbsp;</label>
  79. <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)"></textarea>
  80. </div>
  81. <div class="required unite min_title inline field">
  82. <label style="font-weight: normal;">GPU类型</label>
  83. <select id="cloudbrain_gpu_type" class="ui search dropdown" placeholder="选择GPU类型" style='width:385px' name="gpu_type">
  84. {{range .benchmark_gpu_types}}
  85. <option value="{{.Queue}}">{{.Value}}</option>
  86. {{end}}
  87. </select>
  88. </div>
  89. <div class="required unite min_title inline fields" style="width: 90%;">
  90. <label style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_type"}}&nbsp;&nbsp;&nbsp;</label>
  91. <div class="field" style="flex: 1.5;">
  92. <select class="ui dropdown width" id="benchmark_types_id" name="benchmark_types_id" >
  93. {{range .benchmark_types}}
  94. <option value="{{.Id}}">{{.First}}</option>
  95. {{end}}
  96. </select>
  97. </div>
  98. <label style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_child_type"}}&nbsp;&nbsp;&nbsp;</label>
  99. <div class="field" style="flex: 2;" id="engine_name">
  100. <select class="ui dropdown width" id="benchmark_child_types_id" style='width: 100%;' name="benchmark_child_types_id">
  101. </select>
  102. </div>
  103. </div>
  104. <div class="required unite min_title inline field">
  105. <label style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_mirror"}}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
  106. <input type="text" list="cloudbrain_image" placeholder="选择镜像" name="image" required autofocus maxlength="254">
  107. <i class="times circle outline icon icons" style="visibility: hidden;" onclick="clearValue()"></i>
  108. <datalist class="ui search" id="cloudbrain_image" style='width:385px;' name="image">
  109. {{range .images}}
  110. <option name="image" value="{{.Place}}">{{.PlaceView}}</option>
  111. {{end}}
  112. {{range .public_images}}
  113. <option name="image" value="{{.Place}}">{{.PlaceView}}</option>
  114. {{end}}
  115. </datalist>
  116. </div>
  117. <div class="required unite min_title inline field">
  118. <label style="font-weight: normal;">资源规格</label>
  119. <select id="cloudbrain_resource_spec" class="ui search dropdown" placeholder="选择资源规格" style='width:385px' name="resource_spec_id">
  120. {{range .benchmark_resource_specs}}
  121. <option name="resource_spec_id" value="{{.Id}}">GPU数:{{.GpuNum}},CPU数:{{.CpuNum}},内存(MB):{{.MemMiB}},共享内存(MB):{{.ShareMemMiB}}</option>
  122. {{end}}
  123. </select>
  124. </div>
  125. <div class="inline unite min_title field required">
  126. <label style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_train"}}</label>
  127. <input disabled="disabled" style="width: 33.5%;" name="train_file" id="train_file" value="train.py" tabindex="3" autofocus required maxlength="254" >
  128. <a href="https://git.openi.org.cn/OpenIOSSG/MINIST_Example" target="_blank">查看样例</a>
  129. </div>
  130. <div class="inline unite min_title field required">
  131. <label style="font-weight: normal;">{{.i18n.Tr "repo.cloudbrain.benchmark.evaluate_test"}}</label>
  132. <input disabled="disabled" style="width: 33.5%;" name="test_file" id="test_file" value="test.py" tabindex="3" autofocus required maxlength="254" >
  133. <a href="https://git.openi.org.cn/OpenIOSSG/MINIST_Example" target="_blank">查看样例</a>
  134. </div>
  135. <div class="inline unite min_title field">
  136. <button class="ui create_train_job green button">
  137. {{.i18n.Tr "repo.cloudbrain.new"}}
  138. </button>
  139. <a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
  140. </div>
  141. <!-- 模态框 -->
  142. </form>
  143. </div>
  144. </div>
  145. </div>
  146. {{template "base/footer" .}}
  147. <script>
  148. let url_href = window.location.pathname.split('create')[0]
  149. $(".ui.button").attr('href',url_href)
  150. $('.menu .item')
  151. .tab();
  152. $('#benchmark_types_id').change(function(){
  153. setChildType();
  154. })
  155. function setChildType(){
  156. var html = "<option value=\"1\">无</option>" ;
  157. if ($('#benchmark_types_id').val() == '2') {
  158. html = "<option value=\"1\">vehicle reid</option>" ;
  159. html += "<option value=\"2\">image-based person reid</option>" ;
  160. html += "<option value=\"3\">person search</option>" ;
  161. html += "<option value=\"4\">video-based person reid</option>" ;
  162. }
  163. document.getElementById("benchmark_child_types_id").innerHTML=html;
  164. }
  165. document.onreadystatechange = function() {
  166. if (document.readyState === "complete") {
  167. setChildType();
  168. }
  169. }
  170. function validate(){
  171. $('.ui.form')
  172. .form({
  173. on: 'blur',
  174. inline:true,
  175. fields: {
  176. job_name:{
  177. identifier : 'job_name',
  178. rules: [
  179. {
  180. type: 'regExp[/^[a-zA-Z0-9-_]{1,36}$/]',
  181. prompt : '只包含大小写字母、数字、_和-,最长36个字符。'
  182. }
  183. ]
  184. },
  185. image:{
  186. identifier : 'image',
  187. rules: [
  188. {
  189. type: 'empty',
  190. prompt : '选择一个镜像'
  191. }
  192. ]
  193. }
  194. },
  195. onSuccess: function(){
  196. // $('.ui.page.dimmer').dimmer('show')
  197. document.getElementById("mask").style.display = "block"
  198. },
  199. onFailure: function(e){
  200. return false;
  201. }
  202. })
  203. }
  204. $('.ui.create_train_job.green.button').click(function(e) {
  205. validate()
  206. })
  207. </script>