Dont randomize cuts in parser

This commit is contained in:
Matthw Honnibal 2020-07-06 17:51:25 +02:00
parent 709fc5e4ad
commit f25761e513
1 changed files with 3 additions and 2 deletions

View File

@ -280,11 +280,12 @@ cdef class Parser:
[eg.predicted for eg in examples]) [eg.predicted for eg in examples])
if self.cfg["update_with_oracle_cut_size"] >= 1: if self.cfg["update_with_oracle_cut_size"] >= 1:
# Chop sequences into lengths of this many transitions, to make the # Chop sequences into lengths of this many transitions, to make the
# batch uniform length. We randomize this to overfit less. # batch uniform length.
# We used to randomize this, but it's not clear that actually helps?
cut_size = self.cfg["update_with_oracle_cut_size"] cut_size = self.cfg["update_with_oracle_cut_size"]
states, golds, max_steps = self._init_gold_batch( states, golds, max_steps = self._init_gold_batch(
examples, examples,
max_length=numpy.random.choice(range(5, cut_size)) max_length=cut_size
) )
else: else:
states, golds, _ = self.moves.init_gold_batch(examples) states, golds, _ = self.moves.init_gold_batch(examples)