ONE
ONE copied to clipboard
[one-cmds] Calculate paths relative to cfg file itself
What?
Currently, onecc -C <config>
command parses the paths in cfg file relative to cwd
.
According to @seanshpark, it's a legacy from that onecc executes commands with paths as an arguments.
Let's calculate paths in cfg file as relative to the file itself.
@seanshpark @lemmaa May I ask about any decision on this issue from the meeting?
@seanshpark @lemmaa May I ask about any decision on this issue from the meeting?
one-cmds
will be modified so that the relative path described in *.cfg
is calculated based on the location of the *.cfg
file.
will be modified so that the relative path described in
Yes, we need to make this happend but I need to check one thing.
if there are three folders A, B, C for;
- A/model.cfg --> where the cfg file is
- B/model.tflite --> where the input model is
- C --> current folder
model.cfg has output as just "output=model.circle" where should the output file be? A or C ?
@dayo09 Could you let me know why this change is needed?
I have written down all the reasons here : https://github.sec.samsung.net/RS7-RuntimeNTools/secret/issues/195
model.cfg has output as just "output=model.circle" where should the output file be? A or C ?
The output file's location will depend on what path is written in the config file. We have a clear rule : "all the file paths written in the config file are relative to the config file's path"
For example,
[one-import-tflite]
input_file=../B/model.tflite
output_file=../B/model.circle
// workspace
A/model.cfg --> where the cfg file is
B/model.tflite --> where the input model is
B/model.circle <--
Or else,
[one-import-tflite]
input_file=../B/model.tflite
output_file=model.circle
// workspace
A/model.cfg --> where the cfg file is
B/model.tflite --> where the input model is
A/model.circle <--
We have a clear rule : "all the file paths written in the config file are relative to the config file's path"
If this happens, current CI will break and currently I don't have any idea to resolve this.
As @lemmaa suggested, we may add another flag in .cfg file and if the flag exist, go with cfg relative, or else maintain as-is.
This is a big change. It is usually right to proceed with such a change with a grace period. It is a good way to apply it through options so that it does not affect the behavior of existing uses. I think the past implementation is an uncommon erroneous implementation. Therefore, in the end, the current new implementation should be the default operation. :)
@dayo09 , could you please suggest a way to solve this problem using command line options?
@seanshpark @lemmaa Yes, that opinion was raised at the one-vscode meeting, too. @YongseopKim has given the idea : adding an option to a cli to consider backward compatibility.
I suggest:
onecc -C sample.cfg (default, cwd-basis)
onecc --basedir=cwd -C sample.cfg (cwd-basis)
onecc --basedir=cfg -C sample.cfg (cfg-basis)
OR
onecc --basedir-cwd -C sample.cfg (cwd-basis)
onecc --basedir-cfg -C sample.cfg (cfg-basis)
* cwd-basis
: calculate paths relative to cwd, as-is
* cfg-basis
: calculate paths relative to cfg file itself, to-be
(I am still not sure about the name, basedir. I tried but cannot find other practices which resembles this feature)
And we can forbid user to use --basedir** options when giving path as cli argument, not using cfg file.
(I am still not sure about the name, basedir. I tried but cannot find other practices which resembles this feature)
In general, base path
is often used.
The basic approach seems good. By temporarily introducing the two options and changing the default policy to cfg-basis
after the grace period, we will be able to complete the transition without friction. Eventually we will be able to deprecate the two options we have added.
Personally, I prefer a name that clearly communicates its meaning, such as
--use-cfg-file-path-as-base-path
--use-cwd-as-base-path
Furthermore, since this is an option to keep temporarily during the grace period for transition. :)