From 1c5c256e5882d58b53050eb8f1ba1f3741c3c955 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Wed, 23 Aug 2017 10:51:33 +0200 Subject: [PATCH] Fix fine_tune when optimizer is None --- spacy/_ml.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spacy/_ml.py b/spacy/_ml.py index e2e0d070b..ee2d0835c 100644 --- a/spacy/_ml.py +++ b/spacy/_ml.py @@ -382,7 +382,8 @@ def fine_tune(embedding, combine=None): model.d_mix[1] += flat_vecs.dot(flat_grad.T).sum() bp_vecs([d_o * model.mix[1] for d_o in d_output], sgd=sgd) - sgd(model._mem.weights, model._mem.gradient, key=model.id) + if sgd is not None: + sgd(model._mem.weights, model._mem.gradient, key=model.id) return [d_o * model.mix[0] for d_o in d_output] return output, fine_tune_bwd