mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-11 00:50:33 +03:00
Restore random cuts in parser/ner training
This commit is contained in:
parent
9e3695de6b
commit
ae58d00327
|
@ -272,7 +272,13 @@ cdef class Parser:
|
||||||
# Prepare the stepwise model, and get the callback for finishing the batch
|
# Prepare the stepwise model, and get the callback for finishing the batch
|
||||||
model, backprop_tok2vec = self.model.begin_update(
|
model, backprop_tok2vec = self.model.begin_update(
|
||||||
[eg.predicted for eg in examples])
|
[eg.predicted for eg in examples])
|
||||||
states, golds, max_steps = self._init_gold_batch(examples)
|
# Chop sequences into lengths of this many transitions, to make the
|
||||||
|
# batch uniform length. We randomize this to overfit less.
|
||||||
|
cut_gold = numpy.random.choice(range(20, 100))
|
||||||
|
states, golds, max_steps = self._init_gold_batch(
|
||||||
|
examples,
|
||||||
|
max_length=cut_gold
|
||||||
|
)
|
||||||
all_states = list(states)
|
all_states = list(states)
|
||||||
states_golds = zip(states, golds)
|
states_golds = zip(states, golds)
|
||||||
for _ in range(max_steps):
|
for _ in range(max_steps):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user