How to remove evaluation of frozen components ? #12973
-
|
Hello everyone ! I'm training NER components. I already made one the "classic" way, using only "Transformer" and "NER" components with the default config file provided by spacy. It worked well. My base config file : # This is an auto-generated partial config. To use it with 'spacy train'
# you can run spacy init fill-config to auto-fill all default settings:
# python -m spacy init fill-config ./base_config.cfg ./config.cfg
[paths]
train = null
dev = null
vectors = null
[system]
gpu_allocator = "pytorch"
[nlp]
lang = "fr"
pipeline = ["transformer", "morphologizer", "parser", "attribute_ruler", "lemmatizer", "ner"]
batch_size = 128
[components]
[components.transformer]
source = "fr_dep_news_trf"
[components.morphologizer]
source = "fr_dep_news_trf"
[components.parser]
source = "fr_dep_news_trf"
[components.attribute_ruler]
source = "fr_dep_news_trf"
[components.lemmatizer]
source = "fr_dep_news_trf"
[components.ner]
factory = "ner"
[components.ner.model]
@architectures = "spacy.TransitionBasedParser.v2"
state_type = "ner"
extra_state_tokens = false
hidden_width = 64
maxout_pieces = 2
use_upper = false
nO = null
[components.ner.model.tok2vec]
@architectures = "spacy-transformers.TransformerListener.v1"
grad_factor = 1.0
[components.ner.model.tok2vec.pooling]
@layers = "reduce_mean.v1"
[corpora]
[corpora.train]
@readers = "spacy.Corpus.v1"
path = ${paths.train}
max_length = 0
[corpora.dev]
@readers = "spacy.Corpus.v1"
path = ${paths.dev}
max_length = 0
[training]
accumulate_gradient = 3
dev_corpus = "corpora.dev"
train_corpus = "corpora.train"
frozen_components = ["transformer", "morphologizer", "parser", "attribute_ruler","lemmatizer"]
annotating_components = ["transformer", "morphologizer", "parser", "attribute_ruler","lemmatizer"]
[training.optimizer]
@optimizers = "Adam.v1"
[training.optimizer.learn_rate]
@schedules = "warmup_linear.v1"
warmup_steps = 250
total_steps = 20000
initial_rate = 5e-5
[training.batcher]
@batchers = "spacy.batch_by_padded.v1"
discard_oversize = true
size = 2000
buffer = 256
[initialize]
vectors = ${paths.vectors}So my questions are: why does it behave like this? How can I handle this? Is what I'm trying to do relevant? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
The error message is a little confusing, since there's an internal "parser" that is used for both But to back up a bit first: you have the right overall idea here, but in practice it doesn't work to train I'd recommend:
I don't think it will make a large difference, but if you want to try your original idea, you can start out with the [components.transformer]
source = "fr_dep_news_trf" |
Beta Was this translation helpful? Give feedback.
The error message is a little confusing, since there's an internal "parser" that is used for both
parserandner, so my first guess is that there is some problem with the NER training data that leads to this particular error.But to back up a bit first: you have the right overall idea here, but in practice it doesn't work to train
nerwith a frozentransformercomponent. You'll need to use a separatetransformercomponent if you want to addnertofr_dep_news_trf(yes, it will be twice as big and twice as slow, which is why we don't publish afr_core_news_trfpipeline right now).I'd recommend:
transformer+nerusing thenerGPU config from the training quickstart orinit config