Giter Club home page Giter Club logo

Comments (4)

LaurentMazare avatar LaurentMazare commented on June 17, 2024

I'm not sure to understand what you mean by "saving and loading a model". Is it about serializing the weights or the full model architecture. Both are somehow supported, to save load tensors you can find a bunch of examples in the codebase, e.g. here for tensor serialization. Models typically store their weights in a Var_store.t and these get serialized through the same api, e.g. here. Finally see this tutorial for the full model via the jit layer.

For converting list/array to tensors, there are a bunch function doing so, maybe have a look at the tests in this file to get a feeling of what is available.

from ocaml-torch.

ChrisRawstone avatar ChrisRawstone commented on June 17, 2024

This what exactly what I meant. But for the saving and loading a model. Your example shows you loading a python torch trained model. My project has to be done solely in ocaml. Is this library capable of saving a model and loading a model using only ocaml?

I guess what I am looking for It pretty well demonstrated by this tensorflow (I know we are using torch;) )
image

https://keras.io/guides/serialization_and_saving/

from ocaml-torch.

LaurentMazare avatar LaurentMazare commented on June 17, 2024

You can save all the tensor values saved in a Var_store.t and load them, all this via the Serialized api (see the yolo example from my previous message for loading the weights, writing them is similar). Note that there is no way to serialize the model architecture so the yolo code generates the model then load the weights - but if your code is fully in ocaml this should not be an issue.

from ocaml-torch.

ChrisRawstone avatar ChrisRawstone commented on June 17, 2024

Thank you for your very detailed responses. Using your responses I was able to do everything in your library that I needed for my project. Hopefully these discussions will be able to help others.

from ocaml-torch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.