From 67c82dbea94db5afc80702808ffba2dd8dca00c8 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 25 Jun 2020 03:44:12 +0200 Subject: [PATCH] Return examples from init_gold_batch --- spacy/syntax/nn_parser.pyx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spacy/syntax/nn_parser.pyx b/spacy/syntax/nn_parser.pyx index 582add021..589c5efcf 100644 --- a/spacy/syntax/nn_parser.pyx +++ b/spacy/syntax/nn_parser.pyx @@ -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)