Allow tagger models to be built with pre-defined tok2vec layer
@@ -512,6 +512,9 @@ def build_tagger_model(nr_class, **cfg):
token_vector_width = util.env_opt('token_vector_width', 128)
pretrained_dims = cfg.get('pretrained_dims', 0)
with Model.define_operators({'>>': chain, '+': add}):
+ if 'tok2vec' in cfg:
+ tok2vec = cfg['tok2vec']
+ else:
tok2vec = Tok2Vec(token_vector_width, embed_size,
pretrained_dims=pretrained_dims)
model = (
