mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 04:08:09 +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 srsly
|
||||
from wasabi import Printer
|
||||
from thinc.rates import slanted_triangular
|
||||
|
||||
from .._ml import create_default_optimizer
|
||||
from ..attrs import PROB, IS_OOV, CLUSTER, LANG
|
||||
|
@ -118,7 +119,7 @@ def train(
|
|||
)
|
||||
batch_sizes = util.compounding(
|
||||
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),
|
||||
)
|
||||
|
||||
|
@ -180,6 +181,8 @@ def train(
|
|||
# Start with a blank model, call begin_training
|
||||
optimizer = nlp.begin_training(lambda: corpus.train_tuples, device=use_gpu)
|
||||
|
||||
optimizer.b1_decay = 0.0001
|
||||
optimizer.b2_decay = 0.0001
|
||||
nlp._optimizer = None
|
||||
|
||||
# Load in pre-trained weights
|
||||
|
|
|
@ -207,15 +207,16 @@ cdef class BiluoPushDown(TransitionSystem):
|
|||
else:
|
||||
label_id = label_name
|
||||
if action == OUT and label_id != 0:
|
||||
return
|
||||
return None
|
||||
if action == MISSING or action == ISNT:
|
||||
return
|
||||
return None
|
||||
# Check we're not creating a move we already have, so that this is
|
||||
# idempotent
|
||||
for trans in self.c[:self.n_moves]:
|
||||
if trans.move == action and trans.label == label_id:
|
||||
return 0
|
||||
if self.n_moves >= self._size:
|
||||
self._size = self.n_moves
|
||||
self._size *= 2
|
||||
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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user