Skip to content

Saving and Loading a model #28

Description

@Cliff-Foreman

Hi everyone, I had a quick question about how I can save and load a model. When I try using

 model.save_weights("model.h5");

the model is not saved anywhere.

Activity

  1. lostmsu commented on Mar 20, 2020

    @lostmsu
    Contributor

    The model should be saved to the current directory, e.g. Environment.CurrentDirectory

  2. Cliff-Foreman commented on Mar 20, 2020

    @Cliff-Foreman
    Author

    Ah, I found it. Thanks. Now, when I'm trying to load the model, I'm doing:

    var model = new Sequential();
    model.load_weights("model.h5");
    

    Is this the right way to do it?

  3. lostmsu commented on Mar 20, 2020

    @lostmsu
    Contributor

    @Cliff-Foreman you need to reproduce model structure first. E.g. pass all layers as you did for training.

    If you want layers to be restored too, you need to refer to official TensorFlow documentation. https://www.tensorflow.org/tutorials/keras/save_and_load

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions