mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
Update thinc dependency to 9.0.0.dev4
This commit is contained in:
parent
7718886fa3
commit
7351f6bbeb
|
@ -5,7 +5,7 @@ requires = [
|
|||
"cymem>=2.0.2,<2.1.0",
|
||||
"preshed>=3.0.2,<3.1.0",
|
||||
"murmurhash>=0.28.0,<1.1.0",
|
||||
"thinc>=9.0.0.dev2,<9.1.0",
|
||||
"thinc>=9.0.0.dev4,<9.1.0",
|
||||
"numpy>=1.15.0",
|
||||
]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
|
|
@ -3,7 +3,7 @@ spacy-legacy>=4.0.0.dev0,<4.1.0
|
|||
spacy-loggers>=1.0.0,<2.0.0
|
||||
cymem>=2.0.2,<2.1.0
|
||||
preshed>=3.0.2,<3.1.0
|
||||
thinc>=9.0.0.dev2,<9.1.0
|
||||
thinc>=9.0.0.dev4,<9.1.0
|
||||
ml_datasets>=0.2.0,<0.3.0
|
||||
murmurhash>=0.28.0,<1.1.0
|
||||
wasabi>=0.9.1,<1.2.0
|
||||
|
|
|
@ -37,7 +37,7 @@ setup_requires =
|
|||
cymem>=2.0.2,<2.1.0
|
||||
preshed>=3.0.2,<3.1.0
|
||||
murmurhash>=0.28.0,<1.1.0
|
||||
thinc>=9.0.0.dev2,<9.1.0
|
||||
thinc>=9.0.0.dev4,<9.1.0
|
||||
install_requires =
|
||||
# Our libraries
|
||||
spacy-legacy>=4.0.0.dev0,<4.1.0
|
||||
|
@ -45,7 +45,7 @@ install_requires =
|
|||
murmurhash>=0.28.0,<1.1.0
|
||||
cymem>=2.0.2,<2.1.0
|
||||
preshed>=3.0.2,<3.1.0
|
||||
thinc>=9.0.0.dev2,<9.1.0
|
||||
thinc>=9.0.0.dev4,<9.1.0
|
||||
wasabi>=0.9.1,<1.2.0
|
||||
srsly>=2.4.3,<3.0.0
|
||||
catalogue>=2.0.6,<2.1.0
|
||||
|
|
|
@ -5,7 +5,6 @@ from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple, Union,
|
|||
import numpy as np
|
||||
import srsly
|
||||
from thinc.api import Config, Model, NumpyOps, SequenceCategoricalCrossentropy
|
||||
from thinc.legacy import LegacySequenceCategoricalCrossentropy
|
||||
from thinc.types import ArrayXd, Floats2d, Ints1d
|
||||
|
||||
from .. import util
|
||||
|
@ -131,9 +130,7 @@ class EditTreeLemmatizer(TrainablePipe):
|
|||
self, examples: Iterable[Example], scores: List[Floats2d]
|
||||
) -> Tuple[float, List[Floats2d]]:
|
||||
validate_examples(examples, "EditTreeLemmatizer.get_loss")
|
||||
loss_func = LegacySequenceCategoricalCrossentropy(
|
||||
normalize=False, missing_value=-1
|
||||
)
|
||||
loss_func = SequenceCategoricalCrossentropy(normalize=False, missing_value=-1)
|
||||
|
||||
truths = []
|
||||
for eg in examples:
|
||||
|
@ -169,7 +166,7 @@ class EditTreeLemmatizer(TrainablePipe):
|
|||
|
||||
DOCS: https://spacy.io/api/edittreelemmatizer#get_teacher_student_loss
|
||||
"""
|
||||
loss_func = LegacySequenceCategoricalCrossentropy(normalize=False)
|
||||
loss_func = SequenceCategoricalCrossentropy(normalize=False)
|
||||
d_scores, loss = loss_func(student_scores, teacher_scores)
|
||||
if self.model.ops.xp.isnan(loss):
|
||||
raise ValueError(Errors.E910.format(name=self.name))
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
from itertools import islice
|
||||
from typing import Callable, Dict, Iterable, Optional, Union
|
||||
|
||||
from thinc.api import Config, Model
|
||||
from thinc.legacy import LegacySequenceCategoricalCrossentropy
|
||||
from thinc.api import Config, Model, SequenceCategoricalCrossentropy
|
||||
|
||||
from ..morphology cimport Morphology
|
||||
from ..tokens.doc cimport Doc
|
||||
|
@ -296,8 +295,8 @@ class Morphologizer(Tagger):
|
|||
DOCS: https://spacy.io/api/morphologizer#get_loss
|
||||
"""
|
||||
validate_examples(examples, "Morphologizer.get_loss")
|
||||
loss_func = LegacySequenceCategoricalCrossentropy(names=self.labels, normalize=False,
|
||||
label_smoothing=self.cfg["label_smoothing"])
|
||||
loss_func = SequenceCategoricalCrossentropy(names=self.labels, normalize=False,
|
||||
label_smoothing=self.cfg["label_smoothing"])
|
||||
truths = []
|
||||
for eg in examples:
|
||||
eg_truths = []
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
from itertools import islice
|
||||
from typing import Callable, Iterable, Optional
|
||||
|
||||
from thinc.api import Config, Model
|
||||
from thinc.legacy import LegacySequenceCategoricalCrossentropy
|
||||
from thinc.api import Config, Model, SequenceCategoricalCrossentropy
|
||||
|
||||
from ..tokens.doc cimport Doc
|
||||
|
||||
|
@ -158,7 +157,7 @@ class SentenceRecognizer(Tagger):
|
|||
"""
|
||||
validate_examples(examples, "SentenceRecognizer.get_loss")
|
||||
labels = self.labels
|
||||
loss_func = LegacySequenceCategoricalCrossentropy(names=labels, normalize=False)
|
||||
loss_func = SequenceCategoricalCrossentropy(names=labels, normalize=False)
|
||||
truths = []
|
||||
for eg in examples:
|
||||
eg_truth = []
|
||||
|
|
|
@ -3,8 +3,7 @@ from itertools import islice
|
|||
from typing import Callable, Dict, Iterable, List, Optional, Tuple, Union
|
||||
|
||||
import numpy
|
||||
from thinc.api import Config, Model, set_dropout_rate
|
||||
from thinc.legacy import LegacySequenceCategoricalCrossentropy
|
||||
from thinc.api import Config, Model, SequenceCategoricalCrossentropy, set_dropout_rate
|
||||
from thinc.types import Floats2d, Ints1d
|
||||
|
||||
from ..tokens.doc cimport Doc
|
||||
|
@ -276,7 +275,7 @@ class Tagger(TrainablePipe):
|
|||
|
||||
DOCS: https://spacy.io/api/tagger#get_teacher_student_loss
|
||||
"""
|
||||
loss_func = LegacySequenceCategoricalCrossentropy(normalize=False)
|
||||
loss_func = SequenceCategoricalCrossentropy(normalize=False)
|
||||
d_scores, loss = loss_func(student_scores, teacher_scores)
|
||||
if self.model.ops.xp.isnan(loss):
|
||||
raise ValueError(Errors.E910.format(name=self.name))
|
||||
|
@ -293,7 +292,7 @@ class Tagger(TrainablePipe):
|
|||
DOCS: https://spacy.io/api/tagger#get_loss
|
||||
"""
|
||||
validate_examples(examples, "Tagger.get_loss")
|
||||
loss_func = LegacySequenceCategoricalCrossentropy(
|
||||
loss_func = SequenceCategoricalCrossentropy(
|
||||
names=self.labels,
|
||||
normalize=False,
|
||||
neg_prefix=self.cfg["neg_prefix"],
|
||||
|
|
|
@ -21,13 +21,13 @@ from thinc.api import (
|
|||
CupyOps,
|
||||
NumpyOps,
|
||||
Optimizer,
|
||||
SequenceCategoricalCrossentropy,
|
||||
chain,
|
||||
get_ops,
|
||||
set_dropout_rate,
|
||||
softmax_activation,
|
||||
use_ops,
|
||||
)
|
||||
from thinc.legacy import LegacySequenceCategoricalCrossentropy
|
||||
from thinc.types import Floats2d
|
||||
|
||||
from ..ml.parser_model cimport (
|
||||
|
@ -349,7 +349,7 @@ cdef class Parser(TrainablePipe):
|
|||
|
||||
DOCS: https://spacy.io/api/dependencyparser#get_teacher_student_loss
|
||||
"""
|
||||
loss_func = LegacySequenceCategoricalCrossentropy(normalize=False)
|
||||
loss_func = SequenceCategoricalCrossentropy(normalize=False)
|
||||
d_scores, loss = loss_func(student_scores, teacher_scores)
|
||||
if self.model.ops.xp.isnan(loss):
|
||||
raise ValueError(Errors.E910.format(name=self.name))
|
||||
|
|
Loading…
Reference in New Issue
Block a user