ONE
ONE copied to clipboard
[one-cmds] Introduce data post processing option to `one-infer`
WHAT
Let's introduce post-process stage by option in one-infer
.
WHY
To support value-test between two different one-infer
results, the inference result data should be well formatted.
The standard format of data was decided to use h5
because h5
is a type which can contain multiple data with specific hierarchy and some other reasons. (There is a discussion in this link)
On the other hand, one-infer
cannot guarantee various backend drivers emits well defined format data.
So, one-infer
needs to solve that problem with post-process
option which run data conversion after driver execution.
There is previous discussion about why post processing? in #9282.
HOW
Brief example usage will be like this.
$ ls
model.npu aaa.0.npy aaa.1.npy
# Note that [commands] run model.npu with aaa.0.npy and aaa.1.npy as input data
# and emit output data as bbb.0.npy ...
# ./npy2h5.py can be any script which converts the npu-infer's result
# to preset standard format of h5
$ one-infer -d npu-infer --post-process ./npy2h5.py -- [commands]
Inference complete!
$ ls
model.npu aaa.0.npy aaa.1.npy bbb.0.npy bbb.1.npy ccc.h5
IMHO --post-process ./npy2h5.py
can be replaced to --post-process "./npy2h5.py aaa.0.npy aaa.1.npy bbb.0.npy ccc.h5"
depends on how npy2h5.py
has been implemented.
Any questions and suggestions are gratefully welcome!
The idea looks good to me. Could you show the example of npy2h5.py
? I'm curious about the format of the post-process script.
The idea looks good to me. Could you show the example of
npy2h5.py
? I'm curious about the format of the post-process script.
Of course. When I'm ready, I'll make and add it to my draft and ping you. It will be great to having one sample post-process script. :smile: Thank you!