bert-language-model

How to use adapter transformers with a Huggingface Pipeline

How to use adapter transformers with a Huggingface Pipeline Question: I tried to run the model "AdapterHub/bert-base-uncased-pf-conll2003" (Model description here) for token classification in NLP. First I tried to install the adapter transformers pip install -U adapter-transformers The output of the above command was Collecting adapter-transformers [… see edit history for skipped lines …] Installing …

Total answers: 1

Calculating embedding overload problems with BERT

Calculating embedding overload problems with BERT Question: I’m trying to calculate the embedding of a sentence using BERT. After I input the sentence into BERT, I calculate the Mean-pooling, which is used as the embedding of the sentence. Problem My code can calculate the embedding of sentences, but the computational cost is very high. I …

Total answers: 2

AttributeError: 'list' object has no attribute 'ents' in building NER using BERT

AttributeError: 'list' object has no attribute 'ents' in building NER using BERT Question: I’m trying to build a NER model using Bert-base-NER for a tweets dataset and ending up getting this error . Please help This is what I have done from transformers import AutoTokenizer, AutoModelForTokenClassification from transformers import pipeline tokenizer = AutoTokenizer.from_pretrained("dslim/bert-base-NER") model = …

Total answers: 1

When I run the code, it stops when the sanity check dataloader, but no error is prompted

When I run the code, it stops when the sanity check dataloader, but no error is prompted Question: Through debugging, I found that the problem occurred when I ran to the line of trainer. fit (model).It seems that there are some problems when loading data. Here’s my code WEIGHT = "bert-base-uncased" class Classifier(pl.LightningModule): def __init__(self, …

Total answers: 1

Problem completing BERT model for sentiment classification

Problem completing BERT model for sentiment classification Question: I am trying to figure out sentiment classification on movie reviews using BERT, transformers and tensorflow. This is the code I currently have: def read_dataset(filename, model_name="bert-base-uncased"): """Reads a dataset from the specified path and returns sentences and labels""" tokenizer = BertTokenizer.from_pretrained(model_name) with open(filename, "r", encoding="utf-8") as f: …

Total answers: 1

Early stopping in Bert Trainer instances

Early stopping in Bert Trainer instances Question: I am fine tuning a BERT model for a multiclass classification task. My problem is that I don’t know how to add "early stopping" to those Trainer instances. Any ideas? Asked By: soulwreckedyouth || Source Answers: There are a couple of modifications you need to perform, prior to …

Total answers: 1

Removal of Stop Words and Stemming/Lemmatization for BERTopic

Removal of Stop Words and Stemming/Lemmatization for BERTopic Question: For Topic Modelling, I’m trying out the BERTopic: Link I’m little confused here, I am trying out the BERTopic on my custom Dataset. Since BERT was trained in such a way that it holds the semantic meaning of the text/document, Should I be removing the stop …

Total answers: 3

How to test masked language model after training it?

How to test masked language model after training it? Question: I have followed this tutorial for masked language modelling from Hugging Face using BERT, but I am unsure how to actually deploy the model. Tutorial: https://github.com/huggingface/notebooks/blob/master/examples/language_modeling.ipynb I have trained the model using my own dataset, which has worked fine, but I don’t know how to …

Total answers: 2