h2o mojo保存和加载问题

时间:2019-05-13 21:18:33

标签: r deployment save h2o mojo

我正在使用H2O统计套件的R版本,并且正在尝试使用mojo保存和加载模型。我使用h2o.saveMojo(object = h2o_gbm_model,path = "./models/", force = TRUE)保存了受过训练的gbm,使用h2o.loadModel加载时收到以下错误:

ERROR: Unexpected HTTP Status code: 400 Bad Request (url = http://localhost:54321/99/Models.bin/)

java.lang.IllegalArgumentException
 [1] "java.lang.IllegalArgumentException: Missing magic number 0x1CED at stream start"                             
 [2] "    water.AutoBuffer.<init>(AutoBuffer.java:269)"                                                            
 [3] "    hex.Model.importBinaryModel(Model.java:2477)"                                                            
 [4] "    water.api.ModelsHandler.importModel(ModelsHandler.java:209)"                                             
 [5] "    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)"                                             
 [6] "    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)"                           
 [7] "    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"                   
 [8] "    java.lang.reflect.Method.invoke(Method.java:498)"                                                        
 [9] "    water.api.Handler.handle(Handler.java:60)"                                                               
[10] "    water.api.RequestServer.serve(RequestServer.java:483)"                                                   
[11] "    water.api.RequestServer.doGeneric(RequestServer.java:327)"                                               
[12] "    water.api.RequestServer.doPost(RequestServer.java:253)"                                                  
[13] "    javax.servlet.http.HttpServlet.service(HttpServlet.java:755)"                                            
[14] "    javax.servlet.http.HttpServlet.service(HttpServlet.java:848)"                                            
[15] "    org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)"                                  
[16] "    org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)"                              
[17] "    org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)"                      
[18] "    org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:427)"                               
[19] "    org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)"                       
[20] "    org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)"                           
[21] "    org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)"                   
[22] "    org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)"                         
[23] "    water.webserver.jetty8.Jetty8ServerAdapter$LoginHandler.handle(Jetty8ServerAdapter.java:119)"            
[24] "    org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)"                   
[25] "    org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)"                         
[26] "    org.eclipse.jetty.server.Server.handle(Server.java:370)"                                                 
[27] "    org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)"          
[28] "    org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)"           
[29] "    org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:984)"                
[30] "    org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1045)"
[31] "    org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:861)"                                        
[32] "    org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:236)"                                   
[33] "    org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)"                  
[34] "    org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)"            
[35] "    org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)"                        
[36] "    org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)"                         
[37] "    java.lang.Thread.run(Thread.java:745)"                                                                   

Error in .h2o.doSafeREST(h2oRestApiVersion = h2oRestApiVersion, urlSuffix = page,  : 


ERROR MESSAGE:

Missing magic number 0x1CED at stream start

此外,我的会话信息如下:

> sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=Italian_Italy.1252  LC_CTYPE=Italian_Italy.1252    LC_MONETARY=Italian_Italy.1252
[4] LC_NUMERIC=C                   LC_TIME=Italian_Italy.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] caret_6.0-84       lattice_0.20-38    ModelMetrics_1.2.2 h2o_3.24.0.3       data.table_1.12.2  dtplyr_0.0.3      
 [7] forcats_0.4.0      stringr_1.4.0      dplyr_0.8.0.1      purrr_0.3.2        readr_1.3.1        tidyr_0.8.3       
[13] tibble_2.1.1       ggplot2_3.1.1      tidyverse_1.2.1   

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.1         lubridate_1.7.4    class_7.3-15       digest_0.6.18      assertthat_0.2.1   packrat_0.5.0     
 [7] ipred_0.9-9        foreach_1.4.4      R6_2.4.0           cellranger_1.1.0   plyr_1.8.4         backports_1.1.4   
[13] stats4_3.5.3       httr_1.4.0         pillar_1.4.0       rlang_0.3.4        lazyeval_0.2.2     readxl_1.3.1      
[19] rstudioapi_0.10    rpart_4.1-15       Matrix_1.2-17      labeling_0.3       splines_3.5.3      gower_0.2.0       
[25] RCurl_1.95-4.12    munsell_0.5.0      broom_0.5.2        compiler_3.5.3     modelr_0.1.4       pkgconfig_2.0.2   
[31] nnet_7.3-12        tidyselect_0.2.5   prodlim_2018.04.18 codetools_0.2-16   crayon_1.3.4       withr_2.1.2       
[37] MASS_7.3-51.3      bitops_1.0-6       recipes_0.1.5      grid_3.5.3         nlme_3.1-137       jsonlite_1.6      
[43] gtable_0.3.0       magrittr_1.5       scales_1.0.0       cli_1.1.0          stringi_1.4.3      reshape2_1.4.3    
[49] timeDate_3043.102  xml2_1.2.0         generics_0.0.2     lava_1.6.5         iterators_1.0.10   tools_3.5.3       
[55] glue_1.3.1         hms_0.4.2          parallel_3.5.3     survival_2.44-1.1  colorspace_1.4-1   rvest_0.3.3       
[61] haven_2.1.0       

0 个答案:

没有答案