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):
|
||||
self.add_label(tag)
|
||||
self.set_output(len(self.labels))
|
||||
self.model.initialize(X=doc_sample)
|
||||
if self.labels:
|
||||
self.model.initialize(X=doc_sample)
|
||||
else:
|
||||
self.model.initialize()
|
||||
if sgd is None:
|
||||
sgd = self.create_optimizer()
|
||||
return sgd
|
||||
|
|
Loading…
Reference in New Issue