mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 01:16:28 +03:00
Remove F841 [ci skip]
This commit is contained in:
parent
8283df80e9
commit
f91e9e8c84
|
@ -80,13 +80,13 @@ def _get_transition_table(
|
|||
B_start, B_end = (0, n_labels)
|
||||
I_start, I_end = (B_end, B_end + n_labels)
|
||||
L_start, L_end = (I_end, I_end + n_labels)
|
||||
U_start, U_end = (L_end, L_end + n_labels) # noqa: F841
|
||||
U_start, U_end = (L_end, L_end + n_labels)
|
||||
# Using ranges allows us to set specific cells, which is necessary to express
|
||||
# that only actions of the same label are valid continuations.
|
||||
B_range = numpy.arange(B_start, B_end)
|
||||
I_range = numpy.arange(I_start, I_end)
|
||||
L_range = numpy.arange(L_start, L_end)
|
||||
O_action = U_end # noqa: F841
|
||||
O_action = U_end
|
||||
# If this is the last token and the previous action was B or I, only L
|
||||
# of that label is valid
|
||||
table[1, B_range, L_range] = 1
|
||||
|
|
|
@ -38,7 +38,7 @@ def forward(model, X, is_train):
|
|||
|
||||
|
||||
def init(model, X=None, Y=None):
|
||||
tok2vec = model.get_ref("tok2vec").initialize(X=X) # noqa: F841
|
||||
tok2vec = model.get_ref("tok2vec").initialize(X=X)
|
||||
lower = model.get_ref("lower").initialize()
|
||||
if model.attrs["has_upper"]:
|
||||
statevecs = model.ops.alloc2f(2, lower.get_dim("nO"))
|
||||
|
@ -46,7 +46,7 @@ def init(model, X=None, Y=None):
|
|||
|
||||
|
||||
def resize_output(model, new_nO):
|
||||
tok2vec = model.get_ref("tok2vec") # noqa: F841
|
||||
tok2vec = model.get_ref("tok2vec")
|
||||
lower = model.get_ref("lower")
|
||||
upper = model.get_ref("upper")
|
||||
if not model.attrs["has_upper"]:
|
||||
|
|
|
@ -112,7 +112,7 @@ def test_serialize_custom_nlp():
|
|||
nlp.to_disk(d)
|
||||
nlp2 = spacy.load(d)
|
||||
model = nlp2.get_pipe("parser").model
|
||||
tok2vec = model.get_ref("tok2vec") # noqa: F841
|
||||
tok2vec = model.get_ref("tok2vec")
|
||||
upper = model.get_ref("upper")
|
||||
|
||||
# check that we have the correct settings, not the default ones
|
||||
|
@ -132,7 +132,7 @@ def test_serialize_parser():
|
|||
nlp.to_disk(d)
|
||||
nlp2 = spacy.load(d)
|
||||
model = nlp2.get_pipe("parser").model
|
||||
tok2vec = model.get_ref("tok2vec") # noqa: F841
|
||||
tok2vec = model.get_ref("tok2vec")
|
||||
upper = model.get_ref("upper")
|
||||
|
||||
# check that we have the correct settings, not the default ones
|
||||
|
|
Loading…
Reference in New Issue
Block a user