mirror of
https://github.com/explosion/spaCy.git
synced 2025-08-04 04:10:20 +03:00
Change model structure to accept trf input
This commit is contained in:
parent
872bda2f14
commit
ba62f7eed9
|
@ -37,12 +37,13 @@ def build_lemmatizer_model(
|
||||||
softmax = Softmax_v2(
|
softmax = Softmax_v2(
|
||||||
nO, t2v_width, init_W=glorot_uniform_init, normalize_outputs=normalize
|
nO, t2v_width, init_W=glorot_uniform_init, normalize_outputs=normalize
|
||||||
)
|
)
|
||||||
model = tok2vec >> with_array(softmax)
|
|
||||||
if lowercasing:
|
if lowercasing:
|
||||||
lowercasing_output = Sigmoid(1)
|
lowercasing_output = Sigmoid(1)
|
||||||
sigmoid_appendage = (
|
sigmoid_appendage = (
|
||||||
Relu(lowercasing_relu_width) >> Dropout() >> lowercasing_output
|
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)
|
model.set_ref("lowercasing_output", lowercasing_output)
|
||||||
|
else:
|
||||||
|
model = tok2vec >> with_array(softmax)
|
||||||
return model
|
return model
|
||||||
|
|
Loading…
Reference in New Issue
Block a user