Skip to content

Commit 4913fdb

Browse files
x2paddle转换前端代码 (#1153)
* finlys * finlys2 * finlys3 Co-authored-by: chenjian <[email protected]>
1 parent c6f47c6 commit 4913fdb

39 files changed

+9926
-64
lines changed

frontend/packages/core/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@
4444
"@tippyjs/react": "4.2.5",
4545
"@visualdl/icons": "2.2.1",
4646
"@visualdl/netron": "2.2.1",
47+
"@visualdl/netron2": "2.2.1",
4748
"@visualdl/wasm": "2.2.1",
4849
"antd": "^4.21.0",
50+
"axios": "^1.1.3",
4951
"bignumber.js": "9.0.1",
5052
"classnames": "2.3.1",
5153
"d3": "7.0.1",
@@ -66,6 +68,7 @@
6668
"polished": "4.1.3",
6769
"query-string": "7.0.1",
6870
"react": "17.0.2",
71+
"react-activation": "^0.12.1",
6972
"react-content-loader": "6.0.3",
7073
"react-dnd": "14.0.3",
7174
"react-dnd-html5-backend": "14.0.1",
@@ -74,9 +77,10 @@
7477
"react-i18next": "11.11.4",
7578
"react-input-range": "1.3.0",
7679
"react-rangeslider": "2.2.0",
77-
"react-redux": "7.2.5",
80+
"react-redux": "7.2.9",
7881
"react-router-dom": "5.3.0",
7982
"react-spinners": "0.11.0",
83+
"react-stillness-component": "^0.9.0",
8084
"react-table": "7.7.0",
8185
"react-table-sticky": "1.1.3",
8286
"react-toastify": "8.0.2",

frontend/packages/core/public/locales/en/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"error": "Error occurred",
1212
"graph": "Graphs",
1313
"graphDynamic": "dynamic",
14+
"ToggleGraph": "X2Paddle",
1415
"graphStatic": "static",
1516
"high-dimensional": "High Dimensional",
1617
"profiler":"performance analysis",

frontend/packages/core/public/locales/en/graph.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@
5353
"supported-model": "Supported models: ",
5454
"Choose-model": "Choose a model",
5555
"supported-model-list": "PaddlePaddle, ONNX, Keras, Core ML, Caffe, Caffe2, Darknet, MXNet, ncnn, TensorFlow Lite",
56+
"supported-model-list-xpaddle": "ONNX、Caffe、Caffe2",
5657
"upload-model": "Upload Model",
5758
"upload-tip": "Click or Drop file here to view neural network models",
59+
"upload-tip2": "Click or drag the file to the page to upload the model for model conversion",
5860
"vertical": "Vertical",
5961
"zoom-in": "Zoom In",
6062
"zoom-out": "Zoom Out"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"transformation": "transformation",
3+
"download": "download",
4+
"convert_before": "Please convert before viewing",
5+
"warin-info": "Please package the model description file. prototxt and parameter file. caffemodel into. tar to upload",
6+
"warin-info2": "The model file does not support X2Paddle conversion temporarily",
7+
"warin-info3": "Please convert before viewing",
8+
"warin-info4": "The model has been converted, please do not click again",
9+
"warin-info5": "Please upload the model file and convert it",
10+
"warin-info6": "Model file has been converted, please do not click again",
11+
"warin-info7": "Please upload the model file"
12+
}

frontend/packages/core/public/locales/zh/common.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"error": "发生错误",
1212
"graph": "网络结构",
1313
"graphDynamic": "动态",
14+
"ToggleGraph": "X2Paddle",
1415
"graphStatic": "静态",
1516
"high-dimensional": "数据降维",
1617
"profiler": "性能分析",

frontend/packages/core/public/locales/zh/graph.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"experimental-supported-model": "VisualDL实验性支持:",
1616
"experimental-supported-model-list": "TorchScript、PyTorch、Torch、 ArmNN、BigDL、Chainer、CNTK、Deeplearning4j、MediaPipe、ML.NET、MNN、OpenVINO、Scikit-learn、Tengine、TensorFlow.js、TensorFlow",
17+
1718
"export-file": "导出文件",
1819
"export-png": "PNG",
1920
"export-svg": "SVG",
@@ -52,8 +53,10 @@
5253
"keep-expanded": "保持展开",
5354
"supported-model": "VisualDL支持:",
5455
"supported-model-list": "PaddlePaddle、ONNX、Keras、Core ML、Caffe、Caffe2、Darknet、MXNet、ncnn、TensorFlow Lite",
56+
"supported-model-list-xpaddle": "ONNX、Caffe、Caffe2",
5557
"upload-model": "上传模型",
5658
"upload-tip": "点击或拖拽文件到页面上传模型,进行结构展示",
59+
"upload-tip2": "点击或拖拽文件到页面上传模型,进行模型转换",
5760
"vertical": "垂直",
5861
"Choose-model": "选择模型",
5962
"zoom-in": "放大",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"transformation": "转换",
3+
"download": "下载",
4+
"convert_before": "Please convert before viewing",
5+
"warin-info": "请将模型描述文件.prototxt和参数文件.caffemodel打包成.tar上传",
6+
"warin-info2": "该模型文件暂不支持X2Paddle转换",
7+
"warin-info3": "请先进行转换,再查看",
8+
"warin-info4": "模型已转换,请勿再次点击",
9+
"warin-info5": "请上传模型文件并转换",
10+
"warin-info6": "模型文件已转换,请勿再次点击",
11+
"warin-info7": "请上传模型文件"
12+
}

frontend/packages/core/snowpack.config.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
// cspell:words pnpify svgs entrypoints
1818

1919
import * as env from './builder/env.js';
20-
2120
import {fileURLToPath} from 'url';
2221
import fs from 'fs';
2322
import path from 'path';
@@ -37,7 +36,8 @@ function isWorkspace() {
3736

3837
const iconsPath = path.dirname(resolve.sync(cwd, '@visualdl/icons'));
3938
const netronPath = path.dirname(resolve.sync(cwd, '@visualdl/netron'));
40-
const TracePath = path.dirname(resolve.sync(cwd, './public/static'));
39+
const netronPath2 = path.dirname(resolve.sync(cwd, '@visualdl/netron2'));
40+
4141
const wasmPath = path.dirname(resolve.sync(cwd, '@visualdl/wasm'));
4242
const dest = path.resolve(cwd, './dist/__snowpack__/link/packages');
4343

@@ -66,8 +66,6 @@ export default {
6666
plugins: [
6767
'@snowpack/plugin-react-refresh',
6868
'@snowpack/plugin-dotenv',
69-
'snowpack-plugin-less',
70-
'@snowpack/plugin-sass',
7169
[
7270
'@snowpack/plugin-typescript',
7371
{
@@ -101,8 +99,8 @@ export default {
10199
destination: path.join(dest, 'netron/dist')
102100
},
103101
{
104-
source: [path.join(TracePath, '**/*')],
105-
destination: path.join(dest, 'trace/dist')
102+
source: [path.join(netronPath2, '**/*')],
103+
destination: path.join(dest, 'netron2/dist')
106104
},
107105
{
108106
source: [path.join(wasmPath, '*.{js,wasm}')],
@@ -118,8 +116,9 @@ export default {
118116
},
119117
packageOptions: {
120118
polyfillNode: true,
121-
// knownEntrypoints: ['chai', '@testing-library/react', 'fetch-mock/esm/client', 'react-is','rc-util/es/hooks/useId','rc-util/es/Portal','rc-util/es/Dom/contains','rc-util/es/Dom/css','rc-util/es/getScrollBarSize','rc-util/es/PortalWrapper','rc-select/es/hooks/useId','rc-util/es/Dom/isVisible','rc-util/es/Dom/focus','rc-util/es/Dom/focus']
122-
knownEntrypoints: ['chai', '@testing-library/react', 'fetch-mock/esm/client', 'react-is', 'antd']
119+
namedExports: ['gl-vec2', 'dagre'],
120+
// knownEntrypoints: ['chai', '@testing-library/react', 'fetch-mock/esm/client']
121+
knownEntrypoints: ['chai', '@testing-library/react']
123122
},
124123
buildOptions: {
125124
out: 'dist',

frontend/packages/core/src/App.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ const App: FunctionComponent = () => {
141141
</ErrorBoundary>
142142
</Router>
143143
</Main>
144-
<ToastContainer />
144+
<ToastContainer
145+
autoClose={100000}
146+
style={{wordBreak: 'break-all'}}
147+
draggable={false}
148+
closeOnClick={false}
149+
/>
145150
</SWRConfig>
146151
</div>
147152
);

frontend/packages/core/src/components/GraphPage/GraphSidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const Title = styled.div`
4545

4646
const Content = styled.div`
4747
padding: ${rem(20)};
48-
height: calc(100% - ${rem(60)});
48+
height: ${rem(600)};
4949
overflow: auto;
5050
`;
5151

frontend/packages/core/src/components/GraphPage/GraphStatic.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ const Graph = React.forwardRef<GraphRef, GraphProps>(
208208
};
209209
}, [handler, dispatch]);
210210

211-
useEffect(() => (ready && dispatch('change-files', files)) || undefined, [dispatch, files, ready]);
211+
useEffect(() => {
212+
(ready && dispatch('change-files', files)) || undefined;
213+
}, [dispatch, files, ready]);
212214
useEffect(
213215
() => (ready && dispatch('toggle-attributes', showAttributes)) || undefined,
214216
[dispatch, showAttributes, ready]

0 commit comments

Comments
 (0)