Transformer / Train on resources with different annotations #6377
Replies: 6 comments
-
|
With spaCy 3, it should be easier to source components from different models that you trained independently, cf the docs at https://nightly.spacy.io/usage/processing-pipelines#sourced-components. Would that be an option for you? The only disadvantage to that approach, is that you won't be able to share the same transformer across all your components. There's also another tricky part: if you have a Hope that works for you! |
Beta Was this translation helpful? Give feedback.
-
|
Hi Sofie and thanks for your answer! I have thought about this possibility, but I discarded it for the reason that two transformer models would be necessary, since the transformer weights appear to be modified during training. Would it be possible specify different training data for the different components of the pipeline while still training them jointly with one trf model? (this would be my prefered solution :) If that is not possible: |
Beta Was this translation helpful? Give feedback.
-
Ok, fair enough ;-)
Hm, no, that won't be trivial. You typically train your I guess you could implement your own custom training loop though: create the pipeline with just one transformer, have all components listen to that one, and then call the
Hm. In theory, you can prevent pipeline components from training/updating by putting them in the |
Beta Was this translation helpful? Give feedback.
-
|
Ah, actually, you can also just ensure that none of your components update the transformer by setting |
Beta Was this translation helpful? Give feedback.
-
|
Thanks a lot! The first model is training right now. I tried also to set I will now train the two models with its respective components and Transformer loss is I will report back what results I got. Thanks for your help! |
Beta Was this translation helpful? Give feedback.
-
|
I have now done some experiments on this. The results are not extremely bad, but still significantly suffer from freezing the transformer. Unfortunately it is worse for the dependency parser. There Additionally, learning the NER component on top of the frozen transformer does not work too well. I have now automatically annotated the UD treebank with NER labels. This actually works quite well and is already much better than the experiments with the frozen transformer. However this doesn't seem to work. Even though I have ( When I initialize a new NER component with Is there some way to freeze the transformer weights while continuing training on the existing NER component weights (resp. initialize the component with already existing weights)? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm trying to to train a Swedish transformer model using spacy-nightly (
'3.0.0rc2'), using a configuration file.There are two resources I want to use:
A UD treebank that includes
parser,taggerandmorphologizerannotations for Swedish and another corpus (SUC3.0) that has an incompatible tag set to UD and only auto-generatedparserannotations, but features in turnnerannotation.In short:
parser,taggerandmorphologizerannotationsnerannotationI would like to combine these two resources and train the full pipeline of
parser,tagger,morphologizerandnerwith a transformer model.I tried to just merge the
DocBininstances containing the respective annotations, hoping the empty annotations would be omitted by its respective component.However that did not seem to be the case. At the end all predicted POS tags where empty, I assume the model learned the empty annotations from the SUC part.
How can I combine these different resources in one model/package?
Beta Was this translation helpful? Give feedback.
All reactions