Giter Club home page Giter Club logo

Comments (6)

haifeng-jin avatar haifeng-jin commented on May 19, 2024 1

Waiting for triage.
Summary:
When the dataset has a different number of samples from epoch to epoch (the batch size are the same, the number of steps are different), the training will stop at a epoch, whose number of steps is different from the first epoch.

from tf-keras.

chunduriv avatar chunduriv commented on May 19, 2024

@sachinprasadhs, I was able to reproduce the issue on Colab using TF2.7 and tf-nightly(2.8.0-dev20211201). Please find the gist here for reference.Thanks!

from tf-keras.

sachinprasadhs avatar sachinprasadhs commented on May 19, 2024

You can use the solution mentioned here to avoid warning and continue training.

from tf-keras.

shkarupa-alex avatar shkarupa-alex commented on May 19, 2024

I know a workaround, but that is very ugly:

  • measure dataset length by hands (i use bucketing, so len(dataset) is None and measuring length in my case takes around 30 min)
  • dataset = dataset.repeat(2).take(measured_len)

This is a bad solution. In my opinion model should continue training until reaches num_epochs even if some epoch has less batches then first one.
Displaying the number of steps remaining within an epoch is not as important as the completion of all epochs.

from tf-keras.

rchao avatar rchao commented on May 19, 2024

Thanks for reporting the issue - one solution is to use a steps_per_epoch that's large enough for the number of data in all epochs, and have the termination of an epoch rely on exhaustion of data (OutOfRangeError). Can you check if this works?

from tf-keras.

shkarupa-alex avatar shkarupa-alex commented on May 19, 2024

Got same issue when implementing word2vec model. Dataset size changes from epoch to epoch due to:

  • randomness in skipgram/cbow context size
  • randomness in downsampling with threshold

Single estimation number of batches takes around 4 hours (very large dataset).
And this size can changes with +- 20% from epoch to epoch.

So setting steps_per_epoch is not a good option.
It would be great if keras.Model will always look at OutOfRangeError itself.

from tf-keras.

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.