jpmml / jpmml-xgboost

Java library and command-line application for converting XGBoost models to PMML
GNU Affero General Public License v3.0
128 stars 43 forks source link

Support xgboost 1.3.X #54

Closed OnlyFor closed 3 years ago

OnlyFor commented 3 years ago
Standard output is empty
Standard error:
1 06, 2021 10:45:43  org.jpmml.sklearn.Main run
Ϣ: Parsing PKL..
1 06, 2021 10:45:43  org.jpmml.sklearn.Main run
Ϣ: Parsed PKL in 15 ms.
1 06, 2021 10:45:43  org.jpmml.sklearn.Main run
Ϣ: Converting PKL to PMML..
1 06, 2021 10:45:43  org.jpmml.sklearn.Main run
: Failed to convert PKL to PMML
java.lang.IllegalArgumentException: 1730313018.1919250021
        at org.jpmml.xgboost.Learner.load(Learner.java:81)
        at org.jpmml.xgboost.XGBoostUtil.loadLearner(XGBoostUtil.java:93)
        at org.jpmml.xgboost.XGBoostUtil.loadLearner(XGBoostUtil.java:57)
        at xgboost.sklearn.Booster.loadLearner(Booster.java:52)
        at xgboost.sklearn.Booster.getLearner(Booster.java:42)
        at xgboost.sklearn.BoosterUtil.getLearner(BoosterUtil.java:71)
        at xgboost.sklearn.BoosterUtil.getNumberOfFeatures(BoosterUtil.java:39)
        at xgboost.sklearn.XGBClassifier.getNumberOfFeatures(XGBClassifier.java:35)
        at sklearn.StepUtil.checkNumberOfFeatures(StepUtil.java:36)
        at sklearn2pmml.pipeline.PMMLPipeline.encodePMML(PMMLPipeline.java:229)
        at org.jpmml.sklearn.Main.run(Main.java:233)
        at org.jpmml.sklearn.Main.main(Main.java:151)

Exception in thread "main" java.lang.IllegalArgumentException: 1730313018.1919250021
        at org.jpmml.xgboost.Learner.load(Learner.java:81)
        at org.jpmml.xgboost.XGBoostUtil.loadLearner(XGBoostUtil.java:93)
        at org.jpmml.xgboost.XGBoostUtil.loadLearner(XGBoostUtil.java:57)
        at xgboost.sklearn.Booster.loadLearner(Booster.java:52)
        at xgboost.sklearn.Booster.getLearner(Booster.java:42)
        at xgboost.sklearn.BoosterUtil.getLearner(BoosterUtil.java:71)
        at xgboost.sklearn.BoosterUtil.getNumberOfFeatures(BoosterUtil.java:39)
        at xgboost.sklearn.XGBClassifier.getNumberOfFeatures(XGBClassifier.java:35)
        at sklearn.StepUtil.checkNumberOfFeatures(StepUtil.java:36)
        at sklearn2pmml.pipeline.PMMLPipeline.encodePMML(PMMLPipeline.java:229)
        at org.jpmml.sklearn.Main.run(Main.java:233)
        at org.jpmml.sklearn.Main.main(Main.java:151)

ERROR The JPMML-SkLearn conversion application has failed. The Java executable should have printed more information about the failure into its standard output and/or standard error streams
vruusmann commented 3 years ago

I'm well aware that XGBoost changed its default serialization data format from "proprietary binary" to JSON in the 1.3.X development branch.

Please note that XGBoost is still able to produce "proprietary binary" model files. As a quick workaround, you should order XGBoost to use it (instead of JSON).

assafepstein commented 2 years ago

@vruusmann Hey Villu, could you please further elaborate how this issue is resolved? I encounter same issue after bumping from xgboost 1.0 to 1.3 jpmml-sklearn is currently set on 1.5.34 jpmml-xgboost is currently set on 1.3.15

vruusmann commented 2 years ago

@vruusmann Hey Villu, could you please further elaborate how this issue is resolved?

Literally, please see the code commit that closed this issue: https://github.com/jpmml/jpmml-xgboost/commit/d218d954bac834e6cb8ee42c84b186fd078014b7

If you don't think that this commit implemented a proper & full JSON support, then please provide some more technical details about it.

jpmml-sklearn is currently set on 1.5.34

Why not use the latest JPMML-SkLearn 1.7.10? What's the benefit of using seriously outdated software (two years old!), and opening issues about it?

assafepstein commented 2 years ago

@vruusmann

Actually jpmml-xgboost is even older currently set on 1.3.15

I couldn't find anywhere a proper compatibility table of jpmml-xgboost with python's xgboost

vruusmann commented 2 years ago

Actually jpmml-xgboost is even older currently set on 1.3.15

Software archaeology services are available, but it is a paid service. Please contact via e-mail if interested.

vruusmann commented 2 years ago

I couldn't find anywhere a proper compatibility table of jpmml-xgboost with python's xgboost

Very simple: "The latest JPMML(-XGBoost) library version can handle all earlier XGBoost/Python versions"

assafepstein commented 2 years ago

Thanks @vruusmann! , Could you tell if the different jpmml-? adapters are decoupled from each other, allowing usages of different versions for different adapters?

Given current dependencies:

  // A transitive dependency of jpmmlSklearn, which we pin to a higher version to eliminate a vulnerability in version 1.72
  val jcommander = "com.beust" % "jcommander" % "1.75"

  val jpmmlEval      = "org.jpmml" % "pmml-evaluator"           % "1.4.15" exclude("org.slf4j", "slf4j-jdk14")
  val jpmmlEvalExt   = "org.jpmml" % "pmml-evaluator-extension" % "1.4.15" exclude("org.slf4j", "slf4j-jdk14")
  val jpmmlModel     = "org.jpmml" % "pmml-model"               % "1.4.15" exclude("org.slf4j", "slf4j-jdk14")
  val jpmmlSklearn   = List(jcommander,
                        "org.jpmml" % "jpmml-sklearn"           % "1.5.34" exclude("org.slf4j", "slf4j-jdk14"))

Could I simply grab and pin the latest jpmml-xgboost artifact, leaving the others as is or should all be bumped in tandem to the same version?

vruusmann commented 2 years ago

Could you tell if the different jpmml-? adapters are decoupled from each other, allowing usages of different versions for different adapters?

The JPMML family of libraries constitute a rather large graph. I'm not going to re-version the entire graph, when I simply want to implement a minor feature in one of graph's nodes.

For example, if I implement a new piece of functionality into the JPMML-SkLearn library, then there is absolutely no reason to bump JPMML-Model/JPMML-Converter/JPMML-Python library versions.

Given current dependencies:

Your dependencies are all outdated, and don't belong together. I'd be surprised if your Java application didn't suffer from occasional class-loading errors and exceptions.

Please use a proper build/project management tool such as Apache Maven.

Could I simply grab and pin the latest jpmml-xgboost artifact, leaving the others as is or should all be bumped in tandem to the same version?

Throw it all away, and start from a clean page.

Your Java application should have at most two-three JPMML dependencies. One for the evaluator side, and one for the converter side. Keep them at latest versions, and they will include all transitive dependencies automatically.