From b67ce9c83089a992f6030b8532da4b614bb274f8 Mon Sep 17 00:00:00 2001 From: Dmitry Razdoburdin Date: Fri, 20 Sep 2024 12:54:28 +0200 Subject: [PATCH 1/2] fix int overflow in FTI model convertor (#2053) * fix int overflow in fti model convertor * fix if feature_types are not defined * fix for absence of feature_type attribute --------- Co-authored-by: Dmitry Razdoburdin <> --- src/gbt_convertors.pyx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/gbt_convertors.pyx b/src/gbt_convertors.pyx index 82fe7f5adb..2cc097c7ca 100755 --- a/src/gbt_convertors.pyx +++ b/src/gbt_convertors.pyx @@ -253,6 +253,17 @@ class TreeList(list): Note: We cannot type-hint the xgb.Booster without loading xgb as dependency in pyx code, therefore not type hint is added. """ + # dump_format="json" is affected by the integer-overflow error, + # since XGBoost doesn't control numeric limits of integer features. + # For correct conversion we manulally replace feature types from 'int'->'float; + if hasattr(booster, "feature_types"): + feature_types = booster.feature_types + if feature_types: + for i in range(len(feature_types)): + if feature_types[i] == "int": + feature_types[i] = "float" + booster.feature_types = feature_types + tl = TreeList() dump = booster.get_dump(dump_format="json", with_stats=True) for tree_id, raw_tree in enumerate(dump): From 0b8bec8e6c9d5a074073ca3aaf5ffcb34ea2bbcc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 20 Sep 2024 15:47:20 +0100 Subject: [PATCH 2/2] Update dependency setuptools to v75 (#2062) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- dependencies-dev | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies-dev b/dependencies-dev index 4cbd4ea330..0108e9e7f7 100644 --- a/dependencies-dev +++ b/dependencies-dev @@ -4,4 +4,4 @@ numpy==2.0.1 ; python_version <= '3.9' numpy==2.1.1 ; python_version > '3.9' pybind11==2.13.5 cmake==3.30.3 -setuptools==74.1.2 +setuptools==75.1.0