[one-cmds] Introduce an one-cmd to make a init config file
As we discussed, let's introduce an one-cmd to make an init(or a default) config file. The name could be something like one-config-init or one-init.
one-config-init init.cfg
how about one-new my-new-project.cfg ? or maybe just one-new my-new-project without .cfg
one-new is also a good name!
And, I'll handle the file name like below
- if with
.cfg, the file name is as-is - if without
.cfg, the file name also has.cfgas ext.
one-new is also a good name!
Thanks :) one-init is also good (npm uses init, git uses init ...)
Old Idea
The one-cmd takes the minimal options and makes a config file that contains the minimal content. The next step, and then, it would contain the default optimization options.
As I imagine,
$ one-config-init init.cfg --input_path='model.tflite' --output_path='new_model.file' --backend='npu'
...
$ ls
init.cfg
$ cat init.cfg
[onecc]
one-import-tflite=True # can get from model.tflite
one-optimize=True # we assume users want to make npu model as default
one-quantize=True
one-codegen=True
[one-import-tflite]
input_path=./model.tflite
output_path=./model.circle # basename.circle
[one-optimize]
input_path=./model.circle
output_path=./model.opt.circle
[one-quantize]
input_path=./model.opt.circle
output_path=./model.q8.circle # basename.q.circle, q8 as default
granularity=channel # as default
[one-codegen]
backend=npu
command=-o new_model.file ./model.q8.circle
In the future,
[onecc]
one-import-tflite=True # can get from model.tflite
one-optimize=True # we assume users want to make npu model as default
one-quantize=True
one-codegen=True
[one-import-tflite]
input_path=./model.tflite
output_path=./model.circle # basename.circle
[one-optimize]
input_path=./model.circle
output_path=./model.opt.circle
# if there are the default options
fuse_add_with_tconv=True
fold_add_v2=True
...=True
[one-quantize]
input_path=./model.opt.circle
output_path=./model.q8.circle # basename.q.circle, q8 as default
granularity=channel # as default
[one-codegen]
backend=npu
command=-o new_model.file ./model.q8.circle
Okay, I decide to make the following
- the one-cmd name is
one-init -
one-initjust copies an existing cfg template that contains all false values and some commented values. You can imagine thatbashand.bashrcstyle. We support all options commented and users can choose options by uncommenting them. -
oneccusesone-initbyonecc init config.cfg
And, in the future, we can support like one-config that adds or sets key/value for the config file.
I'd like to revise one init and the default option (issue https://github.com/Samsung/ONE/issues/9191 pr https://github.com/Samsung/ONE/pull/9190).
After revising/discussing the idea and design, I'll leave new comments.
one init ${model_name_wt_ext} -> makes a ${model_name}.cfg with default options for each model type that can be deduced by ext.
/cc @jyoungyun
Q) from one init, is it typo of one-init or are you going to introduce one command with init sub command?
It's a typo. one init -> onecc init so that one-init will be introduced.
How about supporting two kinds of onecc init command?
onecc init : Create general template cfg file (including all import options)
onecc init <model> : Create template cfg file according to model extension
This is a personal idea. :)
(including all import options)
you mean one-import-tf=True and one-import-bcq=True, one-import-onnx=True ? and also one-import-tflite=True
you mean
one-import-tf=Trueandone-import-bcq=True,one-import-onnx=True? and alsoone-import-tflite=True
Yes, but all import options will be False. The reason I suggested to show all import options is that user can choose what they want without worrying about the option name.
@jyoungyun I think it's a great idea. I'll consider it.
@jyoungyun , this is part of current onecc.template.cfg file, which I assume this file will be used to make initial .cfg file.
; To activate a step (or task),
; set True for the step in [onecc] section and fill options in the corresponding section
[onecc]
; neural network model to circle
one-import-tf=False
one-import-tflite=False
one-import-bcq=False
one-import-onnx=False
; circle to circle with optimization
one-optimize=False
; circle to circle with quantization
one-quantize=False
; partition circle
one-partition=False
; package circle and metadata into nnpackage
one-pack=False
; generate code for backend
one-codegen=False
; profile
one-profile=False
Is there some difference whay you want from? or your suggestion is about
onecc init : Create general template cfg file (including all import options)
which wasn't planned?
I understood that onecc init : Create general template cfg file (including all import options) is copying onecc.template.cfg to new name. @jyoungyun right?
My thoughts
-
onecc init: copyonecc.template.cfgto$CWD/init.cfg -
onecc init model_name.ext- fail to parse ext: throw error
- others: copy
onecc.template.cfgto$CWD/model_name.cfgwith some value change- example: https://github.com/Samsung/ONE/pull/9250
- these files are being created by
onecc initwith copying the template cfg. (and that's why I revise the template file.)
example: https://github.com/Samsung/ONE/pull/9250
I think it would be better to add some script or program to set default values, not adding new files for each initial .cfg files.
I think it would be better to add some script or program to set default values, not adding new files for each initial .cfg files.
Yes, exactly. I wanted to show the results created by some scripts or programs. I'll introduce features within onecc init 😄 .
I understood that
onecc init : Create general template cfg file (including all import options)is copyingonecc.template.cfgto new name. @jyoungyun right?
Yes, that's exactly what I want to say.
Is there some difference whay you want from? or your suggestion is about
onecc init : Create general template cfg file (including all import options)which wasn't planned?
I mean that onecc init is copying onecc.template.cfg file. And I suggested that cfg file for each model does not exist separately, but the value of the existing template file (onecc.template.cfg) was modified according to the information of model file.
Now I upload my draft(https://github.com/Samsung/ONE/pull/9259) according to your opinions.