Akshay Kadidal
Akshay Kadidal

Reputation: 535

How to find H2O model version

I have two H2O models (which are saved through h2o.savemodel in R-3.x.x). How do I find out which version of H2O was the model built on?

I am unable to load one of them with the latest version of H2O.

>model3 <- h2o.loadModel(pcaModelFileName)

ERROR: Unexpected HTTP Status code: 412 Precondition Failed (url = http://localhost:54321/99/Models.bin/)

water.exceptions.H2OIllegalArgumentException
 [1] "water.exceptions.H2OIllegalArgumentException: Illegal argument: dir of function: importModel: PCA_model_R_1538682208857_7"
 [2] "    water.api.ModelsHandler.importModel(ModelsHandler.java:212)"                                                          
 [3] "    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)"                                                          
 [4] "    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)"                                        
 [5] "    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"                                
 [6] "    java.lang.reflect.Method.invoke(Method.java:498)"                                                                     
 [7] "    water.api.Handler.handle(Handler.java:63)"                                                                            
 [8] "    water.api.RequestServer.serve(RequestServer.java:451)"                                                                
 [9] "    water.api.RequestServer.doGeneric(RequestServer.java:296)"                                                            
[10] "    water.api.RequestServer.doPost(RequestServer.java:222)"                                                               
[11] "    javax.servlet.http.HttpServlet.service(HttpServlet.java:755)"                                                         
[12] "    javax.servlet.http.HttpServlet.service(HttpServlet.java:848)"                                                         
[13] "    org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)"                                               
[14] "    org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)"                                           
[15] "    org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)"                                   
[16] "    org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)"                                            
[17] "    org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)"                                    
[18] "    org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)"                                        
[19] "    org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)"                                
[20] "    org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)"                                      
[21] "    water.JettyHTTPD$LoginHandler.handle(JettyHTTPD.java:197)"                                                            
[22] "    org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)"                                
[23] "    org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)"                                      
[24] "    org.eclipse.jetty.server.Server.handle(Server.java:370)"                                                              
[25] "    org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)"                       
[26] "    org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)"                        
[27] "    org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)"                             
[28] "    org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)"             
[29] "    org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)"                                                     
[30] "    org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)"                                                
[31] "    org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)"                               
[32] "    org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)"                         
[33] "    org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)"                                     
[34] "    org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)"                                      
[35] "    java.lang.Thread.run(Thread.java:748)"                                                                                

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


ERROR MESSAGE:

Illegal argument: dir of function: importModel: PCA_model_R_1538682208857_7

A similar error has been reported and it was said it was a problem with the version but my question is 1. Is this related to version 2. Is there a way to find out which H2o version the model was built on 3. Is there a way, within R, to port models from one version to another. (I potentially have two H2O models built on two different versions.

Using Mojo or Pojo may not be an option since I don't have the data/script needed to rebuild the model.

Upvotes: 0

Views: 2190

Answers (1)

Lauren
Lauren

Reputation: 5778

It looks like the error is related to a version miss match, since it is complaining about an illegal argument.

a quick way to see the model's corresponding h2o version number (if you used h2o.saveModel() to save the model) is to open the model's file - you should be able to see the version number within the first line (in the form 3.10.4.2).

Also you might get a version mismatch error, which would tell you what version you are trying to use versus what version you are currently using.

There isn't a way within in R to port models from one version to another. From the documentation:

Note: When saving an H2O binary model with h2o.saveModel (R), h2o.save_model (Python), or in Flow, you will only be able to load and use that saved binary model with the same version of H2O that you used to train your model. H2O binary models are not compatible across H2O versions. If you update your H2O version, then you will need to retrain your model. For production, you can save your model as a POJO/MOJO. These artifacts are not tied to a particular version of H2O because they are just plain Java code and do not require an H2O cluster to be running.

Upvotes: 0

Related Questions