You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
_worker_loop and _job_producer say that the job_queue element is a (list of object, dict of (str, int)) type, when in fact it appears to be a (list of object, float) type.
Is this a statement for a future change, or is it a mistake?
def_job_producer(self, data_iterator, job_queue, cur_epoch=0, total_examples=None, total_words=None):
...
next_job_params=self._get_job_params(cur_epoch)
job_no=0fordata_idx, datainenumerate(data_iterator):
data_length=self._raw_word_count([data])
# can we fit this sentence into the existing job batch?ifbatch_size+data_length<=self.batch_words:
# yes => add it to the current jobjob_batch.append(data)
batch_size+=data_lengthelse:
job_no+=1job_queue.put((job_batch, next_job_params))
In _get_job_params
def_get_job_params(self, cur_epoch):
"""Get the learning rate used in the current epoch. Parameters ---------- cur_epoch : int Current iteration through the corpus Returns ------- float The learning rate for this epoch (it is linearly reduced with epochs from `self.alpha` to `self.min_alpha`). """alpha=self.alpha- ((self.alpha-self.min_alpha) *float(cur_epoch) /self.epochs)
returnalpha
Looks like a mistake to me – maybe a remnant of some prior implementation. (And, if _get_job_params() in practice just returns a floating-point learning-rate, it's got a bad name that suggests it's more than that.)
Sure! Unless there's some other reason for _get_job_params() to remain generically-named like that (as a search for other uses/calls/implementations might reveal), a patch could give it a better name, in addition to ensuring the comments accurately describe the current code.
Problem description
_worker_loop
and_job_producer
say that thejob_queue
element is a(list of object, dict of (str, int))
type, when in fact it appears to be a(list of object, float)
type.Is this a statement for a future change, or is it a mistake?
Steps/code/corpus to reproduce
but
In
_get_job_params
Versions
The text was updated successfully, but these errors were encountered: