diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/package-lock.json b/plugins/tensorboard-plugins/tb_graph_ascend/fe/package-lock.json index 00185f250091f7a5d19fc126fb1441716015e6fd..79dcfed452d4fc0d50e094760b37ce091c9cc030 100644 --- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/package-lock.json +++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/package-lock.json @@ -42,6 +42,8 @@ "d3": "^7.9.0", "dagre": "^0.8.5", "form-data": "^4.0.4", + "i18next": "^23.16.8", + "i18next-browser-languagedetector": "^7.2.2", "lodash": "^4.17.21", "prettier": "^3.4.2", "style-loader": "^4.0.0" @@ -65,6 +67,15 @@ "webpack-dev-server": "4.15.1" } }, + "node_modules/@babel/runtime": { + "version": "7.28.2", + "resolved": "https://registry.npmmirror.com/@babel/runtime/-/runtime-7.28.2.tgz", + "integrity": "sha512-KHp2IflsnGywDjBWDkR9iEqiWSpc8GIi0lgTT3mOElT0PP1tG26P4tmFI2YvAdzgq9RGyoHZQEIEdZy6Ec5xCA==", + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.7", "resolved": "https://registry.npmmirror.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", @@ -77,7 +88,7 @@ }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.12", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz", + "resolved": "https://registry.npmmirror.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.12.tgz", "integrity": "sha512-OuLGC46TjB5BbN1dH8JULVVZY4WTdkF7tV9Ys6wLL1rubZnCMstOhNHueU5bLCrnRuDhKPDM4g6sw4Bel5Gzqg==", "license": "MIT", "dependencies": { @@ -1948,7 +1959,7 @@ }, "node_modules/brace-expansion": { "version": "1.1.12", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "resolved": "https://registry.npmmirror.com/brace-expansion/-/brace-expansion-1.1.12.tgz", "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "license": "MIT", "dependencies": { @@ -3421,7 +3432,7 @@ }, "node_modules/form-data": { "version": "4.0.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz", + "resolved": "https://registry.npmmirror.com/form-data/-/form-data-4.0.4.tgz", "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==", "license": "MIT", "dependencies": { @@ -3467,21 +3478,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "license": "ISC" }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmmirror.com/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmmirror.com/function-bind/-/function-bind-1.1.2.tgz", @@ -3985,6 +3981,38 @@ "node": ">=10.17.0" } }, + "node_modules/i18next": { + "version": "23.16.8", + "resolved": "https://registry.npmmirror.com/i18next/-/i18next-23.16.8.tgz", + "integrity": "sha512-06r/TitrM88Mg5FdUXAKL96dJMzgqLE5dv3ryBAra4KCwD9mJ4ndOTS95ZuymIGoE+2hzfdaMak2X11/es7ZWg==", + "funding": [ + { + "type": "individual", + "url": "https://locize.com" + }, + { + "type": "individual", + "url": "https://locize.com/i18next.html" + }, + { + "type": "individual", + "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" + } + ], + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.23.2" + } + }, + "node_modules/i18next-browser-languagedetector": { + "version": "7.2.2", + "resolved": "https://registry.npmmirror.com/i18next-browser-languagedetector/-/i18next-browser-languagedetector-7.2.2.tgz", + "integrity": "sha512-6b7r75uIJDWCcCflmbof+sJ94k9UQO4X0YR62oUfqGI/GjCLVzlCwu8TFdRZIqVLzWbzNcmkmhfqKEr4TLz4HQ==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.23.2" + } + }, "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmmirror.com/iconv-lite/-/iconv-lite-0.4.24.tgz", diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/package.json b/plugins/tensorboard-plugins/tb_graph_ascend/fe/package.json index 9469af8c44eacb144274ee17ca16c297da3ac43b..3185e4db9ccbed0919d9385ac721e9f4c0df2dbb 100644 --- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/package.json +++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/package.json @@ -28,6 +28,7 @@ "webpack-dev-server": "4.15.1" }, "dependencies": { + "@jridgewell/gen-mapping": "^0.3.12", "@polymer/decorators": "^3.0.0", "@polymer/iron-collapse": "^3.0.1", "@polymer/iron-icon": "^3.0.1", @@ -54,16 +55,17 @@ "@vaadin/text-field": "24.6.5", "@vaadin/tooltip": "24.6.5", "axios": "^1.8.4", + "brace-expansion": "^1.1.12", "clean-webpack-plugin": "^4.0.0", "cross-env": "^7.0.3", "css-loader": "^7.1.2", "d3": "^7.9.0", "dagre": "^0.8.5", + "form-data": "^4.0.4", + "i18next": "^23.16.8", + "i18next-browser-languagedetector": "^7.2.2", "lodash": "^4.17.21", "prettier": "^3.4.2", - "style-loader": "^4.0.0", - "form-data": "^4.0.4", - "brace-expansion": "^1.1.12", - "@jridgewell/gen-mapping": "^0.3.12" + "style-loader": "^4.0.0" } } diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/common/constant.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/common/constant.ts index d9ba426e954496bd8787ecef50c3f200a9e556fb..145aa943805e35341a4453b44b7ae6495c27fb64 100644 --- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/common/constant.ts +++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/common/constant.ts @@ -78,11 +78,3 @@ export const PREFIX_MAP = { NPU: NPU_PREFIX, Bench: BENCH_PREFIX, }; - -export const PRECISION_DESC = { - "summary": "节点中调试侧和标杆侧输出的统计量相对误差,值越大精度差距越大,颜色标记越深,相对误差指标(RelativeErr):| (调试值 - 标杆值) / 标杆值 |", - - "all": "节点中所有输入的最小双千指标和所有输出的最小双千分之一指标的差值,反映了双千指标的下降情况,值越大精度差距越大,颜色标记越深,双千分之一精度指标(One Thousandth Err Ratio):Tensor中的元素逐个与对应的标杆数据对比,相对误差小于千分之一的比例占总元素个数的比例,比例越接近1越好", - - "md5": "节点中任意输入输出的md5值不同则标记为红色" -} \ No newline at end of file diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/common/i18n.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/common/i18n.ts new file mode 100644 index 0000000000000000000000000000000000000000..1f0e5ca5a3940526b0ac32b7950fd2343487fce9 --- /dev/null +++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/common/i18n.ts @@ -0,0 +1,95 @@ +/* Copyright (c) 2025, Huawei Technologies. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import i18next from 'i18next'; +import LanguageDetector from 'i18next-browser-languagedetector'; + +i18next + .use(LanguageDetector) + .init({ + fallbackLng: 'zh-CN', + resources: { + 'en': { + translation: { + fit: "Fit Screen", + settings: "Settings", + match: 'Matching', + show_debug_minimap: "show debug minimap", + show_bench_minimap: "show bench minimap", + run: "Run", + tag: "Tag", + invalid_rank_id: "Tip: The target file does not exist", + data_side: "Data Side", + search_node: "Search Node", + node_list: "Node List", + debug: "Debug", + bench: "Bench", + accuracy_error: "Accuracy Error", + overflow: "Overflow", + match_accuracy_error: "Match Accuracy Error Node", + overflow_filter_node: "Overflow Filter Node", + no_matching_nodes: "No matching nodes", + precision_desc: { + summary: "The relative error between the statistical output of the debug side and the benchmark side of the node, the larger the value, the greater the precision gap, the darker the color mark, the relative error indicator (RelativeErr): | (debug value - benchmark value) / benchmark value |", + all: "The difference between the minimum double thousand indicator of all inputs and the minimum double thousandth indicator of all outputs of the node, reflecting the decline of the double thousand indicator, the larger the value, the greater the precision gap, the darker the color mark, the double thousandth precision indicator (One Thousandth Err Ratio): The relative error of each element in the tensor is compared with the corresponding benchmark data, the proportion of relative error less than one thousandth of the total number of elements, the closer the proportion is to 1, the better", + md5: "If the md5 value of any input or output of the node is different, it will be marked red" + }, + node_match: "Node Match", + select_match_config_file: "Select Match Config File", + select_match_config_file_desc: "Select the corresponding configuration file, read the matching node information, and match the corresponding node." + + } + }, + 'zh-CN': { + translation: { + fit: "自适应屏幕", + settings: "设置", + match: '匹配', + show_debug_minimap: "调试侧缩略图", + show_bench_minimap: "标杆侧缩略图", + run: "目录", + tag: "文件", + invalid_rank_id: "提示:目标文件不存在", + data_side: "数据侧", + search_node: "节点搜索", + node_list: "节点列表", + debug: "调试侧", + bench: "标杆侧", + accuracy_error: "精度误差", + overflow: "精度溢出", + match_accuracy_error: "符合精度误差节点", + overflow_filter_node: "溢出筛选节点", + no_matching_nodes: "无匹配节点11", + precision_desc: { + "summary": "节点中调试侧和标杆侧输出的统计量相对误差,值越大精度差距越大,颜色标记越深,相对误差指标(RelativeErr):| (调试值 - 标杆值) / 标杆值 |", + "all": "节点中所有输入的最小双千指标和所有输出的最小双千分之一指标的差值,反映了双千指标的下降情况,值越大精度差距越大,颜色标记越深,双千分之一精度指标(One Thousandth Err Ratio):Tensor中的元素逐个与对应的标杆数据对比,相对误差小于千分之一的比例占总元素个数的比例,比例越接近1越好", + "md5": "节点中任意输入输出的md5值不同则标记为红色" + }, + node_match: "节点匹配", + select_match_config_file: "选择匹配配置文件", + select_match_config_file_desc: "选择对应配置文件,会读取匹配节点信息,并将对应节点进行匹配。" + } + } + }, + detection: { + order: ['navigator'] // 只使用浏览器语言检测 + }, + debug: false, + interpolation: { + escapeValue: false + } + }); + +export default i18next; \ No newline at end of file diff --git a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_color_select/index.ts b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_color_select/index.ts index 10bedce9b586c57cc87b73b87690f42abf9d8ed0..07601d2c6dcd86cb8ce114f3dedb575d83e7be88 100644 --- a/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_color_select/index.ts +++ b/plugins/tensorboard-plugins/tb_graph_ascend/fe/src/graph_controls_board/components/tf_color_select/index.ts @@ -25,9 +25,7 @@ import { NPU_PREFIX, UNMATCHED_COLOR, defaultColorSetting, defaultColorSelects } import request from '../../../utils/request'; import { DarkModeMixin } from '../../../polymer/dark_mode_mixin'; import { LegacyElementMixin } from '../../../polymer/legacy_element_mixin'; -import { PRECISION_DESC } from '../../../common/constant'; import '../tf_filter_precision_error/index' -const UNMATCHED_NODE_NAME = '无匹配节点'; @customElement('tf-color-select') class Legend extends LegacyElementMixin(DarkModeMixin(PolymerElement)) { // 定义模板 @@ -147,7 +145,7 @@ class Legend extends LegacyElementMixin(DarkModeMixin(PolymerElement)) { cursor: pointer; position: relative; font-size: 10px; - top: -4px; + top: -2px; left: 2px; } @@ -185,7 +183,7 @@ class Legend extends LegacyElementMixin(DarkModeMixin(PolymerElement)) {