Understand the transformer component limitations
masterThe transformer component in spacy-transformers is designed to provide transformer-based features to spaCy pipeline components (like ner or textcat) via multi-task learning.
Key Limitation: The transformer component does not support task-specific heads (such as token or text classification) directly. It provides access to the transformer embeddings/features, but not the specific classification heads of a Hugging Face model.
Workarounds:
- To train spaCy components: Use a transformer model as a feature source to train components like
nerortextcatusing spaCy's multi-task learning capabilities. - To use existing Hugging Face predictions: If you need to use the actual predictions from an existing Hugging Face text or token classification model, use the
spacy-huggingface-pipelineswrapper instead.