Avoid assuming encode.get_dim('nO') is set in tok2vec (#6800)

This commit is contained in:
Matthew Honnibal 2021-01-24 14:37:33 +11:00 committed by GitHub
parent 0a86d833d7
commit ffc371350a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -101,6 +101,7 @@ def build_Tok2Vec_model(
embeddings, using an architecture such as a CNN, BiLSTM or transformer.
"""
tok2vec = chain(embed, encode)
if encode.has_dim("nO"):
tok2vec.set_dim("nO", encode.get_dim("nO"))
tok2vec.set_ref("embed", embed)
tok2vec.set_ref("encode", encode)