make EntityLinker robust for nO=None (#7930)

This commit is contained in:
Sofie Van Landeghem 2021-05-06 10:14:47 +02:00 committed by GitHub
parent 66bfabd839
commit e9037d8fc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,7 @@ from ...vocab import Vocab
@registry.architectures("spacy.EntityLinker.v1")
def build_nel_encoder(tok2vec: Model, nO: Optional[int] = None) -> Model:
with Model.define_operators({">>": chain, "**": clone}):
token_width = tok2vec.get_dim("nO")
token_width = tok2vec.maybe_get_dim("nO")
output_layer = Linear(nO=nO, nI=token_width)
model = (
tok2vec