Skip to content
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

When version mismatch happens, show versions #325

Merged
merged 3 commits into from
Dec 20, 2021

Conversation

hcho3
Copy link
Collaborator

@hcho3 hcho3 commented Nov 24, 2021

Before:

Cannot deserialize model from a different version of Treelite

After:

Cannot deserialize model from a different version of Treelite.
Currently running Treelite version X.X.X
The model checkpoint was generated from Treelite version X.X.X

Also, add the C API function TreeliteQueryTreeliteVersion so that users can query the version of the Treelite library.

@codecov
Copy link

codecov bot commented Nov 24, 2021

Codecov Report

Merging #325 (29018a6) into mainline (2994be4) will decrease coverage by 0.17%.
The diff coverage is 0.00%.

Impacted file tree graph

@@              Coverage Diff               @@
##             mainline     #325      +/-   ##
==============================================
- Coverage       85.25%   85.07%   -0.18%     
+ Complexity         44       42       -2     
==============================================
  Files             108      108              
  Lines            8360     8374      +14     
  Branches           48       40       -8     
==============================================
- Hits             7127     7124       -3     
- Misses           1209     1227      +18     
+ Partials           24       23       -1     
Impacted Files Coverage Δ
include/treelite/tree_impl.h 89.43% <0.00%> (-1.25%) ⬇️
src/c_api/c_api_error.cc 46.15% <0.00%> (-53.85%) ⬇️
...src/main/java/ml/dmlc/treelite4j/java/DMatrix.java 55.81% <0.00%> (-13.96%) ⬇️
src/threading_utils/parallel_for.h 100.00% <0.00%> (+2.38%) ⬆️
include/treelite/typeinfo.h 90.00% <0.00%> (+3.33%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2994be4...29018a6. Read the comment docs.

<< TREELITE_VER_MINOR << "." << TREELITE_VER_PATCH << std::endl
<< "The model checkpoint was generated from Treelite version " << major_ver << "."
<< minor_ver << "." << patch_ver;
throw std::runtime_error(oss.str());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is perfect!

std::string& version_str = TreeliteAPIErrorStore::Get()->version_str;
version_str = oss.str();
return version_str.c_str();
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does solve the case when the user doesn't have a model but wants to check a version (e.g. during automated deployment, or to double-check deployment results). However, it seems this requires to build a separate application, whose sole purpose is to check the treelite version?
I agree that it's a neat API for e.g. server startup-time checking of version. However, it seems to me the same can be achieved by

static const char[] TREELITE_VERSION = "TREELITE_VERSION_" #TREELITE_VER_MAJOR "." #TREELITE_VER_MINOR "." #TREELITE_VER_PATCH;

in

?
The reason I'm insisting on this way is that this allows to look from any linux shell as well as a C/C++ application (the application can strcmp with what it expects, output this into any stream/string/stdout).

Copy link
Collaborator Author

@hcho3 hcho3 Nov 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@levsnv Please see my latest commit. You can now get the version number using strings:

$ strings libtreelite.dylib -o -t x | grep VERSION
2948ed TREELITE_VERSION_2.1.0

Copy link

@levsnv levsnv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! thanks for such a quick turnaround!

@hcho3 hcho3 merged commit 5d80909 into dmlc:mainline Dec 20, 2021
@hcho3 hcho3 deleted the better_version_check_error branch December 20, 2021 11:14
This was referenced Jan 13, 2022
rapids-bot bot pushed a commit to rapidsai/cuml that referenced this pull request Jan 25, 2022
The 2.2.0 version of Treelite incorporates the following major improvements:

* dmlc/treelite#314
* dmlc/treelite#322, dmlc/treelite#327
* dmlc/treelite#325
* dmlc/treelite#332
* dmlc/treelite#330
* dmlc/treelite#333
* dmlc/treelite#334
* dmlc/treelite#304
* dmlc/treelite#335

In particular, dmlc/treelite#332, dmlc/treelite#330, dmlc/treelite#333 are required for #4447.

Requires rapidsai/integration#412.

EDIT. Using 2.2.1 patch release, to incorporate a hotfix (dmlc/treelite#340).

Authors:
  - Philip Hyunsu Cho (https://github.com/hcho3)

Approvers:
  - AJ Schmidt (https://github.com/ajschmidt8)
  - Dante Gama Dessavre (https://github.com/dantegd)

URL: #4484
vimarsh6739 pushed a commit to vimarsh6739/cuml that referenced this pull request Oct 9, 2023
The 2.2.0 version of Treelite incorporates the following major improvements:

* dmlc/treelite#314
* dmlc/treelite#322, dmlc/treelite#327
* dmlc/treelite#325
* dmlc/treelite#332
* dmlc/treelite#330
* dmlc/treelite#333
* dmlc/treelite#334
* dmlc/treelite#304
* dmlc/treelite#335

In particular, dmlc/treelite#332, dmlc/treelite#330, dmlc/treelite#333 are required for rapidsai#4447.

Requires rapidsai/integration#412.

EDIT. Using 2.2.1 patch release, to incorporate a hotfix (dmlc/treelite#340).

Authors:
  - Philip Hyunsu Cho (https://github.com/hcho3)

Approvers:
  - AJ Schmidt (https://github.com/ajschmidt8)
  - Dante Gama Dessavre (https://github.com/dantegd)

URL: rapidsai#4484
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants