Git Product home page Git Product logo

Comments (5)

jekbradbury avatar jekbradbury commented on July 17, 2024

It should be possible to do this via pickling (which is also what's called by torch.save), although I think you’ll have to use import dill as pickle because there are lambdas stored as attributes. Let us know if this doesn’t work (I can’t remember off the top of my head but this might be impossible because of difficulty pickling running generator-iterators).

from text.

jekbradbury avatar jekbradbury commented on July 17, 2024

Hmm, because Iterator is an iterable and not an iterator, that object wouldn’t have the state you’d need to pickle here. Try pickling the result of iter() on your iterator and if that's not possible we can potentially introduce a lightweight class implementing the iterator protocol to replace the generator called by iter().

from text.

PetrochukM avatar PetrochukM commented on July 17, 2024

Thank you!

An idea to avoid Pickle to incorporate into the library would be:
Is the ability to set the iteration number of the iterator. Then we'd need to restructure the iterator so it can start at an arbitrary iteration number.

Another option is instead of using an iterator to implement getitem instead. That's the option OpenNMT-py choose. Then provided the same dataset and iteration getitem retrieves the same batch.

from text.

jekbradbury avatar jekbradbury commented on July 17, 2024

Currently Iterator and BucketIterator without shuffling work even for datasets that are only provided as a generator (e.g. infinite synthetic datasets or datasets that are too big to load all at once) and I’d like to keep that.

from text.

jekbradbury avatar jekbradbury commented on July 17, 2024

This should be implemented in #63. Let us know if it doesn't work for you.

from text.

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.