mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 09:14:32 +03:00
Learns things
This commit is contained in:
parent
04ae1c01f1
commit
08bee76790
|
@ -4,6 +4,7 @@ from thinc.neural._classes.hash_embed import HashEmbed
|
|||
|
||||
from thinc.neural._classes.convolution import ExtractWindow
|
||||
from thinc.neural._classes.static_vectors import StaticVectors
|
||||
from thinc.neural._classes.batchnorm import BatchNorm
|
||||
|
||||
from .attrs import ID, LOWER, PREFIX, SUFFIX, SHAPE, TAG, DEP
|
||||
|
||||
|
@ -160,7 +161,7 @@ def build_tok2vec(lang, width, depth=2, embed_size=1000):
|
|||
>> with_flatten(
|
||||
#(static | prefix | suffix | shape)
|
||||
(lower | prefix | suffix | shape | tag)
|
||||
>> Maxout(width, width*5)
|
||||
>> BatchNorm(Maxout(width, width*5), nO=width)
|
||||
#>> (ExtractWindow(nW=1) >> Maxout(width, width*3))
|
||||
#>> (ExtractWindow(nW=1) >> Maxout(width, width*3))
|
||||
)
|
||||
|
|
|
@ -113,7 +113,7 @@ cdef class Parser:
|
|||
def __reduce__(self):
|
||||
return (Parser, (self.vocab, self.moves, self.model), None, None)
|
||||
|
||||
def build_model(self, width=32, nr_vector=1000, nF=1, nB=1, nS=1, nL=1, nR=1, **_):
|
||||
def build_model(self, width=64, nr_vector=1000, nF=1, nB=1, nS=1, nL=1, nR=1, **_):
|
||||
state2vec = build_debug_state2vec(width, nr_vector, nF, nB, nL, nR)
|
||||
model = build_debug_model(state2vec, width, 2, self.moves.n_moves)
|
||||
return model
|
||||
|
|
|
@ -47,7 +47,7 @@ cdef class StateClass:
|
|||
return ' '.join((third, second, top, '|', n0, n1))
|
||||
|
||||
def nr_context_tokens(self, int nF, int nB, int nS, int nL, int nR):
|
||||
return 8
|
||||
return 4
|
||||
|
||||
def set_context_tokens(self, int[:] output, nF=1, nB=0, nS=2,
|
||||
nL=2, nR=2):
|
||||
|
@ -55,10 +55,10 @@ cdef class StateClass:
|
|||
output[1] = self.B(1)
|
||||
output[2] = self.S(0)
|
||||
output[3] = self.S(1)
|
||||
output[4] = self.L(self.S(0), 1)
|
||||
output[5] = self.L(self.S(0), 2)
|
||||
output[6] = self.R(self.S(0), 1)
|
||||
output[7] = self.R(self.S(0), 2)
|
||||
#output[4] = self.L(self.S(0), 1)
|
||||
#output[5] = self.L(self.S(0), 2)
|
||||
#output[6] = self.R(self.S(0), 1)
|
||||
#output[7] = self.R(self.S(0), 2)
|
||||
#output[7] = self.L(self.S(1), 1)
|
||||
#output[8] = self.L(self.S(1), 2)
|
||||
#output[9] = self.R(self.S(1), 1)
|
||||
|
|
Loading…
Reference in New Issue
Block a user