Dont return Example from init_gold_batch

This commit is contained in:
Matthew Honnibal 2020-06-25 03:55:59 +02:00
parent 67c82dbea9
commit ae7041f182
3 changed files with 3 additions and 4 deletions

View File

@ -581,12 +581,11 @@ cdef class ArcEager(TransitionSystem):
keeps = [i for i, (eg, s) in enumerate(zip(examples, states))
if self.has_gold(eg) and not s.is_final()]
golds = [ArcEagerGold(self, states[i], examples[i]) for i in keeps]
examples = [examples[i] for i in keeps]
states = [states[i] for i in keeps]
for gold in golds:
self._replace_unseen_labels(gold)
n_steps = sum([len(s.queue) * 4 for s in states])
return states, golds, examples, n_steps
return states, golds, n_steps
def _replace_unseen_labels(self, ArcEagerGold gold):
backoff_label = self.strings["dep"]

View File

@ -136,7 +136,7 @@ cdef class BiluoPushDown(TransitionSystem):
golds = [BiluoGold(self, states[i], examples[i]) for i in keeps]
states = [states[i] for i in keeps]
n_steps = sum([len(s.queue) for s in states])
return states, golds, examples, n_steps
return states, golds, n_steps
cdef Transition lookup_transition(self, object name) except *:
cdef attr_t label

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, examples, max_steps = self.moves.init_gold_batch(examples)
states, golds, max_steps = self.moves.init_gold_batch(examples)
all_states = list(states)
states_golds = zip(states, golds)
for _ in range(max_steps):