parlai/core/worlds.py
def run(self):
        """Runs normal parley loop for as many examples as this thread can get
        ahold of via the semaphore ``queued_sem``.
        """
        world = self.shared['world_class'](self.opt, None, self.shared)
        if self.opt.get('batchsize', 1) > 1:
            world = BatchWorld(self.opt, world)
        self.sync['threads_sem'].release()
        with world:
            while True:
                if self.sync['term_flag'].value:
                    break  # time to close
                self.sync['queued_sem'].acquire()
                self.sync['threads_sem'].release()
                if not world.epoch_done() or self.opt.get('datatype').startswith('train', False):
                    # do one example if any available
                    world.parley()
                    with self.sync['total_parleys'].get_lock():
                        self.sync['total_parleys'].value += 1
                else:
                    with self.sync['epoch_done_ctr'].get_lock():
                        # increment the number of finished threads
                        self.sync['epoch_done_ctr'].value += 1
                    self.sync['threads_sem'].release()  # send control back to main thread
                    self.sync['queued_sem'].release()  # we didn't process anything
                    self.sync['reset_sem'].acquire()
                    world.reset()
Runs normal parley loop for as many examples as this thread can get
        ahold of via the semaphore ``queued_sem``.
        
Runs normal parley loop for as many examples as this thread can get
ahold of via the semaphore ``queued_sem``.
Runs normal parley loop for as many examples as this thread can get ahold of via the semaphore ` ` queued_sem ` ` .
def run(self):
        world = self.shared['world_class'](self.opt, None, self.shared)
        if self.opt.get('batchsize', 1) > 1:
            world = BatchWorld(self.opt, world)
        self.sync['threads_sem'].release()
        with world:
            while True:
                if self.sync['term_flag'].value:
                    break  
                self.sync['queued_sem'].acquire()
                self.sync['threads_sem'].release()
                if not world.epoch_done() or self.opt.get('datatype').startswith('train', False):
                    world.parley()
                    with self.sync['total_parleys'].get_lock():
                        self.sync['total_parleys'].value += 1
                else:
                    with self.sync['epoch_done_ctr'].get_lock():
                        self.sync['epoch_done_ctr'].value += 1
                    self.sync['threads_sem'].release()  
                    self.sync['queued_sem'].release()  
                    self.sync['reset_sem'].acquire()
                    world.reset()
def run ( self ) : world = self . shared [ 'world_class' ] ( self . opt , None , self . shared ) if self . opt . get ( 'batchsize' , 1 ) > 1 : world = BatchWorld ( self . opt , world ) self . sync [ 'threads_sem' ] . release ( ) with world : while True : if self . sync [ 'term_flag' ] . value : break self . sync [ 'queued_sem' ] . acquire ( ) self . sync [ 'threads_sem' ] . release ( ) if not world . epoch_done ( ) or self . opt . get ( 'datatype' ) . startswith ( 'train' , False ) : world . parley ( ) with self . sync [ 'total_parleys' ] . get_lock ( ) : self . sync [ 'total_parleys' ] . value += 1 else : with self . sync [ 'epoch_done_ctr' ] . get_lock ( ) : self . sync [ 'epoch_done_ctr' ] . value += 1 self . sync [ 'threads_sem' ] . release ( ) self . sync [ 'queued_sem' ] . release ( ) self . sync [ 'reset_sem' ] . acquire ( ) world . reset ( )
Runs normal parley loop for as many examples as this thread can get
ahold of via the semaphore ``queued_sem``.
Runs normal parley loop for as many examples as this thread can get ahold of via the semaphore ` ` queued_sem ` ` .
"""Runs normal parley loop for as many examples as this thread can get
        ahold of via the semaphore ``queued_sem``.
        """ # time to close # do one example if any available # increment the number of finished threads # send control back to main thread # we didn't process anything
self