Questions tagged [spacy-transformers]

92 questions
10
votes
1 answer

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 to use its pre-trained weights. Unfortunately…
9
votes
1 answer

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 work because spacy demands a certain structure,…
9
votes
1 answer

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 en_core_web_lg 4.89 seconds 21.9 seconds NER…
ryk
  • 133
  • 2
  • 9
5
votes
2 answers

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 should I change between : [nlp]…
5
votes
1 answer

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('en_pytt_bertbaseuncased_lg') textcat = nlp.create_pipe( …
4
votes
1 answer

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 the pipeline with: nlp.add_pipe('sentencizer').…
Jon Flynn
  • 440
  • 6
  • 15
4
votes
1 answer

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 create the pipeline model. Apparently, if I try…
4
votes
1 answer

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 pretrained model: ['classifier.weight',…
3
votes
0 answers

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's output to capture this ambiguity. I have been…
alex
  • 31
  • 2
3
votes
1 answer

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 case looks like the following: import spacy from…
Connor
  • 393
  • 2
  • 9
3
votes
1 answer

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 examples with new labels. I am able to train a blank…
3
votes
2 answers

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 convert this model for spaCy 2.0 but it doesn't work…
EnesZ
  • 403
  • 3
  • 16
3
votes
2 answers

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 prompt. paramjeetsingh80@t1v-n-1c883486-w-0:~$…
3
votes
3 answers

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 the sentence as a whole? feature_extraction =…
3
votes
1 answer

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?", {"entities": [(7, 17, "FRIENDS")]}],["I like London.", {"entities":…
shahid khan
  • 409
  • 6
  • 23
1
2 3 4 5 6 7