Only train one task per iter, holding grads

This commit is contained in:
Matthew Honnibal 2017-05-25 06:47:42 -05:00
parent b27c587800
commit 8500d9b1da
1 changed files with 3 additions and 2 deletions

View File

@ -222,8 +222,9 @@ class Language(object):
continue
tokvecses, bp_tokvecses = tok2vec.model.begin_update(feats, drop=drop)
d_tokvecses = proc.update((docs, tokvecses), golds,
drop=drop, sgd=sgd, losses=losses)
bp_tokvecses(d_tokvecses, sgd=sgd)
drop=drop, sgd=get_grads, losses=losses)
bp_tokvecses(d_tokvecses, sgd=get_grads)
break
for key, (W, dW) in grads.items():
sgd(W, dW, key=key)
# Clear the tensor variable, to free GPU memory.