mirror of https://github.com/explosion/spaCy.git
Only train one task per iter, holding grads
This commit is contained in:
parent
b27c587800
commit
8500d9b1da
|
@ -222,8 +222,9 @@ class Language(object):
|
||||||
continue
|
continue
|
||||||
tokvecses, bp_tokvecses = tok2vec.model.begin_update(feats, drop=drop)
|
tokvecses, bp_tokvecses = tok2vec.model.begin_update(feats, drop=drop)
|
||||||
d_tokvecses = proc.update((docs, tokvecses), golds,
|
d_tokvecses = proc.update((docs, tokvecses), golds,
|
||||||
drop=drop, sgd=sgd, losses=losses)
|
drop=drop, sgd=get_grads, losses=losses)
|
||||||
bp_tokvecses(d_tokvecses, sgd=sgd)
|
bp_tokvecses(d_tokvecses, sgd=get_grads)
|
||||||
|
break
|
||||||
for key, (W, dW) in grads.items():
|
for key, (W, dW) in grads.items():
|
||||||
sgd(W, dW, key=key)
|
sgd(W, dW, key=key)
|
||||||
# Clear the tensor variable, to free GPU memory.
|
# Clear the tensor variable, to free GPU memory.
|
||||||
|
|
Loading…
Reference in New Issue