GithubHelp home page GithubHelp logo

Comments (2)

Szubie avatar Szubie commented on May 9, 2024

Thanks for reporting this.

I will look into making Ivis models serializable using pickle, is sounds like a useful feature if we can do it. Hopefully that will solve the issues you're encountering.

from ivis.

imatheussm avatar imatheussm commented on May 9, 2024

I was coding a solution here, which consisted in renaming the currently defined Ivis.__getstate__() to Ivis._get_json() and creating new Ivis.__getstate__() and Ivis.__setstate__() methods. The solution consisted in the following:

  • In Ivis.__getstate__(), the internal dictionary state would be obtained. However, for the encoder_, model_, neighbour_matrix_, and supervised_model_ attributes, the following procedure would be adopted: .save() would be called for each of them, generating a annoy.index file for neighbour_matrix_ and .h5 files for the rest. Then, using the built-in base64 module, these files would be encoded into a Base64 string, which would be attributed to the respective parameters.
  • In Ivis.__setstate__(), the same four parameters described above would be checked. If present, base64 would be used to decode them into the binary files they originally were. Then, they would be used to load the original parameters back into their respective attributes.

However, I stumbled in a problem: when calling Ivis.neighbour_matrix_.save(<path>), or even Ivis.neighbour_matrix_.index.save(<path>), no file was produced, regardless of path type (absolute or relative) or file name. I am currently assuming this is an annoy-related issue.

I am just posting this in case this reasoning is helpful to you.

from ivis.

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.