Search code examples
h2o

Possible to set file name for h2o.save_model() (rather then simply use the model_id value)?


Trying to save an h2o model with some specific name that differs from the model's model_id field, but trying something like...

h2o.save_model(model=model,
               path='/some/path/then/filename',
               force=False)

just creates a dir/file structure like

some
   |__path
         |__then
              |__filename
                        |__<model_id>

as opposed to

some
   |__path
         |__then
              |__filename

Is this possible to do from the save_model method?

I can't / hesitate to simply change the model_id before calling the save method because the model names have timestamps appended to them to avoid name collisions with other models that may be on the h2o cluster (am trying to remove these timestamps when saving on disk and simplifying the name on the cluster before saving creates a time where naming collision can occur if other processes are also attempting to save such a model (of, say, a different timestamp)).

Any way to get this behavior or other common alternatives / workarounds?


Solution

  • This is currently not possible, however I created a feature request here. There is a related question here which shows a solution for R (could be adapted to Python). The work-around is just to rename the file manually using a few lines of R/Python code.