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

[BUG] test_gpu_treeshap.py::test_xgb_regressor[reg:pseudohubererror] fails with XGBoost 1.6.0 #4715

Closed
hcho3 opened this issue Apr 27, 2022 · 1 comment · Fixed by #4752
Closed
Assignees
Labels
bug Something isn't working inactive-30d

Comments

@hcho3
Copy link
Contributor

hcho3 commented Apr 27, 2022

A pytest fails with the latest XGBoost (1.6.0).

Reproduction:

python -m pytest -v -x -rxXs python/cuml/tests/explainer/test_gpu_treeshap.py

Error message:

python/cuml/tests/explainer/test_gpu_treeshap.py::test_xgb_regressor[reg:pseudohubererror] FAILED                                                                      [ 10%] 
                                                                                                                                                                              
================================================================================== FAILURES ==================================================================================
__________________________________________________________________ test_xgb_regressor[reg:pseudohubererror] __________________________________________________________________
                                                                                                                                                                              
objective = 'reg:pseudohubererror'                                                                                                                                            
                                                                                                                                                                              
    @pytest.mark.parametrize('objective', ['reg:linear', 'reg:squarederror',                                                                                                  
                                           'reg:squaredlogerror',                                                                                                             
                                           'reg:pseudohubererror'])                                                                                                           
    @pytest.mark.skipif(not has_xgboost(), reason="need to install xgboost")                                                                                                  
    @pytest.mark.skipif(not has_shap(), reason="need to install shap")                                                                                                        
    @pytest.mark.skipif(not has_sklearn(), reason="need to install scikit-learn")                                                                                             
    def test_xgb_regressor(objective):                                                                                                                                        
        n_samples = 100                                                                                                                                                       
        X, y = make_regression(n_samples=n_samples, n_features=8, n_informative=8,                                                                                            
                               n_targets=1, random_state=2021)                                                                                                                
        # Ensure that the label exceeds -1                                                                                                                                    
        y += (-0.5) - np.min(y)                                                                                                                                               
        assert np.all(y > -1)                                                                                                                                                 
        X, y = X.astype(np.float32), y.astype(np.float32)                                                                                                                     
        dtrain = xgb.DMatrix(X, label=y)
        params = {'objective': objective, 'base_score': 0.5, 'seed': 0,
                  'max_depth': 6, 'tree_method': 'gpu_hist',
                  'predictor': 'gpu_predictor'}
        num_round = 10
        xgb_model = xgb.train(params, dtrain, num_boost_round=num_round,
                              evals=[(dtrain, 'train')])
>       tl_model = treelite.Model.from_xgboost(xgb_model)

python/cuml/tests/explainer/test_gpu_treeshap.py:119: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../miniconda3/envs/cuml_dev/lib/python3.9/site-packages/treelite/frontend.py:388: in from_xgboost
    return cls.from_xgboost_json(model_json_str)
../../miniconda3/envs/cuml_dev/lib/python3.9/site-packages/treelite/frontend.py:436: in from_xgboost_json
    _check_call(_LIB.TreeliteLoadXGBoostJSONString(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ret = -1

    def _check_call(ret):
		"""Check the return value of C API call
     
        This function will raise exception when error occurs.
        Wrap every API call with this function
     
        Parameters
        ----------
        ret : int
            return value from API calls
        """
        if ret != 0:
>           raise TreeliteError(_LIB.TreeliteGetLastError().decode('utf-8'))
E           treelite.util.TreeliteError: [18:17:57] /home/conda/feedstock_root/build_artifacts/treelite_1645138081934/work/src/frontend/xgboost_json.cc:539: Provided JSON could not be parsed as XGBoost model. Parsing error at offset 4458: Terminate parsing due to Handler error.
E           ame":"reg:pseudohubererror","pseduo_huber_param":{"huber_slope":"1"}}},"version":[1,6,0]}
E           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../../miniconda3/envs/cuml_dev/lib/python3.9/site-packages/treelite/core.py:50: TreeliteError
@hcho3 hcho3 added bug Something isn't working ? - Needs Triage Need team to review and classify labels Apr 27, 2022
@hcho3 hcho3 removed the ? - Needs Triage Need team to review and classify label Apr 27, 2022
@hcho3 hcho3 self-assigned this Apr 27, 2022
@github-actions
Copy link

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

rapids-bot bot pushed a commit that referenced this issue May 28, 2022
The 2.4.0 version of Treelite incorporates the following improvements:

* dmlc/treelite#370
* dmlc/treelite#381
* dmlc/treelite#380
* dmlc/treelite#383

Requires rapidsai/integration#474

This PR targets the 22.06 release.

Closes #4715

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

Approvers:
  - AJ Schmidt (https://github.com/ajschmidt8)
  - Corey J. Nolet (https://github.com/cjnolet)

URL: #4752
vimarsh6739 pushed a commit to vimarsh6739/cuml that referenced this issue Oct 9, 2023
The 2.4.0 version of Treelite incorporates the following improvements:

* dmlc/treelite#370
* dmlc/treelite#381
* dmlc/treelite#380
* dmlc/treelite#383

Requires rapidsai/integration#474

This PR targets the 22.06 release.

Closes rapidsai#4715

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

Approvers:
  - AJ Schmidt (https://github.com/ajschmidt8)
  - Corey J. Nolet (https://github.com/cjnolet)

URL: rapidsai#4752
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working inactive-30d
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant