add discard_oversize parameter, move optimizer to training subsection

This commit is contained in:
svlandeg 2020-06-03 10:04:16 +02:00
parent 03c58b488c
commit e91485dfc4
9 changed files with 15 additions and 12 deletions

View File

@ -25,6 +25,7 @@ score_weights = {"las": 0.4, "ents_f": 0.4, "tags_acc": 0.2}
# These settings are invalid for the transformer models. # These settings are invalid for the transformer models.
init_tok2vec = null init_tok2vec = null
vectors = null vectors = null
discard_oversize = false
[training.batch_size] [training.batch_size]
@schedules = "compounding.v1" @schedules = "compounding.v1"
@ -32,7 +33,7 @@ start = 1000
stop = 1000 stop = 1000
compound = 1.001 compound = 1.001
[optimizer] [training.optimizer]
@optimizers = "Adam.v1" @optimizers = "Adam.v1"
beta1 = 0.9 beta1 = 0.9
beta2 = 0.999 beta2 = 0.999

View File

@ -14,6 +14,7 @@ score_weights = {"las": 0.8, "tags_acc": 0.2}
limit = 0 limit = 0
seed = 0 seed = 0
accumulate_gradient = 2 accumulate_gradient = 2
discard_oversize = false
[training.batch_size] [training.batch_size]
@schedules = "compounding.v1" @schedules = "compounding.v1"
@ -21,7 +22,7 @@ start = 100
stop = 1000 stop = 1000
compound = 1.001 compound = 1.001
[optimizer] [training.optimizer]
@optimizers = "Adam.v1" @optimizers = "Adam.v1"
learn_rate = 0.001 learn_rate = 0.001
beta1 = 0.9 beta1 = 0.9

View File

@ -14,6 +14,7 @@ score_weights = {"las": 0.8, "tags_acc": 0.2}
limit = 0 limit = 0
seed = 0 seed = 0
accumulate_gradient = 2 accumulate_gradient = 2
discard_oversize = false
[training.batch_size] [training.batch_size]
@schedules = "compounding.v1" @schedules = "compounding.v1"
@ -21,7 +22,7 @@ start = 100
stop = 1000 stop = 1000
compound = 1.001 compound = 1.001
[optimizer] [training.optimizer]
@optimizers = "Adam.v1" @optimizers = "Adam.v1"
learn_rate = 0.001 learn_rate = 0.001
beta1 = 0.9 beta1 = 0.9

View File

@ -12,8 +12,9 @@ max_length = 0
batch_size = 25 batch_size = 25
seed = 0 seed = 0
accumulate_gradient = 2 accumulate_gradient = 2
discard_oversize = false
[optimizer] [training.optimizer]
@optimizers = "Adam.v1" @optimizers = "Adam.v1"
learn_rate = 0.001 learn_rate = 0.001
beta1 = 0.9 beta1 = 0.9

View File

@ -11,6 +11,7 @@ gold_preproc = true
max_length = 0 max_length = 0
seed = 0 seed = 0
accumulate_gradient = 2 accumulate_gradient = 2
discard_oversize = false
[training.batch_size] [training.batch_size]
@schedules = "compounding.v1" @schedules = "compounding.v1"
@ -19,7 +20,7 @@ stop = 3000
compound = 1.001 compound = 1.001
[optimizer] [training.optimizer]
@optimizers = "Adam.v1" @optimizers = "Adam.v1"
learn_rate = 0.001 learn_rate = 0.001
beta1 = 0.9 beta1 = 0.9

View File

@ -2,16 +2,15 @@ if __name__ == "__main__":
import plac import plac
import sys import sys
from wasabi import msg from wasabi import msg
from spacy.cli import download, link, info, package, train, pretrain, convert from spacy.cli import download, link, info, package, pretrain, convert
from spacy.cli import init_model, profile, evaluate, validate, debug_data from spacy.cli import init_model, profile, evaluate, validate, debug_data
from spacy.cli import train_from_config_cli from spacy.cli import train_cli
commands = { commands = {
"download": download, "download": download,
"link": link, "link": link,
"info": info, "info": info,
"train": train, "train": train_cli,
"train-from-config": train_from_config_cli,
"pretrain": pretrain, "pretrain": pretrain,
"debug-data": debug_data, "debug-data": debug_data,
"evaluate": evaluate, "evaluate": evaluate,

View File

@ -4,8 +4,7 @@ from .download import download # noqa: F401
from .info import info # noqa: F401 from .info import info # noqa: F401
from .package import package # noqa: F401 from .package import package # noqa: F401
from .profile import profile # noqa: F401 from .profile import profile # noqa: F401
from .train import train # noqa: F401 from .train_from_config import train_cli # noqa: F401
from .train_from_config import train_from_config_cli # noqa: F401
from .pretrain import pretrain # noqa: F401 from .pretrain import pretrain # noqa: F401
from .debug_data import debug_data # noqa: F401 from .debug_data import debug_data # noqa: F401
from .evaluate import evaluate # noqa: F401 from .evaluate import evaluate # noqa: F401

View File

@ -374,7 +374,6 @@ def train_while_improving(
# Stop if we've exhausted our max steps (if specified) # Stop if we've exhausted our max steps (if specified)
if max_steps and (step * accumulate_gradient) >= max_steps: if max_steps and (step * accumulate_gradient) >= max_steps:
break break
step += 1
def subdivide_batch(batch, accumulate_gradient): def subdivide_batch(batch, accumulate_gradient):

View File

@ -0,0 +1 @@
from .models import *