Skip to content

Commit 58f462c

Browse files
committed
[Extension] Add *.pdmodel/*.mnn/*.param/*.nb support
1 parent c29cf77 commit 58f462c

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
# netron-vscode-extension
22

3-
A vscode extension for netron, support *.pdmodel, *.nb, *.onnx, *.pb, *.h5, *.tflite, *.pth, *.pt, *.mnn, *.tnnproto, *.param, etc. This code is based on [NetronInVSCode](https://github.com/chingweihsu0809/NetronInVSCode) but add more model format support, such as *.pdmodel, *.nb, *.mnn, *.param, *.tnnproto, etc.
3+
A vscode extension for netron, support *.pdmodel, *.nb, *.onnx, *.pb, *.h5, *.tflite, *.pth, *.pt, *.mnn, *.tnnproto, *.param, etc. This code is based on [NetronInVSCode](https://github.com/chingweihsu0809/NetronInVSCode) but adds more model format support, such as *.pdmodel, *.nb, *.mnn, *.param, *.tnnproto, etc.
4+
5+
NOTE: This extension is mainly for personal use, and I have no intensive development plans in the future.
6+
47

58
## TODO
69
- [x] add *.pdmodel, *.nb, *.mnn, *.param, *.tnnproto format support
10+
- [x] remove manually `pip install` requirements
711
- [ ] onnx-simplifier support
812
- [ ] paddle2onnx converter support
913
- [ ] x2paddle converter support
1014
- [ ] MNN converter support
11-
- [ ] Optimize some UI
12-
13-
## Requirements
14-
15-
- `pip install netron`
15+
- [ ] Optimize some UI components
1616

1717
## Usage
1818

1919
- Install `netron-vscode-extension` from VSCode marketplace.
20-
- Click on a saved model to see the following.
20+
- Click on a saved model to see the following.
2121
![alt text](documentation/example.gif)
2222

2323
## Running the code

src/modelVisualizer.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,27 @@ export class ModelVisualizer implements vscode.CustomEditorProvider<ModelFile> {
213213
) {
214214
ModelVisualizer.python.ex`
215215
import sys
216-
import netron
217216
import platform
217+
def install_deps():
218+
try:
219+
from pip._internal.cli.main import main
220+
main(['install', 'netron'])
221+
return '0'
222+
except:
223+
return '-1'
224+
218225
def vis_model(path):
226+
import netron
219227
if platform.system() == 'Windows':
220228
path = path.lstrip('/')
221229
addr, port = netron.start(path, browse=False)
222230
return 'http://' + str(addr) + ':' + str(port)
223231
`;
232+
// install deps while extension init
233+
ModelVisualizer.python`install_deps()`
234+
.then((res) => { console.log(res); })
235+
.catch((err) => { console.log(err); });
236+
224237
}
225238

226239
//#region CustomEditorProvider

0 commit comments

Comments
 (0)