ONE
ONE copied to clipboard
[tools] Enhance tflite tools
There are some utils on tools for tflite models. But, I'd like to add some features like
- print graph on console
- make tools ease searching/finding
- show available constant values like slide_slice
After concrete goals, I'll make new issues separately.
/cc @chunseoklee @hseok-oh
(as-is) tflitefile_tool -> (to-be) model_tool
- the only tflite supports now
- other model types support in the future
tflitefile_tool revised
- modules: IR, parser, [text|graph|value]printer, saver, finder, ...
todos
- [x] Arrange modules
- [x] Separate model_parser from tflite
as-is
~/Works/ONE/tools/tflitefile_tool(pr/tools/arrange_tflitefile_tool ✗) tree -L 2
.
├── ir
│ ├── graph_stats.py
│ ├── __init__.py
│ ├── operator_wrapping.py
│ └── tensor_wrapping.py
├── model_parser.py
├── parser
│ ├── __init__.py
│ ├── model_parser.py
│ └── operator_parser.py
├── printer
│ ├── __init__.py
│ ├── operator_printer.py
│ ├── option_printer.py
│ ├── subgraph_printer.py
│ └── tensor_printer.py
├── README.md
├── requirements.txt
├── saver
│ ├── config_saver.py
│ ├── __init__.py
│ └── model_saver.py
├── select_operator.py
└── tflite
├── AbsOptions.py
├── ...
to-be
~/Works/ONE/tools/tflitefile_tool(pr/tools/arrange_tflitefile_tool ✗) tree -L 2
.
├── ir
│ ├── model
│ ├── subgraph
│ ├── operator
│ ├── option
│ └── tensor; +const value
├── main.py
├── parser
│ ├── tflite_parser.py; inherits to below functions by tflite API
│ ├── other_parser.py; inherits to below functions by other API
│ ├── model_parser.py
│ ├── sungraph_parser.py
│ ├── tensor_parser.py
│ └── operator_parser.py
├── printer
│ ├── printer.py; below functions inherent to this function
│ ├── stdout_printer.py
│ ├── csv_printer.py
│ ├── dot_printer.py
│ └── graph_printer.py; this would be quite difficult
├── README.md
├── requirements.txt
├── saver
│ ├── config_saver.py
│ └── model_saver.py
├── select_operator.py
└── tflite
├── AbsOptions.py
├── ...
https://github.com/Samsung/ONE/pull/8163
LGTM
@YongseopKim We may need unittest for better review.
Let's support unittest.
After chatting with @mhs4670go , I figure out the necessity of what the final goal is.
- tflitefile_tools could be nn model tools -> could support other types of nn models that use python apis
- ascii graph printing could be a kind of diff tool -> could show the diff of nodes or attributes of nodes
- could support features easily like search, save(multiple save file types), and so on.
printer
- [ ] remove saver/
- [ ] introduce csv, dot printer
features
- [ ] introduce printing buffer
- [ ] introduce search(or find)
...
- [ ] OpTypesCount ->
from collections import Counter
- [ ] Adds negative tests
https://github.com/Samsung/ONE/pull/8187 @hseok-oh
It's better to add negative test later.