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

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
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
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
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908
  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 class="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 spec">
  316. <div class="text-span text-span-w"></div>
  317. </td>
  318. </tr>
  319. <tr class="ti-no-ng-animate">
  320. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  321. {{$.i18n.Tr "repo.modelarts.train_job.compute_node"}}
  322. </td>
  323. <td class="ti-text-form-content">
  324. <div class="text-span text-span-w">
  325. {{.WorkServerNumber}}
  326. </div>
  327. </td>
  328. </tr>
  329. </tbody>
  330. </table>
  331. </div>
  332. <div class="ac-grid-col">
  333. <table class="ti-form">
  334. <tbody class="ti-text-form">
  335. <tr class="ti-no-ng-animate">
  336. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  337. {{$.i18n.Tr "repo.modelarts.train_job.AI_driver"}}
  338. </td>
  339. <td class="ti-text-form-content">
  340. <div class="text-span text-span-w">
  341. {{.EngineName}}
  342. </div>
  343. </td>
  344. </tr>
  345. <tr class="ti-no-ng-animate">
  346. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  347. {{$.i18n.Tr "repo.modelarts.code_version"}}
  348. </td>
  349. <td class="ti-text-form-content">
  350. <div class="text-span text-span-w">
  351. {{.BranchName}}
  352. </div>
  353. </td>
  354. </tr>
  355. <tr class="ti-no-ng-animate">
  356. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  357. {{$.i18n.Tr "repo.modelarts.train_job.start_file"}}
  358. </td>
  359. <td class="ti-text-form-content">
  360. <div class="text-span text-span-w">
  361. {{.BootFile}}
  362. </div>
  363. </td>
  364. </tr>
  365. <tr class="ti-no-ng-animate">
  366. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  367. {{$.i18n.Tr "repo.modelarts.train_job.train_dataset"}}
  368. </td>
  369. <td class="ti-text-form-content">
  370. <div class="text-span text-span-w">
  371. {{range $m ,$n := $.datasetDownload}}
  372. {{if eq .IsDelete true}}
  373. {{.DatasetName}}({{$.i18n.Tr "dataset.file_deleted"}})
  374. {{else}}
  375. <a href="{{.RepositoryLink}}" target="_blank">{{.DatasetName}}</a>
  376. {{end}}
  377. {{end}}
  378. </div>
  379. </td>
  380. </tr>
  381. <tr class="ti-no-ng-animate">
  382. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  383. {{$.i18n.Tr "repo.modelarts.train_job.run_parameter"}}
  384. </td>
  385. <td class="ti-text-form-content">
  386. <div class="text-span text-span-w" title="{{.Parameters}}">
  387. {{.Parameters}}
  388. </div>
  389. </td>
  390. </tr>
  391. <tr class="ti-no-ng-animate">
  392. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  393. {{$.i18n.Tr "repo.grampus.train_job.ai_center"}}
  394. </td>
  395. <td class="ti-text-form-content">
  396. <div class="text-span text-span-w" id="{{.VersionName}}-ai_center">
  397. {{$.ai_center}}
  398. </div>
  399. </td>
  400. </tr>
  401. </tr>
  402. <tr class="ti-no-ng-animate">
  403. <td class="ti-no-ng-animate ti-text-form-label text-width80">
  404. {{$.i18n.Tr "repo.modelarts.train_job.description"}}
  405. </td>
  406. <td class="ti-text-form-content">
  407. <div class="text-span text-span-w"
  408. title="{{.Description}}">
  409. {{.Description}}
  410. </div>
  411. </td>
  412. </tr>
  413. </tbody>
  414. </table>
  415. </div>
  416. </div>
  417. </div>
  418. </div>
  419. </div>
  420. <div class="ui tab" data-tab="second{{$k}}">
  421. <div style="position: relative;">
  422. <span>
  423. <a title="{{$.i18n.Tr "repo.log_scroll_start"}}" style="position: absolute; right: -32px;cursor: pointer;"
  424. class="log_top" data-version="{{.VersionName}}"><i class="icon-to-top"></i></a>
  425. </span>
  426. <span class="log-info-{{.VersionName}}">
  427. <a title="{{$.i18n.Tr "repo.log_scroll_end"}}" style="position: absolute; bottom: 10px;right: -32px;cursor: pointer;"
  428. class="log_bottom" data-version="{{.VersionName}}"><i
  429. class="icon-to-bottom"></i></a>
  430. </span>
  431. <div class="ui message message{{.VersionName}}" style="display: none;">
  432. <div id="header"></div>
  433. </div>
  434. <div class="ui attached log" id="log{{.VersionName}}"
  435. style="height: 300px !important; overflow: auto;">
  436. <div class="ui inverted active dimmer">
  437. <div class="ui loader"></div>
  438. </div>
  439. <input type="hidden" name="end_line" value>
  440. <input type="hidden" name="start_line" value>
  441. <pre id="log_file{{.VersionName}}"></pre>
  442. </div>
  443. </div>
  444. </div>
  445. <div class="ui tab" data-tab="third{{$k}}">
  446. <input type="hidden" name="model{{.VersionName}}" value="-1">
  447. <input type="hidden" name="modelback{{.VersionName}}" value="-1">
  448. <div class='ui breadcrumb model_file_bread' id='file_breadcrumb{{.VersionName}}'>
  449. <div class="active section">{{.VersionName}}</div>
  450. <div class="divider"> / </div>
  451. </div>
  452. <div id="dir_list{{.VersionName}}">
  453. </div>
  454. {{if eq .ComputeResource "CPU/GPU"}}
  455. <div style="display:flex;align-items: center;justify-content: end;color: #f2711c;">
  456. <i class="ri-error-warning-line" style="margin-right:0.5rem;"></i>
  457. <span>{{$.i18n.Tr "repo.file_limit_100"}}</span>
  458. </div>
  459. {{end}}
  460. </div>
  461. </div>
  462. </div>
  463. </div>
  464. {{end}} {{template "base/paginate" .}}
  465. </div>
  466. <!-- 确认模态框 -->
  467. <div id="deletemodel">
  468. <div class="ui basic modal">
  469. <div class="ui icon header">
  470. <i class="trash icon"></i> {{.i18n.Tr "cloudbrain.delete_task"}}
  471. </div>
  472. <div class="content">
  473. <p>{{.i18n.Tr "cloudbrain.task_delete_confirm"}}</p>
  474. </div>
  475. <div class="actions">
  476. <div class="ui red basic inverted cancel button">
  477. <i class="remove icon"></i> {{.i18n.Tr "cloudbrain.operate_cancel"}}
  478. </div>
  479. <div class="ui green basic inverted ok button">
  480. <i class="checkmark icon"></i> {{.i18n.Tr "cloudbrain.operate_confirm"}}
  481. </div>
  482. </div>
  483. </div>
  484. </div>
  485. <!-- 创建模型 -->
  486. <div id="newmodel">
  487. <div class="ui modal second">
  488. <div class="header" style="padding: 1rem;background-color: rgba(240, 240, 240, 100);">
  489. <h4 id="model_header">{{.i18n.Tr "repo.model.manage.import_new_model"}}</h4>
  490. </div>
  491. <div class="content content-padding">
  492. <form id="formId" method="POST" class="ui form">
  493. <div class="ui error message">
  494. </div>
  495. {{$.CsrfTokenHtml}}
  496. <input type="hidden" name="trainTaskCreate" value="true">
  497. <div class="required inline field">
  498. <label>{{.i18n.Tr "repo.modelarts.train_job"}}</label>
  499. <input type="hidden" class="width83" id="JobId" name="JobId" readonly required>
  500. <input type="hidden" id="VersionName" name="VersionName" value="V0001">
  501. <input style="width: 45%;" id="JobName" readonly required>
  502. </div>
  503. <div class="required inline field" id="modelname">
  504. <label>{{.i18n.Tr "repo.model.manage.model_name"}}</label>
  505. <input style="width: 45%;" id="name" name="Name" required maxlength="25"
  506. onkeyup="this.value=this.value.replace(/[, ]/g,'')">
  507. </div>
  508. <div class="required inline field" id="verionname">
  509. <label>{{.i18n.Tr "repo.modelconvert.modelversion"}}</label>
  510. <input style="width: 45%;" id="version" name="Version" value="" readonly required maxlength="255">
  511. </div>
  512. <div class="unite min_title inline field required">
  513. <label>{{.i18n.Tr "repo.model.manage.engine"}}</label>
  514. <div class="ui dropdown selection search width70" id="choice_Engine">
  515. <input type="hidden" id="Engine" name="Engine" required>
  516. <div class="default text">{{.i18n.Tr "repo.model.manage.select.engine"}}</div>
  517. <i class="dropdown icon"></i>
  518. <div class="menu" id="job-Engine">
  519. <option class="active item" data-value="0">PyTorch</option>
  520. <option class="item" data-value="1">TensorFlow</option>
  521. <option class="item" data-value="2">MindSpore</option>
  522. <option class="item" data-value="4">PaddlePaddle</option>
  523. <option class="item" data-value="5">OneFlow</option>
  524. <option class="item" data-value="6">MXNet</option>
  525. <option class="item" data-value="3">Other</option>
  526. </div>
  527. </div>
  528. </div>
  529. <div class="unite min_title inline fields required">
  530. <div class="field required">
  531. <label for="modelSelectedFile">{{.i18n.Tr "repo.model.manage.modelfile"}}</label>
  532. </div>
  533. <div class="thirteen wide field" style="position:relative">
  534. <input id="modelSelectedFile" type="text" readonly required onclick="showMenu();" name="modelSelectedFile" >
  535. <div id="menuContent" class="menuContent" style="display:none;">
  536. <ul id="treeDemo" class="ztree"></ul>
  537. </div>
  538. </div>
  539. </div>
  540. <div class="inline field">
  541. <label>{{.i18n.Tr "repo.model.manage.modellabel"}}</label>
  542. <input style="width: 83%;margin-left: 7px;" id="label" name="Label" maxlength="255"
  543. placeholder='{{.i18n.Tr "repo.modelarts.train_job.label_place"}}'>
  544. </div>
  545. <div class="inline field">
  546. <label for="description">{{.i18n.Tr "repo.model.manage.modeldesc"}}</label>
  547. <textarea style="width: 83%;margin-left: 7px;" id="Description" name="Description" rows="3"
  548. maxlength="255" placeholder='{{.i18n.Tr "repo.modelarts.train_job.new_place"}}'
  549. onchange="this.value=this.value.substring(0, 255)"
  550. onkeydown="this.value=this.value.substring(0, 255)"
  551. onkeyup="this.value=this.value.substring(0, 256)"></textarea>
  552. </div>
  553. <div class="inline field" style="margin-left: 75px;">
  554. <button onclick="createModel()" type="button" class="ui create_train_job green button"
  555. style="position: absolute;">
  556. {{.i18n.Tr "repo.model.manage.sava_model"}}
  557. </button>
  558. </div>
  559. </form>
  560. <div class="actions" style="display: inline-block;margin-left: 180px;">
  561. <button class="ui button cancel">{{.i18n.Tr "repo.cloudbrain.cancel"}}</button>
  562. </div>
  563. </div>
  564. </div>
  565. </div>
  566. </div>
  567. {{template "base/footer" .}}
  568. <script type="text/javascript" src="/self/ztree/js/jquery.ztree.core.js"></script>
  569. <script type="text/javascript" src="/self/ztree/js/jquery.ztree.excheck.js"></script>
  570. <script src="{{StaticUrlPrefix}}/js/specsuse.js?v={{MD5 AppVer}}" type="text/javascript"></script>
  571. <script>
  572. ;(function() {
  573. var SPEC = {{ .Spec }};
  574. var showPoint = false;
  575. var specStr = window.renderSpecStr(SPEC, showPoint, {
  576. gpu_memory: {{$.i18n.Tr "cloudbrain.gpu_memory"}},
  577. free: {{$.i18n.Tr "cloudbrain.free"}},
  578. point_hr: {{$.i18n.Tr "cloudbrain.point_hr"}},
  579. memory: {{$.i18n.Tr "cloudbrain.memory"}},
  580. shared_memory: {{$.i18n.Tr "cloudbrain.shared_memory"}},
  581. });
  582. $('td.ti-text-form-content.spec').text(specStr);
  583. })();
  584. var setting = {
  585. check: {
  586. enable: true,
  587. chkboxType: {"Y":"ps", "N":"ps"}
  588. },
  589. view: {
  590. dblClickExpand: false
  591. },
  592. callback: {
  593. beforeClick: beforeClick,
  594. onCheck: onCheck
  595. }
  596. };
  597. function beforeClick(treeId, treeNode) {
  598. var zTree = $.fn.zTree.getZTreeObj("treeDemo");
  599. zTree.checkNode(treeNode, !treeNode.checked, null, true);
  600. return false;
  601. }
  602. function onCheck(e, treeId, treeNode) {
  603. var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
  604. nodes = zTree.getCheckedNodes(true),
  605. v = "";
  606. for (var i=0, l=nodes.length; i<l; i++) {
  607. if(nodes[i].isParent){
  608. continue;
  609. }
  610. var pathNodes = nodes[i].getPath();
  611. var path ="";
  612. for(var j=0;j<pathNodes.length;j++){
  613. if(j ==0){
  614. path += pathNodes[j].name;
  615. }else{
  616. path += "/" + pathNodes[j].name;
  617. }
  618. }
  619. v += path + ";";
  620. }
  621. if (v.length > 0 ) v = v.substring(0, v.length-1);
  622. var cityObj = $("#modelSelectedFile");
  623. cityObj.attr("value", v);
  624. }
  625. function showMenu() {
  626. var cityObj = $("#modelSelectedFile");
  627. var cityOffset = $("#modelSelectedFile").offset();
  628. //$("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");
  629. $("#menuContent").slideDown("fast");
  630. $("body").bind("mousedown", onBodyDown);
  631. }
  632. function hideMenu() {
  633. $("#menuContent").fadeOut("fast");
  634. $("body").unbind("mousedown", onBodyDown);
  635. }
  636. function onBodyDown(event) {
  637. if (!(event.target.id == "menuBtn" || event.target.id == "modelSelectedFile" || event.target.id == "menuContent" || $(event.target).parents("#menuContent").length>0)) {
  638. hideMenu();
  639. }
  640. }
  641. let dirKey="isOnlyDir--:&";
  642. function loadSelectedModelFile(trainJob){
  643. console.log("trainJob=" + trainJob);
  644. $('#choice_file').dropdown('clear')
  645. $("#model-file").empty()
  646. if(trainJob ==null || trainJob ==""){
  647. console.log("trainJob is null");
  648. }else{
  649. let type = trainJob.Type;
  650. if(type == 2){
  651. if(trainJob.ComputeResource=="NPU"){
  652. type=1;
  653. }else{
  654. type=0;
  655. }
  656. }
  657. $.get(`/${userName}/${repoPath}/modelmanage/query_train_model?jobName=${trainJob.JobName}&type=${type}&VersionName=${trainJob.VersionName}`, (data) => {
  658. const n_length = data.length
  659. let file_html=''
  660. let firstFileName =''
  661. var zNodes=[];
  662. var nodesMap={};
  663. for (let i=0;i<n_length;i++){
  664. var parentNodeMap = nodesMap;
  665. var fileSplits = data[i].FileName.split("/");
  666. for(let j=0;j < fileSplits.length;j++){
  667. if(fileSplits[j] == ""){
  668. break;
  669. }
  670. if(parentNodeMap[fileSplits[j]] == null){
  671. parentNodeMap[fileSplits[j]] = {};
  672. }
  673. parentNodeMap = parentNodeMap[fileSplits[j]];
  674. }
  675. }
  676. for (let i=0;i<n_length;i++){
  677. var parentNodeMap = nodesMap;
  678. var fileSplits = data[i].FileName.split("/");
  679. for(let j=0;j < fileSplits.length;j++){
  680. if(fileSplits[j] == ""){
  681. if(data[i].FileName[data[i].FileName.length -1] =="/"){
  682. if(Object.keys(parentNodeMap).length ==0){
  683. parentNodeMap[dirKey]="true";
  684. }
  685. }
  686. break;
  687. }
  688. parentNodeMap = parentNodeMap[fileSplits[j]];
  689. }
  690. }
  691. convertToNode(zNodes,nodesMap);
  692. $.fn.zTree.init($("#treeDemo"), setting, zNodes);
  693. })
  694. }
  695. }
  696. function convertToNode(nodeList,nodesMap){
  697. var keyList = Object.keys(nodesMap);
  698. keyList.sort(function(a,b){
  699. return a-b;
  700. });
  701. var isFirst = true;
  702. for(var i=0; i<keyList.length;i++){
  703. var node = {};
  704. node["name"] = keyList[i];
  705. nodeList.push(node);
  706. if(nodesMap[keyList[i]] != null && Object.keys(nodesMap[keyList[i]]).length >0){
  707. if(nodesMap[keyList[i]][dirKey] != null){
  708. node["open"] = false;
  709. node["isParent"] = true;
  710. }else{
  711. node["children"]=[];
  712. if(isFirst){
  713. node["open"] = true;
  714. isFirst= false;
  715. }
  716. convertToNode(node["children"],nodesMap[keyList[i]]);
  717. }
  718. }
  719. }
  720. }
  721. function showcreate(obj) {
  722. $('.ui.modal.second')
  723. .modal({
  724. centered: false,
  725. onShow: function () {
  726. $('input[name="Version"]').addClass('model_disabled')
  727. // $('input[name="JobId"]').text(obj.JobName)
  728. $('#JobName').val(obj.DisplayJobName).addClass('model_disabled')
  729. $('input[name="JobId"]').val(obj.JobID)
  730. $('input[name="VersionName"]').val("V0001")
  731. if(obj.ComputeResource=="NPU"){
  732. if (obj.EngineName != null && obj.EngineName != "") {
  733. srcEngine = obj.EngineName.split('-')[0]
  734. srcEngine = srcEngine.trim().toLowerCase();
  735. if (srcEngine == 'tensorflow') {
  736. $('#choice_Engine .default.text').text("TensorFlow");
  737. $('#choice_Engine input[name="Engine"]').val(1)
  738. }
  739. if (srcEngine == 'mindspore') {
  740. $('#choice_Engine .default.text').text("MindSpore");
  741. $('#choice_Engine input[name="Engine"]').val(2)
  742. }
  743. }
  744. }else{
  745. $('#choice_Engine .default.text').text("PyTorch");
  746. $('#choice_Engine input[name="Engine"]').val(0)
  747. }
  748. $('#choice_Engine .default.text').css({ "color": "rgb(0, 0, 0,0.87)" })
  749. $('.ui.dimmer').css({ "background-color": "rgb(136, 136, 136,0.7)" })
  750. createModelName();
  751. loadSelectedModelFile(obj);
  752. },
  753. onHide: function () {
  754. var cityObj = $("#modelSelectedFile");
  755. cityObj.attr("value", "");
  756. document.getElementById("formId").reset();
  757. $('.ui.dimmer').css({ "background-color": "" })
  758. $('.ui.error.message').text()
  759. $('.ui.error.message').css('display', 'none')
  760. }
  761. })
  762. .modal('show')
  763. }
  764. function createModel() {
  765. let url_href = `/${userName}/${repoPath}/modelmanage/create_new_model`
  766. let data = $("#formId").serialize()
  767. $("#mask").css({ "display": "block", "z-index": "9999" })
  768. $.ajax({
  769. url: url_href,
  770. type: 'POST',
  771. data: data,
  772. success: function (res) {
  773. $('input[name="Engine_name"]').val("");
  774. $('input[name="Engine"]').val("");
  775. location.href = `/${userName}/${repoPath}/modelmanage/show_model`
  776. $('.ui.modal.second').modal('hide')
  777. },
  778. error: function (xhr) {
  779. // 隐藏 loading
  780. // 只有请求不正常(状态码不为200)才会执行
  781. $('.ui.error.message').text(xhr.responseText)
  782. $('.ui.error.message').css('display', 'block')
  783. },
  784. complete: function (xhr) {
  785. $("#mask").css({ "display": "none", "z-index": "1" })
  786. }
  787. })
  788. }
  789. function createModelName() {
  790. let repoName = location.pathname.split('/')[2]
  791. let modelName = repoName + '_model_' + Math.random().toString(36).substr(2, 4)
  792. $('#name').val(modelName)
  793. $('#version').val("0.0.1")
  794. }
  795. $('.menu .item').tab()
  796. $(document).ready(function () {
  797. $('.ui.accordion').accordion({ selector: { trigger: '.icon' } });
  798. });
  799. $(document).ready(function () {
  800. $('.secondary.menu .item').tab();
  801. });
  802. let userName
  803. let repoPath
  804. let jobID
  805. let downlaodFlag = {{ $.canDownload }}
  806. $(document).ready(function () {
  807. let url = window.location.href;
  808. let urlArr = url.split('/')
  809. userName = urlArr.slice(-5)[0]
  810. repoPath = urlArr.slice(-4)[0]
  811. jobID = urlArr.slice(-1)[0]
  812. })
  813. function stopBubbling(e) {
  814. e = window.event || e;
  815. if (e.stopPropagation) {
  816. e.stopPropagation(); //阻止事件 冒泡传播
  817. } else {
  818. e.cancelBubble = true; //ie兼容
  819. }
  820. }
  821. function renderSize(value) {
  822. if (null == value || value == '') {
  823. return "0 Bytes";
  824. }
  825. var unitArr = new Array("Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB");
  826. var index = 0;
  827. var srcsize = parseFloat(value);
  828. index = Math.floor(Math.log(srcsize) / Math.log(1024));
  829. var size = srcsize / Math.pow(1024, index);
  830. size = size.toFixed(0);//保留的小数位数
  831. return size + unitArr[index];
  832. }
  833. </script>