Skip to content

Commit 753be22

Browse files
committed
Tidy up
1 parent e7983d1 commit 753be22

4 files changed

Lines changed: 8 additions & 7 deletions

File tree

spacy_pytorch_transformers/language.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def resume_training(self, sgd=None, component_cfg=None, **kwargs):
120120
for name, component in self.pipeline:
121121
if name == tok2vec_name:
122122
continue
123-
elif getattr(component, "model", None) != True:
123+
elif getattr(component, "model", None) is not True:
124124
continue
125125
elif not hasattr(component, "begin_training"):
126126
continue

spacy_pytorch_transformers/model_registry.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from thinc.api import layerize, chain, flatten_add_lengths, with_getitem
2-
from thinc.t2v import Pooling, mean_pool, max_pool
3-
from thinc.v2v import Softmax, Maxout
2+
from thinc.t2v import Pooling, mean_pool
3+
from thinc.v2v import Softmax
44
from thinc.neural.util import get_array_module
55

66

@@ -39,8 +39,7 @@ def fine_tune_class_vector(nr_class, *, exclusive_classes=True, **cfg):
3939
return chain(
4040
get_pytt_class_tokens,
4141
flatten_add_lengths,
42-
with_getitem(0,
43-
Softmax(nr_class, cfg["token_vector_width"])),
42+
with_getitem(0, Softmax(nr_class, cfg["token_vector_width"])),
4443
Pooling(mean_pool),
4544
)
4645

spacy_pytorch_transformers/pipeline.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,7 @@ def Model(cls, nr_class=1, exclusive_classes=False, **cfg):
2727
**cfg: Optional config parameters.
2828
RETURNS (thinc.neural.Model): The model.
2929
"""
30-
make_model = get_model_function(cfg.get("architecture", "fine_tune_class_vector"))
30+
make_model = get_model_function(
31+
cfg.get("architecture", "fine_tune_class_vector")
32+
)
3133
return make_model(nr_class, exclusive_classes=exclusive_classes, **cfg)

spacy_pytorch_transformers/wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def predict(self, ids: Array):
4949
y_var = self._model(ids, **model_kwargs)
5050
self._model.training = is_training
5151
return Activations.from_pytt(y_var, is_grad=False)
52-
52+
5353
def begin_update(
5454
self, ids: Array, drop: Dropout = 0.0
5555
) -> Tuple[Activations, Callable[..., None]]:

0 commit comments

Comments
 (0)