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

Support XGBoost UBJSON #578

Merged
merged 13 commits into from
Jul 12, 2024
Merged

Support XGBoost UBJSON #578

merged 13 commits into from
Jul 12, 2024

Conversation

hcho3
Copy link
Collaborator

@hcho3 hcho3 commented Jul 10, 2024

Closes #573

Use https://github.com/nlohmann/json to parse UBJSON as it has the following advantages:

  • Idiomatic modern C++
  • Available on Conda-forge
  • Offers SAX-style parser API, so that we can re-use substantial amount of code from XGBoost JSON parser.

@hcho3
Copy link
Collaborator Author

hcho3 commented Jul 10, 2024

@trivialfis FYI, I managed to implement the UBJSON support without too much work. It reuses the event-based parser we use for parsing XGBoost JSON models.

Copy link

codecov bot commented Jul 10, 2024

Codecov Report

Attention: Patch coverage is 78.58974% with 167 lines in your changes missing coverage. Please review.

Project coverage is 84.77%. Comparing base (d8f12bc) to head (31d80c0).
Report is 6 commits behind head on mainline.

Files with missing lines Patch % Lines
...el_loader/detail/xgboost_json/delegated_handler.cc 77.98% 118 Missing ⚠️
...c/model_loader/detail/xgboost_json/sax_adapters.cc 55.38% 29 Missing ⚠️
src/c_api/model_loader.cc 70.96% 9 Missing ⚠️
python/treelite/frontend.py 90.47% 4 Missing ⚠️
src/model_loader/detail/xgboost.cc 78.94% 4 Missing ⚠️
...del_loader/detail/xgboost_json/delegated_handler.h 87.50% 2 Missing ⚠️
src/model_loader/lightgbm.cc 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           mainline     #578      +/-   ##
============================================
- Coverage     84.92%   84.77%   -0.16%     
============================================
  Files            71       75       +4     
  Lines          6347     6547     +200     
  Branches        521      528       +7     
============================================
+ Hits           5390     5550     +160     
- Misses          957      997      +40     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@trivialfis
Copy link
Member

Cool, the nlohmann JSON is excellent, glad that it can be directly used here.

@hcho3 hcho3 changed the title [WIP] Support XGBoost UBJSON Support XGBoost UBJSON Jul 12, 2024
@hcho3 hcho3 merged commit 27b81f7 into dmlc:mainline Jul 12, 2024
19 of 21 checks passed
@hcho3 hcho3 deleted the support_ubjson branch July 12, 2024 17:56
rapids-bot bot pushed a commit to rapidsai/cuml that referenced this pull request Jul 24, 2024
Treelite 4.3.0 contains the following improvements:

* Support XGBoost 2.1.0, including the UBJSON format (dmlc/treelite#572, dmlc/treelite#578)
* [GTIL] Allow inferencing with FP32 input + FP64 model (dmlc/treelite#574). Related: triton-inference-server/fil_backend#391
* Prevent integer overflow for deep LightGBM trees by using DFS order (dmlc/treelite#570).
* Support building with latest RapidJSON (dmlc/treelite#567)

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

Approvers:
  - James Lamb (https://github.com/jameslamb)
  - Dante Gama Dessavre (https://github.com/dantegd)

URL: #5968
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.

Add support UBJSON XGBoost models
2 participants