Use thinc 6.0

This commit is contained in:
Matthew Honnibal 2016-12-29 11:58:42 +01:00
parent 9bac332688
commit af81ac8bb0
4 changed files with 8 additions and 8 deletions

View File

@ -3,7 +3,7 @@ pathlib
numpy>=1.7
cymem>=1.30,<1.32
preshed>=0.46.4,<0.47.0
thinc>=5.0.0,<5.1.0
thinc>=6.0.0,<6.1.0
murmurhash>=0.26,<0.27
plac<0.9.3
six

View File

@ -236,7 +236,7 @@ def setup_package():
'murmurhash>=0.26,<0.27',
'cymem>=1.30,<1.32',
'preshed>=0.46.0,<0.47.0',
'thinc>=5.0.0,<5.1.0',
'thinc>=6.0.0,<6.1.0',
'plac',
'six',
'cloudpickle',

View File

@ -255,10 +255,10 @@ cdef class Parser:
cdef weight_t loss = 0
cdef Transition action
while not stcls.is_final():
self.model.set_featuresC(&eg.c, stcls.c)
self.model.set_featuresC(eg.c, stcls.c)
self.moves.set_costs(eg.c.is_valid, eg.c.costs, stcls, gold)
self.model.set_scoresC(eg.c.scores, eg.c.features, eg.c.nr_feat)
self.model.updateC(&eg.c)
self.model.updateC(eg.c)
guess = VecVec.arg_max_if_true(eg.c.scores, eg.c.is_valid, eg.c.nr_class)
action = self.moves.c[eg.guess]
@ -343,7 +343,7 @@ cdef class StepwiseState:
def predict(self):
self.eg.reset()
self.parser.model.set_featuresC(&self.eg.c, self.stcls.c)
self.parser.model.set_featuresC(self.eg.c, self.stcls.c)
self.parser.moves.set_valid(self.eg.c.is_valid, self.stcls.c)
self.parser.model.set_scoresC(self.eg.c.scores,
self.eg.c.features, self.eg.c.nr_feat)

View File

@ -192,7 +192,7 @@ cdef class Tagger:
nr_feat=self.model.nr_feat)
for i in range(tokens.length):
if tokens.c[i].pos == 0:
self.model.set_featuresC(&eg.c, tokens.c, i)
self.model.set_featuresC(eg.c, tokens.c, i)
self.model.set_scoresC(eg.c.scores,
eg.c.features, eg.c.nr_feat)
guess = VecVec.arg_max_if_true(eg.c.scores, eg.c.is_valid, eg.c.nr_class)
@ -244,11 +244,11 @@ cdef class Tagger:
nr_class=self.vocab.morphology.n_tags,
nr_feat=self.model.nr_feat)
for i in range(tokens.length):
self.model.set_featuresC(&eg.c, tokens.c, i)
self.model.set_featuresC(eg.c, tokens.c, i)
eg.costs = [ 1 if golds[i] not in (c, -1) else 0 for c in xrange(eg.nr_class) ]
self.model.set_scoresC(eg.c.scores,
eg.c.features, eg.c.nr_feat)
self.model.updateC(&eg.c)
self.model.updateC(eg.c)
self.vocab.morphology.assign_tag_id(&tokens.c[i], eg.guess)