mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-10 16:22:29 +03:00
Shuffle histories in beam parser
This commit is contained in:
parent
de82552a13
commit
d1511e816a
|
@ -118,6 +118,7 @@ cdef class BeamParser(Parser):
|
||||||
violn.check_crf(pred, gold)
|
violn.check_crf(pred, gold)
|
||||||
min_grad = 0.1 ** (itn+1)
|
min_grad = 0.1 ** (itn+1)
|
||||||
histories = zip(violn.p_probs, violn.p_hist) + zip(violn.g_probs, violn.g_hist)
|
histories = zip(violn.p_probs, violn.p_hist) + zip(violn.g_probs, violn.g_hist)
|
||||||
|
random.shuffle(histories)
|
||||||
for grad, hist in histories:
|
for grad, hist in histories:
|
||||||
assert not math.isnan(grad) and not math.isinf(grad)
|
assert not math.isnan(grad) and not math.isinf(grad)
|
||||||
if abs(grad) >= min_grad:
|
if abs(grad) >= min_grad:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user