From daf13e7ca1554f0b7c12389aa569f287ae5d0760 Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Mon, 22 Jul 2024 23:04:26 -0700 Subject: [PATCH 1/2] Don't pass `callbacks=None` to `XGBoostSklearnEstimator._fit` The original implmentation would pass `callbacks=None` to `XGBoostSklearnEstimator._fit` and eventually lead to a `TypeError` of `XGBModel.fit() got an unexpected keyword argument 'callbacks'`. This PR instead does not pass the `callbacks=None` parameter to avoid the error. --- flaml/automl/model.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/flaml/automl/model.py b/flaml/automl/model.py index 9943f31674..de01e464f4 100644 --- a/flaml/automl/model.py +++ b/flaml/automl/model.py @@ -1418,12 +1418,10 @@ def fit(self, X_train, y_train, budget=None, free_mem_ratio=0, **kwargs): # since xgboost>=1.6.0, callbacks can't be passed in fit() self.params["callbacks"] = callbacks callbacks = None - self._fit( - X_train, - y_train, - callbacks=callbacks, - **kwargs, - ) + if callbacks is None: + self._fit(X_train, y_train, **kwargs) + else: + self._fit(X_train, y_train, callbacks=callbacks, **kwargs) if callbacks is None: # for xgboost>=1.6.0, pop callbacks to enable pickle callbacks = self.params.pop("callbacks") From e1234f743a2e9ca03445c010ef52cdd32dddb50c Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Fri, 26 Jul 2024 21:15:40 -0700 Subject: [PATCH 2/2] Update setup.py to allow for xgboost 2.x --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7bb35716bb..aaf904fbff 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ extras_require={ "automl": [ "lightgbm>=2.3.1", - "xgboost>=0.90,<2.0.0", + "xgboost>=0.90,<3.0.0", "scipy>=1.4.1", "pandas>=1.1.4", "scikit-learn>=0.24",