从加载模型预测| DistributedException

时间:2018-01-22 06:25:24

标签: python h2o

可能有一个明显的解决方案,因为我们是H2O平台的新手,尽管我们无法找到任何确凿的信息。

我们通过Python保存我们的(H2O-XGBoost)模型:

h2o.save_model(model=model, path=/path/to/our/models, force=True)

然后加载我们的模型(如果重要的话,干净地启动服务器后加载):

model = h2o.load_model("/path/to/our/models/modelname")

从这里开始,模型看起来很好,并且在Flow UI中加载。

我们加载预测框架:

pf = h2o.H2OFrame(python_obj=data_list, destination_frame='PREDICTION_FRAME', header=-1)

我们尝试对刚加载的预测帧进行预测:

model.predict(pf)

错误消息(Flow UI和Python中的结果相同):

ERROR MESSAGE:

DistributedException from /127.0.0.1:54321: 'null'

 (water.util.DistributedException)
  DistributedException from /127.0.0.1:54321: 'null', caused by java.lang.NullPointerException
      water.MRTask.getResult(MRTask.java:478)
      water.MRTask.getResult(MRTask.java:486)
      water.MRTask.doAll(MRTask.java:390)
      water.MRTask.doAll(MRTask.java:396)
      hex.Model.predictScoreImpl(Model.java:1280)
      hex.Model.score(Model.java:1145)
      water.api.ModelMetricsHandler.predict(ModelMetricsHandler.java:420)
      sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      java.lang.reflect.Method.invoke(Method.java:498)
      water.api.Handler.handle(Handler.java:63)
      water.api.RequestServer.serve(RequestServer.java:451)
      water.api.RequestServer.doGeneric(RequestServer.java:296)
      water.api.RequestServer.doPost(RequestServer.java:222)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
      org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
      org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
      org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
      org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
      org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
      org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
      org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
      org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
  Caused by:java.lang.NullPointerException
      hex.tree.xgboost.XGBoostModel.score0(XGBoostModel.java:462)
      hex.Model.score0(Model.java:1432)
      hex.Model$BigScore.map(Model.java:1377)
      water.MRTask.compute2(MRTask.java:657)
      water.H2O$H2OCountedCompleter.compute1(H2O.java:1266)
      hex.Model$BigScore$Icer.compute1(Model$BigScore$Icer.java)
      water.H2O$H2OCountedCompleter.compute(H2O.java:1262)
      jsr166y.CountedCompleter.exec(CountedCompleter.java:468)
      jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:263)
      jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974)
      jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1477)
      jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

如果我们不加载已保存的模型并且只是动态构建它,则预测可以在同一预测帧上正常工作。所以,它似乎与使用保存的模型有关。

我最初的想法是用于训练的框架和有问题的模型的验证需要存在,所以我导出了它们并将它们与保存的模型一起导入,但收到了同样的错误。

一些相关信息:

python --version
Python 2.7.12

H2O Build git branch    master
H2O Build git hash  7cb70c6a5909257868f72f87da27c07670837f09
H2O Build git describe  jenkins-master-4171-1-g7cb70c6-dirty
H2O Build project version   3.17.0.99999
H2O Build age   8 days
H2O Built by    root
H2O Built on    2018-01-13 13:26:13
H2O Internal Security   Disabled
Flow version    0.7.12

getCloud
56ms    
H2O_from_python_root_e9226d
CLOUD STATUS
HEALTHY CONSENSUS LOCKED
Version Started Nodes (Used / All)
3.17.0.99999    a few seconds ago   1 / 1
NODES
Show advanced
    Name    Ping    Cores   Load    My CPU %    Sys CPU %   GFLOPS  Memory Bandwidth    Data (Used/Total)   Data (% Cached) GC (Free / Total / Max) Disk (Free / Max)   Disk (% Free)
127.0.0.1:54321 a few seconds ago   24  0.080   5   5   NaN - / s   - / NaN undefined   NaN%    17.76 GB / NaN undefined / 17.78 GB 53.26 GB / 109.88 GB    48%
TOTAL   -   24  0.080   -   -   NaN - / s   - / NaN undefined   NaN%    17.76 GB / NaN undefined / 17.78 GB 53.26 GB / 109.88 GB    48%

非常感谢任何建议或指导。

1 个答案:

答案 0 :(得分:0)

这是一个{H}中带有XGBoost模型的known bug,目前计划在H2O的下一个主要版本中修复,v3.18(已经有pull requestWindows Search Service固定)。它不会影响H2O中的任何其他类型的模型。