Giter Site home page Giter Site logo

StopIteration about adamwr HOT 7 CLOSED

reborm avatar reborm commented on June 14, 2024
StopIteration

from adamwr.

Comments (7)

mpyrozhok avatar mpyrozhok commented on June 14, 2024

What is your batch size and how many samples do you have per epoch?

from adamwr.

reborm avatar reborm commented on June 14, 2024

OK, I figured it out. The bug happened in other place in my project. Thank you

from adamwr.

paulcx avatar paulcx commented on June 14, 2024

@mpyrozhok @reborm I have same error with "StopIteration" at same place. batch_size is 140 and 20580 samples each epoch
Any idea?

from adamwr.

mpyrozhok avatar mpyrozhok commented on June 14, 2024

@paulcx This can happen when you use some batch size and epoch size values while initializing scheduler and then supplying different values to your dataloader, or any other object that splits your epoch into batches and drives your training loop. You're trying to call scheduler more times per epoch than it is possible with batch size and epoch size values that you've supplied. times = samples_per_epoch // batch_size

from adamwr.

enzoampil avatar enzoampil commented on June 14, 2024

does it have to be exactly equal to this number? Can it be less?

from adamwr.

enzoampil avatar enzoampil commented on June 14, 2024

getting a new error:


TypeError Traceback (most recent call last)
in ()
1 training(model=model, epoch=20, eval_every=500,
2 loss_func=loss_function, optimizer=optimizer, train_iter=train_iter,
----> 3 val_iter=val_iter, scheduler=scheduler, warmup_epoch=3, early_stop=2)

in training(epoch, model, eval_every, loss_func, optimizer, train_iter, val_iter, scheduler, early_stop, warmup_epoch)
11
12 for e in range(epoch):
---> 13 scheduler.step()
14 #optimizer = exp_lr_scheduler(optimizer, e) #Added this line for learning rate decay
15 if e >= warmup_epoch:

in step(self)
270 self.last_epoch += 1
271 self.t_epoch += 1
--> 272 self._set_batch_size()
273 self.batch_step()
274

in _set_batch_size(self)
265 d, r = divmod(self.epoch_size, self.batch_size)
266 batches_in_epoch = d + 2 if r > 0 else d + 1
--> 267 self.batch_increment = iter(torch.linspace(0, 1, batches_in_epoch))
268
269 def step(self):

TypeError: 'generator' object is not callable

from adamwr.

mpyrozhok avatar mpyrozhok commented on June 14, 2024

@enzoampil

does it have to be exactly equal to this number? Can it be less?

It will be a different scheduler then, probably. Could you elaborate on why do you need it to be less? And which parameters do you use while creating the scheduler? A brief explanation of your intentions and thoughts would also be helpful.

from adamwr.

Related Issues (8)

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.