GithubHelp home page GithubHelp logo

Python 3.12 `xgboost.core.XGBoostError: Invalid Parameter format for nthread expect int but value='-1'` when `DMatrix` used with `import googlecloudprofiler`. about xgboost HOT 6 OPEN

rtb-zla-karma avatar rtb-zla-karma commented on May 18, 2024
Python 3.12 `xgboost.core.XGBoostError: Invalid Parameter format for nthread expect int but value='-1'` when `DMatrix` used with `import googlecloudprofiler`.

from xgboost.

Comments (6)

trivialfis avatar trivialfis commented on May 18, 2024 1

It's probably Python 3.12 with google profiler. I looked into it a little bit, loading the _profiler.cpython-312-x86_64-linux-gnu.so inside google profiler extension causes the error. For me, it's actually a segfault during the construction of DMatrix due to an invalid write inside C++ standard function:

    #0 0x7e270a2bb8f4 in std::codecvt<wchar_t, char, __mbstate_t>::do_unshift(__mbstate_t&, char*, char*, char*&) const (/lib/x86_64-linux-gnu/libstdc++.so.6+0xbb8f4)

My guess is that it's compiled with an incompatible compiler, which can be resolved by a source installation. I don't think I can go deeper than this at the moment.

from xgboost.

hcho3 avatar hcho3 commented on May 18, 2024

It would be interesting to see if the error persists after installing the identical set of packages in a Conda environment. (Conda packages use the same C++ compiler)

from xgboost.

trivialfis avatar trivialfis commented on May 18, 2024

the profiler is not on forge yet. Otherwise I would like to do a quick test.

from xgboost.

rtb-zla-karma avatar rtb-zla-karma commented on May 18, 2024

Hi again.

I've tested for older lib versions we have used in Python 3.10. I have run:

pip install xgboost==1.7.4 google-cloud-profiler==4.1.0

I couldn't downgrade to google-cloud-profiler==4.0.0 because it failed to build for Python 3.12.

Anyway, code surprisingly worked with xgboost==1.7.4. Output from pip freeze:

cachetools==5.3.3
certifi==2024.2.2
charset-normalizer==3.3.2
google-api-core==2.18.0
google-api-python-client==2.127.0
google-auth==2.29.0
google-auth-httplib2==0.2.0
google-cloud-profiler==4.1.0
googleapis-common-protos==1.63.0
httplib2==0.22.0
idna==3.7
numpy==1.26.4
proto-plus==1.23.0
protobuf==4.25.3
pyasn1==0.6.0
pyasn1_modules==0.4.0
pyparsing==3.1.2
requests==2.31.0
rsa==4.9
scipy==1.13.0
uritemplate==4.1.1
urllib3==2.2.1
xgboost==1.7.4

I've also tested it for in-between versions of xgboost and the highest version the code worked with is 1.7.6 and it started failing since 2.0.0.

from xgboost.

trivialfis avatar trivialfis commented on May 18, 2024

I couldn't downgrade to google-cloud-profiler==4.0.0 because it failed to build for Python 3.12.

I suggest opening an issue for google cloud profiler to fix this first. ;-)

from xgboost.

rtb-zla-karma avatar rtb-zla-karma commented on May 18, 2024

It's still bad TBH. After downgrading I get another error later in the project code when initialized DMatrix is used for predictions using model. I won't paste the code just the exception from minimal example:

Traceback (most recent call last):
  File "/project/path/file2.py", line 19, in <module>
    main()
  File "/project/path/file2.py", line 16, in main
    model.predict(matrix)[0].item()
    ^^^^^^^^^^^^^^^^^^^^^
  File "/venv/path/lib/python3.12/site-packages/xgboost/core.py", line 2163, in predict
    _check_call(
  File "/venv/path/lib/python3.12/site-packages/xgboost/core.py", line 279, in _check_call
    raise XGBoostError(py_str(_LIB.XGBGetLastError()))
xgboost.core.XGBoostError: Invalid Parameter format for disable_default_eval_metric expect boolean but value=''

Again, the solution is to remove import googlecloudprofiler. It seems that is have to remove this lib altogether.

from xgboost.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.