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.

showinfo.tmpl 16 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
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
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. {{template "base/head" .}}
  2. <div class="repository">
  3. {{template "repo/header" .}}
  4. <style>
  5. .model_header_text{
  6. font-size: 14px;
  7. color: #101010;
  8. font-weight: bold;
  9. }
  10. .ti_form{
  11. text-align: left;
  12. max-width: 100%;
  13. vertical-align: middle;
  14. }
  15. .ti-text-form-label {
  16. padding-bottom: 20px;
  17. padding-right: 20px;
  18. color: #8a8e99;
  19. font-size: 14px;
  20. white-space: nowrap !important;
  21. width: 80px;
  22. line-height: 30px;
  23. }
  24. .ti-text-form-content {
  25. line-height: 30px;
  26. padding-bottom: 20px;
  27. width: 100%;
  28. }
  29. .change-version{
  30. min-width: auto !important;
  31. border: 1px solid rgba(187, 187, 187, 100) !important;
  32. border-radius: .38571429rem !important;
  33. margin-left: 1.5em;
  34. }
  35. .title-word-elipsis{
  36. overflow: hidden;
  37. text-overflow: ellipsis;
  38. white-space: nowrap;
  39. width: 30%;
  40. }
  41. .word-elipsis{
  42. overflow: hidden;
  43. text-overflow: ellipsis;
  44. white-space: nowrap;
  45. padding-right: 80px;
  46. }
  47. .half-table{
  48. width: 50%;
  49. float: left;
  50. }
  51. .text-width80 {
  52. width: 100px;
  53. line-height: 30px;
  54. }
  55. .tableStyle{
  56. width:100%;
  57. table-layout: fixed;
  58. }
  59. .iword-elipsis{
  60. display: inline-block;
  61. width: 80%;
  62. overflow: hidden;
  63. text-overflow: ellipsis;
  64. white-space: nowrap;
  65. }
  66. </style>
  67. <div class="ui container">
  68. <h4 class="ui header" id="vertical-segment">
  69. <!-- <a href="javascript:window.history.back();"><i class="arrow left icon"></i>返回</a> -->
  70. <div class="ui breadcrumb">
  71. <a class="section" href="{{$.RepoLink}}/modelmanage/show_model">
  72. {{$.i18n.Tr "repo.model.manage.model_manage"}}
  73. </a>
  74. <div class="divider"> / </div>
  75. <div class="active section">{{.name}}</div>
  76. </div>
  77. <select class="ui dropdown tiny change-version" id="dropdown" onchange="changeInfo(this.value)">
  78. </select>
  79. </h4>
  80. <div id="showInfo" style="border:1px solid #e2e2e2;padding: 20px 60px;margin-top:24px">
  81. <div class="half-table">
  82. <span class="model_header_text">基本信息</span>
  83. <table class="tableStyle" style="margin-top:20px;">
  84. <tbody>
  85. <tr>
  86. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.model.manage.model_name"}}</td>
  87. <td class="ti-text-form-content word-elipsis"><span id="ModelName" title=""></span></td>
  88. </tr>
  89. <tr>
  90. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.model.manage.version"}}</td>
  91. <td class="ti-text-form-content word-elipsis"><span id="Version" title=""></span></td>
  92. </tr>
  93. <tr>
  94. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.migrate_items_labels"}}</td>
  95. <td class="ti-text-form-content">
  96. <div id="Label" style="overflow: hidden;width: 95%;">
  97. </div>
  98. </td>
  99. </tr>
  100. <tr>
  101. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.model_size"}}</td>
  102. <td class="ti-text-form-content word-elipsis"><span id="Size" title=""></span></td>
  103. </tr>
  104. <tr>
  105. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.createtime"}}</td>
  106. <td class="ti-text-form-content word-elipsis"><span id="CreateTime" title=""></span></td>
  107. </tr>
  108. <tr>
  109. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.model.manage.description"}}</td>
  110. <td class="ti-text-form-content" >
  111. <div id="edit-td" style="display:flex">
  112. <span id="Description" title="" class="iword-elipsis"></span>
  113. <i id="edit-pencil" data-id="" data-desc="" class="pencil alternate icon" style="cursor:pointer;vertical-align: top;" id="editor" onclick="editorFn(this)"></i>
  114. </div>
  115. </td>
  116. </tr>
  117. <tr>
  118. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.code_version"}}</td>
  119. <td class="ti-text-form-content word-elipsis"><span id="CodeBranch" title=""></span></td>
  120. </tr>
  121. <tr>
  122. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.start_file"}}</td>
  123. <td class="ti-text-form-content word-elipsis"><span id="BootFile" title=""></span></td>
  124. </tr>
  125. <tr>
  126. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.train_dataset"}}</td>
  127. <td class="ti-text-form-content word-elipsis"><span id="DatasetName" title=""></span></td>
  128. </tr>
  129. <tr>
  130. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.run_parameter"}}</td>
  131. <td class="ti-text-form-content word-elipsis"><span id="Parameters" title=""></span></td>
  132. </tr>
  133. <tr>
  134. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.AI_driver"}}</td>
  135. <td class="ti-text-form-content word-elipsis"><span id="EngineName" title=""></span></td>
  136. </tr>
  137. <tr>
  138. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.standard"}}</td>
  139. <td class="ti-text-form-content word-elipsis"><span id="FlavorName" title=""></span></td>
  140. </tr>
  141. <tr>
  142. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.modelarts.train_job.compute_node"}}</td>
  143. <td class="ti-text-form-content word-elipsis"><span id="WorkServerNumber" title=""></span></td>
  144. </tr>
  145. </tbody>
  146. </table>
  147. </div>
  148. <div class="half-table">
  149. <span class="model_header_text">{{$.i18n.Tr "repo.model.manage.model_accuracy"}}</span>
  150. <table class="tableStyle" style="margin-top:20px;">
  151. <tbody>
  152. <tr>
  153. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.model.manage.Accuracy"}}</td>
  154. <td class="ti-text-form-content word-elipsis"><span id="Accuracy" title=""></span></td>
  155. </tr>
  156. <tr>
  157. <td class="ti-text-form-label text-width80">F1</td>
  158. <td class="ti-text-form-content word-elipsis"><span id="F1" title=""></span></td>
  159. </tr>
  160. <tr>
  161. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.model.manage.Precision"}}</td>
  162. <td class="ti-text-form-content word-elipsis"><span id="Precision" title=""></span></td>
  163. </tr>
  164. <tr>
  165. <td class="ti-text-form-label text-width80">{{$.i18n.Tr "repo.model.manage.Recall"}}</td>
  166. <td class="ti-text-form-content word-elipsis"><span id="Recall" title=""></span></td>
  167. </tr>
  168. </tbody>
  169. </table>
  170. </div>
  171. <div style="clear: both;"></div>
  172. </div>
  173. </div>
  174. </div>
  175. {{template "base/footer" .}}
  176. <script>
  177. let url = location.href.split('show_model')[0]
  178. let ID = location.search.split('?name=').pop()
  179. $(document).ready(loadInfo);
  180. function changeInfo(version){
  181. $.get(`${url}show_model_info_api?name=${ID}`,(data)=>{
  182. let versionData = data.filter((item)=>{
  183. return item.Version === version
  184. })
  185. let returnArray = []
  186. returnArray = transObj(versionData)
  187. let [initObj,initModelAcc,id] = returnArray
  188. editorCancel('','')
  189. renderInfo(initObj,initModelAcc,id)
  190. })
  191. }
  192. function loadInfo(){
  193. $.get(`${url}show_model_info_api?name=${ID}`,(data)=>{
  194. let html = ''
  195. for (let i=0;i<data.length;i++){
  196. if(!data[i].IsCanOper){
  197. $("#edit-pencil").css("display","none")
  198. }
  199. html += `<option value="${data[i].Version}">${data[i].Version}</option>`
  200. }
  201. $('#dropdown').append(html)
  202. let returnArray = []
  203. returnArray = transObj(data)
  204. let [initObj,initModelAcc,id] = returnArray
  205. renderInfo(initObj,initModelAcc,id)
  206. })
  207. }
  208. function transObj(data){
  209. let {ID,Name,Version,Label,Size,Description,CreatedUnix,Accuracy,CodeBranch,CodeCommitID,TrainTaskInfo} = data[0]
  210. let modelAcc = JSON.parse(Accuracy)
  211. TrainTaskInfo = JSON.parse(TrainTaskInfo)
  212. // Parameters = JSON.parse(Parameters)
  213. let {Parameters,EngineName} = TrainTaskInfo
  214. Parameters = JSON.parse(Parameters)
  215. Parameters = Parameters.parameter.length === 0 ? '--':Parameters.parameter
  216. let size = tranSize(Size)
  217. let time = transTime(CreatedUnix)
  218. let initObj = {
  219. ModelName:Name || '--',
  220. Version:Version,
  221. Label:Label || '--',
  222. Size:size,
  223. CreateTime:time,
  224. Description:Description || '--',
  225. CodeBranch:CodeBranch || '--',
  226. CodeCommitID:CodeCommitID || '--',
  227. BootFile:TrainTaskInfo.BootFile || '--',
  228. DatasetName:TrainTaskInfo.DatasetName || '--',
  229. Parameters:TrainTaskInfo.Parameters || '--',
  230. FlavorName:TrainTaskInfo.FlavorName || '--',
  231. WorkServerNumber:TrainTaskInfo.WorkServerNumber || '--',
  232. Parameters:Parameters,
  233. EngineName:EngineName,
  234. }
  235. let initModelAcc = {
  236. Accuracy: modelAcc.Accuracy || '--',
  237. F1: modelAcc.F1 || '--',
  238. Precision:modelAcc.Precision || '--',
  239. Recall: modelAcc.Recall || '--'
  240. }
  241. return [initObj,initModelAcc,ID]
  242. }
  243. function transTime(time){
  244. let date = new Date(time * 1000);//时间戳为10位需*1000,时间戳为13位的话不需乘1000
  245. let Y = date.getFullYear() + '-';
  246. let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1):date.getMonth()+1) + '-';
  247. let D = (date.getDate()< 10 ? '0'+date.getDate():date.getDate())+ ' ';
  248. let h = (date.getHours() < 10 ? '0'+date.getHours():date.getHours())+ ':';
  249. let m = (date.getMinutes() < 10 ? '0'+date.getMinutes():date.getMinutes()) + ':';
  250. let s = date.getSeconds() < 10 ? '0'+date.getSeconds():date.getSeconds();
  251. return Y+M+D+h+m+s;
  252. }
  253. function tranSize(value){
  254. if(null==value||value==''){
  255. return "0 Bytes";
  256. }
  257. var unitArr = new Array("Bytes","KB","MB","GB","TB","PB","EB","ZB","YB");
  258. var index=0;
  259. var srcsize = parseFloat(value);
  260. index=Math.floor(Math.log(srcsize)/Math.log(1024));
  261. var size =srcsize/Math.pow(1024,index);
  262. size=size.toFixed(2);//保留的小数位数
  263. return size+unitArr[index];
  264. }
  265. function editorFn(context){
  266. let id= context.dataset.id
  267. let text = context.dataset.desc
  268. let textValue = text.replace(/enter;/g,'\r\n')
  269. $('#edit-td').replaceWith(`<div id='edit-div' style='width:80%;display: inline-block;'><textarea id='textarea-value' value='' rows='3' maxlength='255' style='width:80%;white-space: nowrap;' id='edit-text'>${textValue}</textarea><i class='check icon' style='color: #50d4ab;' onclick='editorSure("${text}","${id}")'></i><i class='times icon' style='color: #f66f6a;' onclick='editorCancel("${text}","${id}")'></i></div>`);
  270. }
  271. function editorCancel(text,id){
  272. let objkey = text.replace(/enter;/g,'\r\n')
  273. $('#edit-div').replaceWith(`<div id="edit-td" style="display:flex;"><span id="Description" title="${objkey}" class="iword-elipsis">${objkey}</span><i id="edit-pencil" data-id="${id}" data-desc="${text}" class="pencil alternate icon" style="cursor:pointer;vertical-align: top;" id="editor" onclick="editorFn(this)"></div>`)
  274. }
  275. function editorSure(text,id){
  276. let description=$('#textarea-value').val()
  277. let sourcetext = $('#textarea-value').val().replace(/\n/g,'enter;')
  278. let data = {
  279. ID:id,
  280. Description:description
  281. }
  282. $.ajax({
  283. url:`${url}modify_model`,
  284. type:'PUT',
  285. data:data
  286. }).done((res)=>{
  287. $('#edit-div').replaceWith(`<div id="edit-td" style="display:flex;"><span id="Description" title="${description}" class="iword-elipsis">${description}</span><i id="edit-pencil" data-id="${id}" data-desc="${sourcetext}" class="pencil alternate icon" style="cursor:pointer;vertical-align: top;" id="editor" onclick="editorFn(this)"></div>`)
  288. })
  289. }
  290. function renderInfo(obj,accObj,id){
  291. for(let key in obj){
  292. if(key==="Description"){
  293. let descriptionText=obj[key].replace(/\r\n|\n/g,'enter;')
  294. $(`#${key}`).text(obj[key])
  295. $(`#${key}`).attr("title",obj[key])
  296. $('#edit-pencil').attr("data-id",id)
  297. $('#edit-pencil').attr("data-desc",descriptionText)
  298. }
  299. else if(key==="Label"){
  300. $('#Label').empty()
  301. if(obj[key]==='--'){
  302. $('#Label').text(obj[key])
  303. }else{
  304. let labelArray = obj[key].trim().replace(/ +/g,' ').split(' ')
  305. let html=''
  306. for(let i=0;i<labelArray.length;i++){
  307. html += `<a class="ui label" title="${labelArray[i]}">${labelArray[i]}</a>`
  308. }
  309. $('#Label').append(html)
  310. }
  311. }
  312. else if(key==="CodeCommitID"){
  313. let codeCommit = obj[key].slice(0,10)
  314. let html = `<a style="margin-left:1rem" class="ui label" title="${codeCommit}">${codeCommit}</a>`
  315. $('#CodeBranch').append(html)
  316. }
  317. else if(key==="Parameters"){
  318. if(obj[key]==='--'){
  319. $(`#${key}`).text(obj[key])
  320. }else{
  321. const parameterArray = obj[key].map(element => {
  322. let labelValue = `${element.label}=${element.value}`
  323. return labelValue
  324. });
  325. const parameter = parameterArray.join('; ')
  326. $(`#${key}`).text(parameter)
  327. $(`#${key}`).attr("title",parameter)
  328. }
  329. }
  330. else{
  331. $(`#${key}`).text(obj[key])
  332. $(`#${key}`).attr("title",obj[key])
  333. }
  334. }
  335. for(let key in accObj){
  336. $(`#${key}`).text(accObj[key])
  337. $(`#${key}`).attr("title",accObj[key])
  338. }
  339. }
  340. </script>