Return examples from init_gold_batch

This commit is contained in:
Matthew Honnibal 2020-06-25 03:44:12 +02:00
parent 4925c0be34
commit 67c82dbea9

View File

@ -272,7 +272,7 @@ cdef class Parser:
# Prepare the stepwise model, and get the callback for finishing the batch
model, backprop_tok2vec = self.model.begin_update(
[eg.predicted for eg in examples])
states, golds, max_steps = self.moves.init_gold_batch(examples)
states, golds, examples, max_steps = self.moves.init_gold_batch(examples)
all_states = list(states)
states_golds = zip(states, golds)
for _ in range(max_steps):
@ -285,6 +285,7 @@ cdef class Parser:
# Follow the predicted action
self.transition_states(states, scores)
states_golds = [(s, g) for (s, g) in zip(states, golds) if not s.is_final()]
backprop_tok2vec(golds)
if sgd not in (None, False):
self.model.finish_update(sgd)