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.

show.tmpl 40 kB

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
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 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
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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873
  1. {{template "base/head" .}}
  2. <link rel="stylesheet" href="/self/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
  3. <style>
  4. .according-panel-heading {
  5. box-sizing: border-box;
  6. padding: 8px 16px;
  7. color: #252b3a;
  8. background-color: #f2f5fc;
  9. line-height: 1.5;
  10. cursor: pointer;
  11. -moz-user-select: none;
  12. -webkit-user-select: none;
  13. -ms-user-select: none;
  14. -khtml-user-select: none;
  15. user-select: none;
  16. }
  17. .accordion-panel-title {
  18. margin-top: 0;
  19. margin-bottom: 0;
  20. color: #252b3a;
  21. }
  22. .accordion-panel-title-content {
  23. vertical-align: middle;
  24. display: inline-block;
  25. width: calc(100% - 32px);
  26. cursor: default;
  27. }
  28. .acc-margin-bottom {
  29. margin-bottom: 5px;
  30. }
  31. .title_text {
  32. font-size: 12px;
  33. }
  34. .ac-display-inblock {
  35. display: inline-block;
  36. }
  37. .cti-mgRight-sm {
  38. margin-right: 8px;
  39. }
  40. .ac-text-normal {
  41. font-size: 14px;
  42. color: #575d6c;
  43. }
  44. .uc-accordionTitle-black {
  45. color: #333;
  46. }
  47. .accordion-border {
  48. border: 1px solid #cce2ff;
  49. }
  50. .padding0 {
  51. padding: 0 !important;
  52. }
  53. .content-pad {
  54. padding: 15px 35px;
  55. }
  56. .content-margin {
  57. margin: 10px 5px;
  58. }
  59. .tab_2_content {
  60. min-height: 360px;
  61. margin-left: 10px;
  62. }
  63. .ac-grid {
  64. display: block;
  65. *zoom: 1;
  66. }
  67. .ac-grid-col {
  68. float: left;
  69. width: 100%;
  70. }
  71. .ac-grid-col2 .ac-grid-col {
  72. width: 50%;
  73. }
  74. .ti-form {
  75. text-align: left;
  76. max-width: 100%;
  77. vertical-align: middle;
  78. }
  79. .ti-form>tbody {
  80. font-size: 12px;
  81. }
  82. .ti-form>tbody,
  83. .ti-form>tbody>tr {
  84. vertical-align: inherit;
  85. }
  86. .ti-text-form-label {
  87. padding-bottom: 20px;
  88. padding-right: 20px;
  89. color: #8a8e99;
  90. font-size: 12px;
  91. white-space: nowrap !important;
  92. width: 80px;
  93. line-height: 30px;
  94. }
  95. .ti-text-form-content {
  96. line-height: 30px;
  97. padding-bottom: 20px;
  98. }
  99. .ti-form>tbody>tr>td {
  100. vertical-align: top;
  101. white-space: normal;
  102. }
  103. td,
  104. th {
  105. padding: 0;
  106. }
  107. .ac-grid-col .text-span {
  108. width: 450px;
  109. overflow: hidden;
  110. text-overflow: ellipsis;
  111. white-space: nowrap;
  112. }
  113. .redo-color {
  114. color: #3291F8;
  115. }
  116. .ti-action-menu-item:not(:last-child) {
  117. margin-right: 10px;
  118. padding-right: 11px;
  119. text-decoration: none !important;
  120. color: #526ecc;
  121. cursor: pointer;
  122. display: inline-block;
  123. -moz-user-select: none;
  124. -webkit-user-select: none;
  125. -ms-user-select: none;
  126. -khtml-user-select: none;
  127. user-select: none;
  128. position: relative;
  129. }
  130. .ti-action-menu-item:not(:last-child):after {
  131. content: "";
  132. display: inline-block;
  133. position: absolute;
  134. height: 12px;
  135. right: 0;
  136. top: 50%;
  137. -webkit-transform: translateY(-6px);
  138. -ms-transform: translateY(-6px);
  139. -o-transform: translateY(-6px);
  140. transform: translateY(-6px);
  141. border-right: 1px solid #dfe1e6;
  142. }
  143. .text-width80 {
  144. width: 100px;
  145. line-height: 30px;
  146. }
  147. .border-according {
  148. border: 1px solid #dfe1e6;
  149. }
  150. .disabled {
  151. cursor: default;
  152. pointer-events: none;
  153. color: rgba(0, 0, 0, .6) !important;
  154. opacity: .45 !important;
  155. }
  156. .pad20 {
  157. border: 0px !important;
  158. }
  159. .model_file_bread {
  160. margin-bottom: -0.5rem !important;
  161. padding-left: 1rem;
  162. padding-top: 0.5rem;
  163. }
  164. .menuContent{
  165. position: absolute;
  166. background: #ffffff;
  167. left: 0;
  168. right: 26px;
  169. top: 36px;
  170. z-index:999;
  171. border: 1px solid #96c8da;
  172. border-top: 0;
  173. border-bottom-right-radius: 4px;
  174. border-bottom-left-radius: 4px;
  175. box-shadow: 0 2px 3px 0 rgb(34 36 38 / 15%);
  176. }
  177. </style>
  178. {{template "custom/global_mask" .}}
  179. <div class="repository">
  180. {{template "repo/header" .}}
  181. <div class="ui container">
  182. <h4 class="ui header" id="vertical-segment">
  183. <div class="ui breadcrumb">
  184. <a class="section" href="{{.RepoLink}}/debugjob?debugListType=all">
  185. {{.i18n.Tr "repo.cloudbrain"}}
  186. </a>
  187. <div class="divider"> / </div>
  188. <a class="section" href="{{$.RepoLink}}/modelarts/train-job">
  189. {{$.i18n.Tr "repo.modelarts.train_job"}}
  190. </a>
  191. <div class="divider"> / </div>
  192. <div class="active section">{{.displayJobName}}</div>
  193. </div>
  194. </h4>
  195. {{range $k ,$v := .version_list_task}}
  196. <div class="ui accordion border-according" id="accordion{{.VersionName}}"
  197. data-repopath="{{$.RepoRelPath}}/grampus/train-job" data-jobid="{{.JobID}}"
  198. data-version="{{.VersionName}}">
  199. <div class="{{if eq $k 0}}active{{end}} title padding0">
  200. <div class="according-panel-heading">
  201. <div class="accordion-panel-title">
  202. <i class="dropdown icon"></i>
  203. <span class="accordion-panel-title-content">
  204. <span>
  205. <div style="float: right;">
  206. {{$.CsrfTokenHtml}}
  207. </div>
  208. <div class="ac-display-inblock title_text acc-margin-bottom">
  209. <span class="cti-mgRight-sm">{{TimeSinceUnix1 .CreatedUnix}}</span>
  210. <span class="cti-mgRight-sm">
  211. {{$.i18n.Tr "repo.modelarts.current_version"}}:{{.VersionName}}</span>
  212. <span class="cti-mgRight-sm">
  213. {{$.i18n.Tr "repo.modelarts.parent_version"}}:{{.PreVersionName}}</span>
  214. <span class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.status"}}:
  215. <span id="{{.VersionName}}-status-span"><i id="icon"
  216. style="vertical-align: middle;" class="{{.Status}}"></i><span id="text"
  217. style="margin-left: 0.4em;font-size: 12px;">{{.Status}}</span></span>
  218. </span>
  219. <span
  220. class="cti-mgRight-sm">{{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}:</span>
  221. <span class="cti-mgRight-sm uc-accordionTitle-black"
  222. id="{{.VersionName}}-duration-span">{{.TrainJobDuration}}</span>
  223. <span id="refresh-status" data-tooltip="刷新" style="cursor: pointer;" data-inverted="" data-version="{{.VersionName}}">
  224. <i class="redo icon redo-color"></i>
  225. </span>
  226. </div>
  227. <div style="float: right;">
  228. {{if and ($.canDownload) (eq .Status "SUCCEEDED") ($.Permission.CanWrite $.UnitTypeModelManage) }}
  229. <a class="ti-action-menu-item" id="{{.VersionName}}-create-model"
  230. onclick="showcreate({{.}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
  231. {{else}}
  232. <a class="ti-action-menu-item disabled" id="{{.VersionName}}-create-model"
  233. onclick="showcreate({{.}})">{{$.i18n.Tr "repo.modelarts.create_model"}}</a>
  234. {{end}}
  235. </div>
  236. </span>
  237. </span>
  238. </div>
  239. </div>
  240. </div>
  241. <div class="{{if eq $k 0}}active{{end}} content">
  242. <div class="content-pad">
  243. <div class="ui pointing secondary menu" style="border-bottom: 1px solid rgba(34,36,38,.15);">
  244. <a class="active item" data-tab="first{{$k}}">{{$.i18n.Tr "repo.modelarts.train_job.config"}}</a>
  245. <a class="item log_bottom" data-tab="second{{$k}}" data-version="{{.VersionName}}">{{$.i18n.Tr "repo.modelarts.log"}}</a>
  246. <a class="item load-model-file" data-tab="third{{$k}}" data-download-flag="{{$.canDownload}}" data-path="{{$.RepoLink}}/modelarts/train-job/{{.JobID}}/model_list" data-version="{{.VersionName}}" data-parents="" data-filename="" data-init="init" >{{$.i18n.Tr "repo.model_download"}}</a>
  247. </div>
  248. <div class="ui tab active" data-tab="first{{$k}}">
  249. <div style="padding-top: 10px;">
  250. <div class="tab_2_content">
  251. <div class="ac-grid ac-grid-col2">
  252. <div class="ac-grid-col">
  253. <table class="ti-form">
  254. <tbody class="ti-text-form">
  255. <tr class="ti-no-ng-animate">
  256. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  257. {{$.i18n.Tr "repo.cloudbrain_task"}}
  258. </td>
  259. <td class="ti-text-form-content">
  260. <div class="text-span text-span-w">
  261. {{.DisplayJobName}}
  262. </div>
  263. </td>
  264. </tr>
  265. <tr class="ti-no-ng-animate">
  266. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  267. {{$.i18n.Tr "repo.modelarts.status"}}
  268. </td>
  269. <td class="ti-text-form-content">
  270. <div class="text-span text-span-w" id="{{.VersionName}}-status">
  271. {{.Status}}
  272. </div>
  273. </td>
  274. </tr>
  275. <tr class="ti-no-ng-animate">
  276. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  277. {{$.i18n.Tr "repo.modelarts.run_version"}}
  278. </td>
  279. <td class="ti-text-form-content">
  280. <div class="text-span text-span-w">
  281. {{.VersionName}}
  282. </div>
  283. </td>
  284. </tr>
  285. <tr class="ti-no-ng-animate">
  286. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  287. {{$.i18n.Tr "repo.modelarts.train_job.start_time"}}
  288. </td>
  289. <td class="ti-text-form-content">
  290. <div class="text-span text-span-w">
  291. <span style="font-size: 12px;" class="">
  292. {{if not (eq .StartTime 0)}}
  293. {{TimeSinceUnix1 .StartTime}}
  294. {{else}}
  295. --
  296. {{end}}</span>
  297. </div>
  298. </td>
  299. </tr>
  300. <tr class="ti-no-ng-animate">
  301. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  302. {{$.i18n.Tr "repo.modelarts.train_job.dura_time"}}
  303. </td>
  304. <td class="ti-text-form-content">
  305. <div class="text-span text-span-w"
  306. id="{{.VersionName}}-duration">
  307. {{.TrainJobDuration}}
  308. </div>
  309. </td>
  310. </tr>
  311. <tr class="ti-no-ng-animate">
  312. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  313. {{$.i18n.Tr "repo.modelarts.train_job.standard"}}
  314. </td>
  315. <td class="ti-text-form-content">
  316. <div class="text-span text-span-w">
  317. {{.FlavorName}}
  318. </div>
  319. </td>
  320. </tr>
  321. <tr class="ti-no-ng-animate">
  322. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  323. {{$.i18n.Tr "repo.modelarts.train_job.compute_node"}}
  324. </td>
  325. <td class="ti-text-form-content">
  326. <div class="text-span text-span-w">
  327. {{.WorkServerNumber}}
  328. </div>
  329. </td>
  330. </tr>
  331. </tbody>
  332. </table>
  333. </div>
  334. <div class="ac-grid-col">
  335. <table class="ti-form">
  336. <tbody class="ti-text-form">
  337. <tr class="ti-no-ng-animate">
  338. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  339. {{$.i18n.Tr "repo.modelarts.train_job.AI_driver"}}
  340. </td>
  341. <td class="ti-text-form-content">
  342. <div class="text-span text-span-w">
  343. {{.EngineName}}
  344. </div>
  345. </td>
  346. </tr>
  347. <tr class="ti-no-ng-animate">
  348. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  349. {{$.i18n.Tr "repo.modelarts.code_version"}}
  350. </td>
  351. <td class="ti-text-form-content">
  352. <div class="text-span text-span-w">
  353. {{.BranchName}}
  354. </div>
  355. </td>
  356. </tr>
  357. <tr class="ti-no-ng-animate">
  358. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  359. {{$.i18n.Tr "repo.modelarts.train_job.start_file"}}
  360. </td>
  361. <td class="ti-text-form-content">
  362. <div class="text-span text-span-w">
  363. {{.BootFile}}
  364. </div>
  365. </td>
  366. </tr>
  367. <tr class="ti-no-ng-animate">
  368. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  369. {{$.i18n.Tr "repo.modelarts.train_job.train_dataset"}}
  370. </td>
  371. <td class="ti-text-form-content">
  372. <div class="text-span text-span-w">
  373. {{range $m ,$n := $.datasetDownload}}
  374. <a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a>
  375. {{end}}
  376. </div>
  377. </td>
  378. </tr>
  379. <tr class="ti-no-ng-animate">
  380. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  381. {{$.i18n.Tr "repo.modelarts.train_job.run_parameter"}}
  382. </td>
  383. <td class="ti-text-form-content">
  384. <div class="text-span text-span-w" title="{{.Parameters}}">
  385. {{.Parameters}}
  386. </div>
  387. </td>
  388. </tr>
  389. <tr class="ti-no-ng-animate">
  390. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  391. {{$.i18n.Tr "repo.grampus.train_job.ai_center"}}
  392. </td>
  393. <td class="ti-text-form-content">
  394. <div class="text-span text-span-w" id="{{.VersionName}}-ai_center">
  395. {{$.ai_center}}
  396. </div>
  397. </td>
  398. </tr>
  399. </tr>
  400. <tr class="ti-no-ng-animate">
  401. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  402. {{$.i18n.Tr "repo.modelarts.train_job.description"}}
  403. </td>
  404. <td class="ti-text-form-content">
  405. <div class="text-span text-span-w"
  406. title="{{.Description}}">
  407. {{.Description}}
  408. </div>
  409. </td>
  410. </tr>
  411. </tbody>
  412. </table>
  413. </div>
  414. </div>
  415. </div>
  416. </div>
  417. </div>
  418. <div class="ui tab" data-tab="second{{$k}}">
  419. <div style="position: relative;">
  420. <span>
  421. <a title="滚动到顶部" style="position: absolute; right: -32px;cursor: pointer;"
  422. class="log_top" data-version="{{.VersionName}}"><i class="icon-to-top"></i></a>
  423. </span>
  424. <span class="log-info">
  425. <a title="滚动到底部" style="position: absolute; bottom: 10px;right: -32px;cursor: pointer;"
  426. class="log_bottom" data-version="{{.VersionName}}"><i
  427. class="icon-to-bottom"></i></a>
  428. </span>
  429. <div class="ui message message{{.VersionName}}" style="display: none;">
  430. <div id="header"></div>
  431. </div>
  432. <div class="ui attached log" id="log{{.VersionName}}"
  433. style="height: 300px !important; overflow: auto;">
  434. <div class="ui inverted active dimmer">
  435. <div class="ui loader"></div>
  436. </div>
  437. <input type="hidden" name="end_line" value>
  438. <input type="hidden" name="start_line" value>
  439. <pre id="log_file{{.VersionName}}"></pre>
  440. </div>
  441. </div>
  442. </div>
  443. <div class="ui tab" data-tab="third{{$k}}">
  444. <input type="hidden" name="model{{.VersionName}}" value="-1">
  445. <input type="hidden" name="modelback{{.VersionName}}" value="-1">
  446. <div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
  447. <div class="active section">{{.VersionName}}</div>
  448. <div class="divider"> / </div>
  449. </div>
  450. <div id="dir_list{{.VersionName}}">
  451. </div>
  452. {{if eq .ComputeResource "CPU/GPU"}}
  453. <div style="display:flex;align-items: center;justify-content: end;color: #f2711c;">
  454. <i class="ri-error-warning-line" style="margin-right:0.5rem;"></i>
  455. <span>{{$.i18n.Tr "repo.file_limit_100"}}</span>
  456. </div>
  457. {{end}}
  458. </div>
  459. </div>
  460. </div>
  461. </div>
  462. {{end}} {{template "base/paginate" .}}
  463. </div>
  464. <!-- 确认模态框 -->
  465. <div id="deletemodel">
  466. <div class="ui basic modal">
  467. <div class="ui icon header">
  468. <i class="trash icon"></i> {{.i18n.Tr "cloudbrain.delete_task"}}
  469. </div>
  470. <div class="content">
  471. <p>{{.i18n.Tr "cloudbrain.task_delete_confirm"}}</p>
  472. </div>
  473. <div class="actions">
  474. <div class="ui red basic inverted cancel button">
  475. <i class="remove icon"></i> {{.i18n.Tr "cloudbrain.operate_cancel"}}
  476. </div>
  477. <div class="ui green basic inverted ok button">
  478. <i class="checkmark icon"></i> {{.i18n.Tr "cloudbrain.operate_confirm"}}
  479. </div>
  480. </div>
  481. </div>
  482. </div>
  483. <!-- 创建模型 -->
  484. <div id="newmodel">
  485. <div class="ui modal second">
  486. <div class="header" style="padding: 1rem;background-color: rgba(240, 240, 240, 100);">
  487. <h4 id="model_header">导入新模型</h4>
  488. </div>
  489. <div class="content content-padding">
  490. <form id="formId" method="POST" class="ui form">
  491. <div class="ui error message">
  492. </div>
  493. {{$.CsrfTokenHtml}}
  494. <input type="hidden" name="trainTaskCreate" value="true">
  495. <div class="required inline field">
  496. <label>训练任务</label>
  497. <input type="hidden" class="width83" id="JobId" name="JobId" readonly required>
  498. <input type="hidden" id="VersionName" name="VersionName" value="V0001">
  499. <input style="width: 45%;" id="JobName" readonly required>
  500. </div>
  501. <div class="required inline field" id="modelname">
  502. <label>模型名称</label>
  503. <input style="width: 45%;" id="name" name="Name" required maxlength="25"
  504. onkeyup="this.value=this.value.replace(/[, ]/g,'')">
  505. </div>
  506. <div class="required inline field" id="verionname">
  507. <label>模型版本</label>
  508. <input style="width: 45%;" id="version" name="Version" value="" readonly required maxlength="255">
  509. </div>
  510. <div class="unite min_title inline field required">
  511. <label>模型框架</label>
  512. <div class="ui dropdown selection search width70" id="choice_Engine">
  513. <input type="hidden" id="Engine" name="Engine" required>
  514. <div class="default text">选择模型框架</div>
  515. <i class="dropdown icon"></i>
  516. <div class="menu" id="job-Engine">
  517. <option class="active item" data-value="0">PyTorch</option>
  518. <option class="item" data-value="1">TensorFlow</option>
  519. <option class="item" data-value="2">MindSpore</option>
  520. <option class="item" data-value="4">PaddlePaddle</option>
  521. <option class="item" data-value="5">OneFlow</option>
  522. <option class="item" data-value="6">MXNet</option>
  523. <option class="item" data-value="3">Other</option>
  524. </div>
  525. </div>
  526. </div>
  527. <div class="unite min_title inline fields required">
  528. <div class="field required">
  529. <label for="modelSelectedFile">模型文件</label>
  530. </div>
  531. <div class="thirteen wide field" style="position:relative">
  532. <input id="modelSelectedFile" type="text" readonly required onclick="showMenu();" name="modelSelectedFile" >
  533. <div id="menuContent" class="menuContent" style="display:none;">
  534. <ul id="treeDemo" class="ztree"></ul>
  535. </div>
  536. </div>
  537. </div>
  538. <div class="inline field">
  539. <label>模型标签</label>
  540. <input style="width: 83%;margin-left: 7px;" id="label" name="Label" maxlength="255"
  541. placeholder='{{.i18n.Tr "repo.modelarts.train_job.label_place"}}'>
  542. </div>
  543. <div class="inline field">
  544. <label for="description">模型描述</label>
  545. <textarea style="width: 83%;margin-left: 7px;" id="Description" name="Description" rows="3"
  546. maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.new_place"}}'
  547. onchange="this.value=this.value.substring(0, 255)"
  548. onkeydown="this.value=this.value.substring(0, 255)"
  549. onkeyup="this.value=this.value.substring(0, 256)"></textarea>
  550. </div>
  551. <div class="inline field" style="margin-left: 75px;">
  552. <button onclick="createModel()" type="button" class="ui create_train_job green button"
  553. style="position: absolute;">
  554. {{.i18n.Tr "repo.model.manage.sava_model"}}
  555. </button>
  556. </div>
  557. </form>
  558. <div class="actions" style="display: inline-block;margin-left: 180px;">
  559. <button class="ui button cancel">{{.i18n.Tr "repo.cloudbrain.cancel"}}</button>
  560. </div>
  561. </div>
  562. </div>
  563. </div>
  564. </div>
  565. {{template "base/footer" .}}
  566. <script type="text/javascript" src="/self/ztree/js/jquery.ztree.core.js"></script>
  567. <script type="text/javascript" src="/self/ztree/js/jquery.ztree.excheck.js"></script>
  568. <script>
  569. var setting = {
  570. check: {
  571. enable: true,
  572. chkboxType: {"Y":"ps", "N":"ps"}
  573. },
  574. view: {
  575. dblClickExpand: false
  576. },
  577. callback: {
  578. beforeClick: beforeClick,
  579. onCheck: onCheck
  580. }
  581. };
  582. function beforeClick(treeId, treeNode) {
  583. var zTree = $.fn.zTree.getZTreeObj("treeDemo");
  584. zTree.checkNode(treeNode, !treeNode.checked, null, true);
  585. return false;
  586. }
  587. function onCheck(e, treeId, treeNode) {
  588. var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
  589. nodes = zTree.getCheckedNodes(true),
  590. v = "";
  591. for (var i=0, l=nodes.length; i<l; i++) {
  592. if(nodes[i].isParent){
  593. continue;
  594. }
  595. var pathNodes = nodes[i].getPath();
  596. var path ="";
  597. for(var j=0;j<pathNodes.length;j++){
  598. if(j ==0){
  599. path += pathNodes[j].name;
  600. }else{
  601. path += "/" + pathNodes[j].name;
  602. }
  603. }
  604. v += path + ";";
  605. }
  606. if (v.length > 0 ) v = v.substring(0, v.length-1);
  607. var cityObj = $("#modelSelectedFile");
  608. cityObj.attr("value", v);
  609. }
  610. function showMenu() {
  611. var cityObj = $("#modelSelectedFile");
  612. var cityOffset = $("#modelSelectedFile").offset();
  613. //$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");
  614. $("#menuContent").slideDown("fast");
  615. $("body").bind("mousedown", onBodyDown);
  616. }
  617. function hideMenu() {
  618. $("#menuContent").fadeOut("fast");
  619. $("body").unbind("mousedown", onBodyDown);
  620. }
  621. function onBodyDown(event) {
  622. if (!(event.target.id == "menuBtn" || event.target.id == "modelSelectedFile" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
  623. hideMenu();
  624. }
  625. }
  626. function loadSelectedModelFile(trainJob){
  627. console.log("trainJob=" + trainJob);
  628. $('#choice_file').dropdown('clear')
  629. $("#model-file").empty()
  630. if(trainJob ==null || trainJob ==""){
  631. console.log("trainJob is null");
  632. }else{
  633. let type = trainJob.Type;
  634. if(type == 2){
  635. if(trainJob.ComputeResource=="NPU"){
  636. type=1;
  637. }else{
  638. type=0;
  639. }
  640. }
  641. $.get(`/${userName}/${repoPath}/modelmanage/query_train_model?jobName=${trainJob.JobName}&type=${type}&VersionName=${trainJob.VersionName}`, (data) => {
  642. const n_length = data.length
  643. let file_html=''
  644. let firstFileName =''
  645. var zNodes=[];
  646. var nodesMap={};
  647. for (let i=0;i<n_length;i++){
  648. parentNodeMap = nodesMap;
  649. var fileSplits = data[i].FileName.split("/");
  650. for(let j=0;j < fileSplits.length;j++){
  651. if(fileSplits[j] == ""){
  652. break;
  653. }
  654. if(parentNodeMap[fileSplits[j]] == null){
  655. parentNodeMap[fileSplits[j]] = {};
  656. }
  657. parentNodeMap = parentNodeMap[fileSplits[j]]
  658. }
  659. }
  660. convertToNode(zNodes,nodesMap);
  661. $.fn.zTree.init($("#treeDemo"), setting, zNodes);
  662. })
  663. }
  664. }
  665. function convertToNode(nodeList,nodesMap){
  666. var keyList = Object.keys(nodesMap);
  667. keyList.sort(function(a,b){
  668. return a-b;
  669. });
  670. var isFirst = true;
  671. for(var i=0; i<keyList.length;i++){
  672. var node = {};
  673. node["name"] = keyList[i];
  674. nodeList.push(node);
  675. if(nodesMap[keyList[i]] != null && Object.keys(nodesMap[keyList[i]]).length >0){
  676. node["children"]=[];
  677. if(isFirst){
  678. node["open"] = true;
  679. isFirst= false;
  680. }
  681. convertToNode(node["children"],nodesMap[keyList[i]]);
  682. }
  683. }
  684. }
  685. function showcreate(obj) {
  686. $('.ui.modal.second')
  687. .modal({
  688. centered: false,
  689. onShow: function () {
  690. $('input[name="Version"]').addClass('model_disabled')
  691. // $('input[name="JobId"]').text(obj.JobName)
  692. $('#JobName').val(obj.DisplayJobName).addClass('model_disabled')
  693. $('input[name="JobId"]').val(obj.JobID)
  694. $('input[name="VersionName"]').val("V0001")
  695. if(obj.ComputeResource=="NPU"){
  696. if (obj.EngineName != null && obj.EngineName != "") {
  697. srcEngine = obj.EngineName.split('-')[0]
  698. srcEngine = srcEngine.trim().toLowerCase();
  699. if (srcEngine == 'tensorflow') {
  700. $('#choice_Engine .default.text').text("TensorFlow");
  701. $('#choice_Engine input[name="Engine"]').val(1)
  702. }
  703. if (srcEngine == 'mindspore') {
  704. $('#choice_Engine .default.text').text("MindSpore");
  705. $('#choice_Engine input[name="Engine"]').val(2)
  706. }
  707. }
  708. }else{
  709. $('#choice_Engine .default.text').text("PyTorch");
  710. $('#choice_Engine input[name="Engine"]').val(0)
  711. }
  712. $('#choice_Engine .default.text').css({ "color": "rgb(0, 0, 0,0.87)" })
  713. $('.ui.dimmer').css({ "background-color": "rgb(136, 136, 136,0.7)" })
  714. createModelName();
  715. loadSelectedModelFile(obj);
  716. },
  717. onHide: function () {
  718. var cityObj = $("#modelSelectedFile");
  719. cityObj.attr("value", "");
  720. document.getElementById("formId").reset();
  721. $('.ui.dimmer').css({ "background-color": "" })
  722. $('.ui.error.message').text()
  723. $('.ui.error.message').css('display', 'none')
  724. }
  725. })
  726. .modal('show')
  727. }
  728. function createModel() {
  729. let url_href = `/${userName}/${repoPath}/modelmanage/create_new_model`
  730. let data = $("#formId").serialize()
  731. $("#mask").css({ "display": "block", "z-index": "9999" })
  732. $.ajax({
  733. url: url_href,
  734. type: 'POST',
  735. data: data,
  736. success: function (res) {
  737. $('input[name="Engine_name"]').val("");
  738. $('input[name="Engine"]').val("");
  739. location.href = `/${userName}/${repoPath}/modelmanage/show_model`
  740. $('.ui.modal.second').modal('hide')
  741. },
  742. error: function (xhr) {
  743. // 隐藏 loading
  744. // 只有请求不正常(状态码不为200)才会执行
  745. $('.ui.error.message').text(xhr.responseText)
  746. $('.ui.error.message').css('display', 'block')
  747. },
  748. complete: function (xhr) {
  749. $("#mask").css({ "display": "none", "z-index": "1" })
  750. }
  751. })
  752. }
  753. function createModelName() {
  754. let repoName = location.pathname.split('/')[2]
  755. let modelName = repoName + '_model_' + Math.random().toString(36).substr(2, 4)
  756. $('#name').val(modelName)
  757. $('#version').val("0.0.1")
  758. }
  759. $('.menu .item').tab()
  760. $(document).ready(function () {
  761. $('.ui.accordion').accordion({ selector: { trigger: '.icon' } });
  762. });
  763. $(document).ready(function () {
  764. $('.secondary.menu .item').tab();
  765. });
  766. let userName
  767. let repoPath
  768. let jobID
  769. let downlaodFlag = {{ $.canDownload }}
  770. $(document).ready(function () {
  771. let url = window.location.href;
  772. let urlArr = url.split('/')
  773. userName = urlArr.slice(-5)[0]
  774. repoPath = urlArr.slice(-4)[0]
  775. jobID = urlArr.slice(-1)[0]
  776. })
  777. function stopBubbling(e) {
  778. e = window.event || e;
  779. if (e.stopPropagation) {
  780. e.stopPropagation(); //阻止事件 冒泡传播
  781. } else {
  782. e.cancelBubble = true; //ie兼容
  783. }
  784. }
  785. function renderSize(value) {
  786. if (null == value || value == '') {
  787. return "0 Bytes";
  788. }
  789. var unitArr = new Array("Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
  790. var index = 0;
  791. var srcsize = parseFloat(value);
  792. index = Math.floor(Math.log(srcsize) / Math.log(1024));
  793. var size = srcsize / Math.pow(1024, index);
  794. size = size.toFixed(0);//保留的小数位数
  795. return size + unitArr[index];
  796. }
  797. </script>