mirror of https://github.com/explosion/spaCy.git
remove duplicate model definition of tok2vec layer
This commit is contained in:
parent
1775f54a26
commit
6b027d7689
|
@ -53,17 +53,7 @@ n_save_every = null
|
||||||
batch_size = 3000
|
batch_size = 3000
|
||||||
seed = ${training:seed}
|
seed = ${training:seed}
|
||||||
use_pytorch_for_gpu_memory = ${training:use_pytorch_for_gpu_memory}
|
use_pytorch_for_gpu_memory = ${training:use_pytorch_for_gpu_memory}
|
||||||
|
tok2vec_model = "nlp.pipeline.tok2vec.model"
|
||||||
[pretraining.model]
|
|
||||||
@architectures = "spacy.HashEmbedCNN.v1"
|
|
||||||
pretrained_vectors = ${nlp:vectors}
|
|
||||||
width = 256
|
|
||||||
depth = 6
|
|
||||||
window_size = 1
|
|
||||||
embed_size = 2000
|
|
||||||
maxout_pieces = 3
|
|
||||||
subword_features = true
|
|
||||||
dropout = null
|
|
||||||
|
|
||||||
[pretraining.optimizer]
|
[pretraining.optimizer]
|
||||||
@optimizers = "Adam.v1"
|
@optimizers = "Adam.v1"
|
||||||
|
|
|
@ -109,7 +109,10 @@ def pretrain(
|
||||||
with msg.loading(f"Loading model '{vectors_model}'..."):
|
with msg.loading(f"Loading model '{vectors_model}'..."):
|
||||||
nlp = util.load_model(vectors_model)
|
nlp = util.load_model(vectors_model)
|
||||||
msg.good(f"Loaded model '{vectors_model}'")
|
msg.good(f"Loaded model '{vectors_model}'")
|
||||||
tok2vec = pretrain_config["model"]
|
tok2vec_path = pretrain_config["tok2vec_model"]
|
||||||
|
tok2vec = config
|
||||||
|
for subpath in tok2vec_path.split("."):
|
||||||
|
tok2vec = tok2vec.get(subpath)
|
||||||
model = create_pretraining_model(nlp, tok2vec)
|
model = create_pretraining_model(nlp, tok2vec)
|
||||||
optimizer = pretrain_config["optimizer"]
|
optimizer = pretrain_config["optimizer"]
|
||||||
|
|
||||||
|
|
|
@ -102,4 +102,4 @@ def _replace_word(word, random_words, mask="[MASK]"):
|
||||||
elif roll < 0.9:
|
elif roll < 0.9:
|
||||||
return random_words.next()
|
return random_words.next()
|
||||||
else:
|
else:
|
||||||
return word
|
return word
|
||||||
|
|
Loading…
Reference in New Issue