Change model structure to accept trf input

This commit is contained in:
richardpaulhudson 2023-01-25 11:36:33 +01:00
parent 872bda2f14
commit ba62f7eed9

View File

@ -37,12 +37,13 @@ def build_lemmatizer_model(
softmax = Softmax_v2(
nO, t2v_width, init_W=glorot_uniform_init, normalize_outputs=normalize
)
model = tok2vec >> with_array(softmax)
if lowercasing:
lowercasing_output = Sigmoid(1)
sigmoid_appendage = (
Relu(lowercasing_relu_width) >> Dropout() >> lowercasing_output
)
model |= tok2vec >> with_array(sigmoid_appendage)
model = tok2vec >> with_array(softmax | sigmoid_appendage)
model.set_ref("lowercasing_output", lowercasing_output)
else:
model = tok2vec >> with_array(softmax)
return model