mirror of https://github.com/explosion/spaCy.git
Fix error when tagger was initialized with no labels
This commit is contained in:
parent
e1e1760fd6
commit
d3ffe4ca63
|
@ -286,7 +286,10 @@ class Tagger(Pipe):
|
||||||
for tag in sorted(tags):
|
for tag in sorted(tags):
|
||||||
self.add_label(tag)
|
self.add_label(tag)
|
||||||
self.set_output(len(self.labels))
|
self.set_output(len(self.labels))
|
||||||
|
if self.labels:
|
||||||
self.model.initialize(X=doc_sample)
|
self.model.initialize(X=doc_sample)
|
||||||
|
else:
|
||||||
|
self.model.initialize()
|
||||||
if sgd is None:
|
if sgd is None:
|
||||||
sgd = self.create_optimizer()
|
sgd = self.create_optimizer()
|
||||||
return sgd
|
return sgd
|
||||||
|
|
Loading…
Reference in New Issue