mirror of
https://github.com/explosion/spaCy.git
synced 2025-02-09 16:10:33 +03:00
Merge branch 'develop' of https://github.com/explosion/spaCy into develop
This commit is contained in:
commit
6936ca1664
|
@ -9,6 +9,7 @@ from timeit import default_timer as timer
|
||||||
import shutil
|
import shutil
|
||||||
import srsly
|
import srsly
|
||||||
from wasabi import Printer
|
from wasabi import Printer
|
||||||
|
from thinc.rates import slanted_triangular
|
||||||
|
|
||||||
from .._ml import create_default_optimizer
|
from .._ml import create_default_optimizer
|
||||||
from ..attrs import PROB, IS_OOV, CLUSTER, LANG
|
from ..attrs import PROB, IS_OOV, CLUSTER, LANG
|
||||||
|
@ -118,7 +119,7 @@ def train(
|
||||||
)
|
)
|
||||||
batch_sizes = util.compounding(
|
batch_sizes = util.compounding(
|
||||||
util.env_opt("batch_from", 100.0),
|
util.env_opt("batch_from", 100.0),
|
||||||
util.env_opt("batch_to", 1000.0),
|
util.env_opt("batch_to", 2000.0),
|
||||||
util.env_opt("batch_compound", 1.001),
|
util.env_opt("batch_compound", 1.001),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -180,6 +181,8 @@ def train(
|
||||||
# Start with a blank model, call begin_training
|
# Start with a blank model, call begin_training
|
||||||
optimizer = nlp.begin_training(lambda: corpus.train_tuples, device=use_gpu)
|
optimizer = nlp.begin_training(lambda: corpus.train_tuples, device=use_gpu)
|
||||||
|
|
||||||
|
optimizer.b1_decay = 0.0001
|
||||||
|
optimizer.b2_decay = 0.0001
|
||||||
nlp._optimizer = None
|
nlp._optimizer = None
|
||||||
|
|
||||||
# Load in pre-trained weights
|
# Load in pre-trained weights
|
||||||
|
|
|
@ -207,15 +207,16 @@ cdef class BiluoPushDown(TransitionSystem):
|
||||||
else:
|
else:
|
||||||
label_id = label_name
|
label_id = label_name
|
||||||
if action == OUT and label_id != 0:
|
if action == OUT and label_id != 0:
|
||||||
return
|
return None
|
||||||
if action == MISSING or action == ISNT:
|
if action == MISSING or action == ISNT:
|
||||||
return
|
return None
|
||||||
# Check we're not creating a move we already have, so that this is
|
# Check we're not creating a move we already have, so that this is
|
||||||
# idempotent
|
# idempotent
|
||||||
for trans in self.c[:self.n_moves]:
|
for trans in self.c[:self.n_moves]:
|
||||||
if trans.move == action and trans.label == label_id:
|
if trans.move == action and trans.label == label_id:
|
||||||
return 0
|
return 0
|
||||||
if self.n_moves >= self._size:
|
if self.n_moves >= self._size:
|
||||||
|
self._size = self.n_moves
|
||||||
self._size *= 2
|
self._size *= 2
|
||||||
self.c = <Transition*>self.mem.realloc(self.c, self._size * sizeof(self.c[0]))
|
self.c = <Transition*>self.mem.realloc(self.c, self._size * sizeof(self.c[0]))
|
||||||
self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id)
|
self.c[self.n_moves] = self.init_transition(self.n_moves, action, label_id)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user