-
Notifications
You must be signed in to change notification settings - Fork 668
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build(tvm_utility): remove download logic from CMake and update documentation #4923
build(tvm_utility): remove download logic from CMake and update documentation #4923
Conversation
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
…entation Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
… into remove_download_tvm_utility
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
common/tvm_utility/README.md
Outdated
If there are no user-provided files, the function tries to reuse previously-downloaded artifacts. | ||
If there are no previously-downloaded artifacts, and if the `DOWNLOAD_ARTIFACTS` cmake variable is set, they will be downloaded from the bucket. | ||
Otherwise, nothing happens. | ||
Users should provide model files under "data/user/${MODEL_NAME}/". Otherwise, nothing happens and compilation of the package will be skipped. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the artifacts are required for compilation, then they should be part of the source tree (via git-lfs
for example if the files are too big), otherwise it won't be possible to build Debian packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually It is a bit confusing for now. Because this packages don't seem to build anyway now because DOWNLOAD_ARTIFACTS flag is disabled by default and this PR kinda show it because last changes was made several months ago and bug was hidden. So here I just follow the same logic.
And as I understand before we are going to use ansible to provide artifacts. And for packages with tenosorrt support It is more or less straight forward process as all model conversion from onnx to TRT happens later on the first run not on the build.
For TVM it is a bit more complicated as it provide models in already compiled form and to use it in the package you will need to provide some model files to build it.
But if I understand you correctly here. You propose that there should be some default artifacts for all TVM packages which should be part of the source tree and the only way to do it is git-lfs
because for now deploy_param.params
file weights 10-20 Mb usually. And If user will want to provide his own models wouldn't it be messy a bit ?
I think there is a kinda similar way to complile the model to TVM before run by the user same as with TRT but I'm not so familiar with TVM.
And what is the idea behind the Debian packages? Should user be able to use them of the shelf with the build in model? I guess in many cases user with have to use model trained on his own data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For TVM it is a bit more complicated as it provide models in already compiled form and to use it in the package you will need to provide some model files to build it.
As far as I know, we only need the headers for building the packages, not the full models.
And what is the idea behind the Debian packages? Should user be able to use them of the shelf with the build in model? I guess in many cases user with have to use model trained on his own data.
The Debian packages are a way for users to install Autoware in production environments without having to build it themselves, much like how ROS is distributed. Eventually, Autoware can become part of the ROS distribution, but that will come at a later stage.
I don't understand why it bothers anyone that there is an option to download default-compiled models. As you see the default is to not download the models, and there is already an option for the user to provide their own compiled/tuned models; so to me it looks like it already adheres to the proposed plan in #3137. |
ambroise-arm The main issue with current approach that it will produce empty Debian package by default as there is no ansible step in their build. And it is not possible to download or provide models in other way. They should be part of the source tree. May be you can propose the other way to deal with it? May be it is possible to move model compilation step further as it done with onnx2trt conversion? So the model files doesn't need for package compilation. For now it was offered in Software WG to add header files for default model to the source tree. And the model weights will be provided by the user or downloaded by ansible script. If user want to use his models he will need to rebuild the package or just provide the deploy_param.params file if he just retrain the model. Correct me, please, if get wrong how TVM works in general. |
Requiring packages to have access to internet during build step can make them vulnerable to supply chain attacks, in addition to not being able to make builds reproducible (e.g. for audits). For example, the Debian and ROS buildfarms restrict access to the internet for packages so they must be built in isolation. The end goal is so that all that logic for downloading artifacts done in CMake is removed and instead use ansible (or instruct the user to download the artifacts manually). |
I don't understand how removing the option to download models with cmake solves this. The problem is that we lack an ansible step, not that there is a cmake download step as an option. At least from what I see. Is the ansible step mutually exclusive with the cmake download step? I don't know what this ansible step would look like (if you have example code somewhere I am interested), but I suppose it can be used together with the other ways to get the artifact, in the same way that the cmake logic currently prefers user-provided models, and if there are none try to download one.
Yes, but not with the current implementation. I had started to rework the way tvm_utility worked to allow to remove the need for the artifact to be present at compile time, but I didn't see much interest in TVM packages so I parked the work. Maybe I could continue on that, not immediately though.
It is not a requirement but a convenience option. Currently user-provided artifacts are preferred over downloading one.
Ok, if there has been a definitive decision to remove the cmake downloads from all packages for whatever reason I can live with that. But can we agree it isn't justified by any of the points above? |
…nn config header and test image Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #4923 +/- ##
==========================================
+ Coverage 14.73% 14.78% +0.04%
==========================================
Files 1661 1663 +2
Lines 115531 115633 +102
Branches 35675 35735 +60
==========================================
+ Hits 17023 17093 +70
+ Misses 79272 79237 -35
- Partials 19236 19303 +67
*This pull request uses carry forward flags. Click here to find out more.
☔ View full report in Codecov by Sentry. |
I've updated tvm_utils. As example for other tvm based packages. Introduced new constructor for Back compatible with other tvm packages as previous constructor is kept in place |
@ambroise-arm Can you please elaborate a bit how tvm_utility should be reworked:
So we can consider such option as one possible solution. |
@lexavtanke At a high level All the tvm packages in autoware need to be changed to use the new interface. The path to those .so, .json and .params need to become parameters of the nodes making use of tvm_utilty. That probably needs to be integrated with the new way of getting the artifacts you were talking about, in order to make it easy for the user to select a specific backend, and potentially switching between them without too much effort (and also user-provided artifacts). And then there can be optimizations that can be done to https://github.com/autowarefoundation/modelzoo/ in order to stop generating that header file that won't be used anymore. |
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
common/tvm_utility/.gitignore
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This file can be removed if it's empty.
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
… into remove_download_tvm_utility
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lexavtanke LGTM, thanks for the patience iterating with us 🙂
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
Signed-off-by: Alexey Panferov <lexavtanke@gmail.com>
@angry-crab could you approve this PR when you have a moment? You're one of the codeowners of this package, I approved these changes, but they won't merge unless a codeowner approves it as well. Thanks! |
Am I not a codeowner of |
@ambroise-arm probably, but only @angry-crab had the codeowner logo, I assumed he was the only one. Anyway, @ambroise-arm thanks for approving this PR |
Description
See #3137
According to discussion above remove downloading logic from building stage. For now it will be possible to download model files either by ansible or manually as explained in this PR
Also documentation about the package is updated to remove mentions about downloading. Kindly ask for maintainers to read throw the doc to check that it still consistent especially Security consideration part.
Tests performed
Not applicable.
Effects on system behavior
Not applicable.
Pre-review checklist for the PR author
The PR author must check the checkboxes below when creating the PR.
In-review checklist for the PR reviewers
The PR reviewers must check the checkboxes below before approval.
Post-review checklist for the PR author
The PR author must check the checkboxes below before merging.
After all checkboxes are checked, anyone who has write access can merge the PR.