spancat shared architecture listeners not working as expected #11859
Replies: 2 comments 1 reply
-
The first option won't work because your The second option with |
Beta Was this translation helpful? Give feedback.
-
Thank you @adrianeboyd am curious if there is a way to let spancat use transformer from en_core_web_trf to reduce the overall pipeline size. also is there a specific reason why spancat needs its own transformer. Below is my spancat model config used for training.
let me know if my understanding is correct. SpanCat fine-tuned transformer(embeddings/context vectors) part of spancat training which means Spancat not only learns to classify spans but also fine-tunes base "roberta-base" transformer layer for the SpanCat task. In other words, it may not be possible to use the transformer from en_core_web_trf as SpanCat needs fine-tuned transformer compared to the original transformer from "roberta-base". If this is the case, is it wise to use a fine-tuned transformer from SpanCat for other components(lets say NER/sentence classification for example)? In general what are the guidelines for using a shared transformer in cases where the transformer is fine-tuned for a specific task(SpanCat) and is there documentation on which tasks fine-tune the transformer vs which don't? ` [components.spancat.model.tok2vec] [components.transformer] [components.transformer.model] ` |
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.
-
Hello, for some reason I see the memory/disk footprint of my nlp pipeline without listeners is less compared to with listeners(assuming am doing it correctly :))
Without listeners spacy nlp pipeline
nlp_spancat = spacy.load('./Source/Python/span_cat_myown/training/model-last') snlp = spacy.load("en_core_web_tf") snlp.add_pipe('spancat', source=nlp_spancat, name="span_cat_myown") snlp.to_disk("./snlp")
the model file of span_cat_myown on disk is just 4kb and overall ~0.5 GB
With listeners spacy nlp pipeline
want span_cat_myown component to listen to en_core_web_tf transformer as span_cat_myown trained using en_core_web_tf transformer.
the model file of span_cat_myown on disk is 483MB(I think it is writing duplicate transfomers layer) and overall ~1GB
nlp_spancat = spacy.load('./Source/Python/span_cat_myown/training/model-last') nlp_spancat.replace_listeners("transformer", "spancat", ["model.tok2vec"]) snlp = spacy.load("en_core_web_tf") snlp.add_pipe('spancat', source=nlp_spancat, name="span_cat_myown") snlp.to_disk("./snlp")
please any suggestions on why the span_cat_myown model file on disk is high with listeners and low without listeners?
also not sure if am implementing listeners correctly.
Beta Was this translation helpful? Give feedback.
All reactions