Questions tagged [spacy-transformers]
The spacy-transformers tag has no usage guidance.
94
questions
11
votes
1
answer
13k
views
How can I load a partial pretrained pytorch model?
I'm trying to get a pytorch model running on a sentence classification task. As I am working with medical notes I am using ClinicalBert (https://github.com/kexinhuang12345/clinicalBERT) and would like ...
11
votes
1
answer
3k
views
Difference between spacy v3 en_core_web_trf pipeline and en_core_web_lg pipeline
I am doing some performance tests with spacy version 3 for right sizing my instances in production. I am observing the following
Observation:
Model name
Time without NER
Time with NER
Comments
...
10
votes
1
answer
3k
views
How to use existing huggingface-transformers model into spacy?
I'm here to ask you guys if it is possible to use an existing trained huggingface-transformers model with spacy.
My first naive attempt was to load it via spacy.load('bert-base-uncased'), it didn't ...
5
votes
1
answer
871
views
Model() got multiple values for argument 'nr_class' - SpaCy multi-classification model (BERT integration)
Hi I am working on implementing a multi-classification model (5 classes) with the new SpaCy Model en_pytt_bertbaseuncased_lg. The code for the new pipe is here:
nlp = spacy.load('...
5
votes
2
answers
2k
views
Using spacy v3 which parameter should I change in the config file to resolve CUDA out of memory problem ? batch_size vs max_length vs batcher.size
Using spacy v3, I try to train a classifier using camemBert and got CUDA out of memory problem.
To resolve this issue I read that I should decrease the batch size but I'm confused which parameter ...
4
votes
1
answer
2k
views
Getting similarity score with spacy and a transformer model
I've been using the spacy en_core_web_lg and wanted to try out en_core_web_trf (transformer model) but having some trouble wrapping my head around the difference in the model/pipeline usage.
My use ...
4
votes
1
answer
2k
views
SpaCy 3.0 - Fine-tuning only NER component while keeping rest intact
I have some training data for a new set of NER labels that are not currently covered in SpaCy's default NER model. I have prepared a training_data.spacy file - which exclusively contain annotated ...
4
votes
1
answer
2k
views
Spacy v3 - ValueError: [E030] Sentence boundaries unset
I'm training an entity linker model with spacy 3, and am getting the following error when running spacy train:
ValueError: [E030] Sentence boundaries unset. You can add the 'sentencizer' component to ...
4
votes
1
answer
2k
views
Weight Initialization from pretrained BERT error in pytorch
I am trying to train the model using pretrained model(BERT) using pytorch. The pretrained model weights still arent accepted.
I see this error:
Weights of BertForMultiLable not initialized from ...
4
votes
1
answer
2k
views
How to properly use transformer model for custom NER in spaCy v3?
I'm trying to train a Named Entity Recognition (NER) model for custom tags using spaCy version 3. I went through all the documentation on their website but I cannot understand what's the proper way to ...
3
votes
4
answers
12k
views
Getting sentence embedding from huggingface Feature Extraction Pipeline
How do i get an embedding for the whole sentence from huggingface's feature extraction pipeline?
I understand how to get the features for each token (below) but how do i get the overall features for ...
3
votes
1
answer
2k
views
Spacy BILOU format to spacy json format
i am trying to upgrade my spacy version to nightly especially for using spacy transformers
so i converted spacy simple train datasets of format like
td = [["Who is Shaka Khan?", {"...
3
votes
2
answers
1k
views
How to use Hugging Face transfomers with spaCy 3.0
Let's say that I want to include distilbert https://huggingface.co/distilbert-base-uncased from Hugging Face into spaCy 3.0 pipeline. I think that this is possible and I found some code on how to ...
3
votes
2
answers
1k
views
Not able to import python package jax in Google TPU
I am working on linux console and typing python takes me into the python console.
When I use the following command in TPU machine
import jax
then it generates following mss and get out of the python ...
3
votes
1
answer
666
views
Multiple Entity recognition with Spacy python Error
i am stuck on a problem and seeking help from you. i am trying to train multiple entity using spacy
Following is my Train Data
response =[
('java developer with java and html css javascript ',
{'...
3
votes
2
answers
880
views
Unable to import spacy transformers
I have already installed spacy using conda install -c conda-forge spacy and spacy-transformers using pip install spacy-transformers. But when I try to import spacy_transformers. I get the following ...
3
votes
0
answers
84
views
Output multiple possible tags with spaCy spancat
The problem I'm working on involves span categorisation with spaCy, however some of the tags are ambiguous, e.g. span1 => 60% tag1, 40% tag2
I'm trying to figure out if there is a way to get Spacy'...
3
votes
0
answers
839
views
Extract information from a text using SpaCy
I want to build a model that extracts personal data collected by a website.
The first step, I scrapped the privacy policy of a website, then I split it into sentences and put them on a dataframe as ...
3
votes
0
answers
2k
views
Text Classification with Spacy : going beyond the basics to improve performance
I'm trying to train a text categorizer on a training dataset of texts (Reddit posts) with two exclusive classes (1 and 0) regarding a feature of the authors of the posts, and not the posts themselves. ...
2
votes
4
answers
5k
views
Could not find function 'spacy-transformers.TransformerModel.v3' in function registry 'architectures'
I was trying to create a custom NER model. I used spacy library to create the model. And this line of code is to create the config file from the base.config file.
My code is :
!python -m spacy ...
2
votes
1
answer
808
views
Installing Spacy for GPU training of Transformer
I installed also the CudaToolkit, and cuDNN.
I have the following
GPU:
| NVIDIA-SMI 531.68 Driver Version: 531.68 CUDA Version: 12.1 |
|---------------------------------------...
2
votes
1
answer
464
views
Splitting SpaCy Docs into sentences in custom pipeline component
I am building a SpaCy pipeline and would like to split sentences into individual Doc objects. According to the SpaCy documentation, custom pipeline components take a single Doc object as input and ...
2
votes
1
answer
1k
views
Spacy 3.1 - KeyError: 'train' using spacy train command
I'm following this tutorial https://spacy.io/usage/training#quickstart in order to train a custom model of distilbert.
Everything is already installed, data are converted and the config file is ready.
...
2
votes
1
answer
356
views
Force 'parser' to not segment sentences?
Is there an easy way to tell the "parser" pipe not to change the value of Token.is_sent_start ?
So, here is the story:
I am working with documents that are pre-sentencized (1 line = 1 ...
2
votes
1
answer
437
views
Is it possible to add custom entity labels to Spacy 3.0 config file?
I'm working on a custom NER model with spacy-transformers and roBERTa. I'm really only using the CLI for this and am trying to alter my Spacy config.cfg file to account for custom entity labels in the ...
2
votes
2
answers
917
views
Identical random crop on two images Pytorch transforms
I am trying to feed two images into a network and I want to do identical transform between these two images. transforms.Compose() takes one image at a time and produces output independent to each ...
2
votes
1
answer
419
views
gpu is not detected by pytorch for spacy NER
I am trying to train a spacy3 NER model. I have GPU available on my machine with following specs:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.86.01 ...
2
votes
0
answers
873
views
ImportError loading spacy in jupyter notebook(ubuntu)
I got a problem I can't seem to figure out. The first time I imported Spacy into a Jupyter notebook I had no problems. It just imported it as I expected.
import spacy
nlp = spacy.load('en_core_web_sm')...
2
votes
0
answers
961
views
Is there a way to use spacy-transformers from disk (offline)
I want to use spacy-transformers in a corporate environment with limited internet access, so i have to download transformer models from the huggingfaces hub manually and get them to work in spacy.
In ...
2
votes
1
answer
835
views
Getting this while using pytorch transforms--->TypeError: integer argument expected, got float
I cloned transfer-learning-library repo and working on maximum classifier discrepancy. I am trying to change the augmentation but getting the following error
Traceback (most recent call last):
File &...
2
votes
0
answers
355
views
spacy-pytorch-transformers: loss = 0 constantly during training
I'm using spacy 2.1.8 and spacy-pytorch-transformers 0.4.0 to train a text classifier. My code is strongly inspired from their example but the model is not learning anything, which seems to be caused ...
1
vote
1
answer
556
views
Why does my training function throw up the Name error "name decaying is not defined"?
So, i am new to NLP, and i am trying to train a text classifier using the spacy_transformers. this code has been shown to run, but it throws up errors on my computer. As a side note, could it be ...
1
vote
1
answer
390
views
How can I use a model trained with the transformers trainer in the spaCy pipeline?
I have trained and saved a BERT model for NER with the transformers trainer. Is it possible to use this model in the spaCy pipeline?
I have tried with spacy.load('path\to\model'), but get the ...
1
vote
3
answers
686
views
Training spaCy model as a Vertex AI Pipeline "Component"
I am trying to train a spaCy model , but turning the code into a Vertex AI Pipeline Component. My current code is:
@component(
packages_to_install=[
"setuptools",
"...
1
vote
1
answer
338
views
Can I update the spacy's Entity Linking knowledge base after training?
Let's suppose I have successfully trained an Entity Linking model, and it is working just fine. But, eventually, I'm going to update some aliases of the knowledge base. Just some aliases not the ...
1
vote
1
answer
2k
views
Spacy 3.1 example code for Transformers in the online documentation seems to be wrong
In the latest documentation for Spacy, the following example is given at the following link:
https://spacy.io/usage/embeddings-transformers
import spacy
from spacy.tokens import Doc
from ...
1
vote
1
answer
1k
views
Error when loading pipelines in spaCy 3.0
After updating to spaCy 3.0.6 I haven't been able to load in either of the trained pipelines, although both seem to be properly installed:
================= Installed pipeline packages (spaCy v3.0.6) =...
1
vote
0
answers
78
views
How to speed up sentence tokenization with Spacy
I am trying to extract the first sentences from a list of paragraphs with the following function (that I apply in a for loop):
def extract_first_sentence(text):
doc = nlp(text)
return [sent.text ...
1
vote
0
answers
164
views
Spacy Entity Linker with Transformer Listener problem
I have a pretrained pipeline composed by a transformer and NER components and I am trying to create an Entity Linker able to use embedding representation produced by the transformer rather than using ...
1
vote
1
answer
438
views
How to update NER training of existing transformer model code from v2 to SpaCy v3.x
I want to understand how to update the using example of NER updating the model to learn recognize new entity (here ANIMAL) from version 2.x of SpaCy v3.x:
https://github.com/explosion/spaCy/blob/v2.3....
1
vote
0
answers
95
views
spaCy version 3 cannot add 'negative' example, how can I resolve?
In spaCy 3, we now train our model with the configuration system, and we need to use DocBin.to_disk("any_name.spacy") to export the training data.
The problem is, we need to first create ...
1
vote
0
answers
844
views
Using Spacy functionalities for Arabic Language
I want to train a model on NER annotation and then use it to perform information extraction.
Also I want to see how spaCy's built-in visualizer detected the NEs in the document for Arabic language, ...
1
vote
2
answers
879
views
Unable to train model using gpu on M1 Mac
How to reproduce the behaviour
install space for apple , select model training option and follow the on screen instructions.
generate config files for model training.
Declare your training and testing ...
1
vote
1
answer
239
views
How to train spacy trainned model
Is it possible to train spacy trained model such as model-best, model-last. If it is possible please tell me how to pretrain my model. Thank you
1
vote
0
answers
867
views
How to initialize tok2vec Transformer with a custom spacy ner model
I have some trouble with the initialization of a tok2vec Transformer with a custom spacy ner model. How do I use tok2vec properly before the ner step starts in the pipeline?
Init:
nlp = spacy.load(...
1
vote
0
answers
425
views
How can i use thinc.types with spacy version 2
I am using spacy version==2.2.4 for name entity recognition and wishes to use the same version for testing custom spacy relation extraction pipeline. But unfortunately, I am facing the below issue ...
1
vote
0
answers
87
views
How to load huge dataset for conversion into spacy JSON in colab?
I have a dataset having 65 million entries in IOB format.
So, while converting it to spacy Binary format using the command:
!python -m spacy convert /content/train.tsv /content/ -s -c ner
The colab ...
1
vote
1
answer
322
views
SpaCy-transformers regression output
I would like to have a regression output instead of the classification. For instance: instead of n classes I want a floating point output value from 0 to 1.
Here is the minimalistic example from the ...
1
vote
1
answer
620
views
How are token vectors calculated in spacy-pytorch-transformers
I am currently working with the spacy-pytorch-transformer package to experiment with the respective embeddings.
When reading the introductionary article (essentially the GitHub README), my ...
0
votes
2
answers
8k
views
How to get started with spacy library and its module in Google Colab?
I'm facing problem with Spacy module to load in colab GPU notebook.
!python -m spacy download en_trf_xlnetbasecased_lg
This command works for anaconda notebook to download, but how to download in ...