All Questions

Filter by
Sorted by
Tagged with
5 votes
1 answer
11k views

Overfitting when fine-tuning BERT sentiment analysis

I am newbie to Machine Learning in general. I am currently trying to follow a tutorial on sentiment analysis using BERT and Transformers https://curiousily.com/posts/sentiment-analysis-with-bert-and-...
hhp's user avatar
  • 121
4 votes
0 answers
2k views

ValueError: Exception encountered when calling layer "tf_bert_for_sequence_classification" (type TFBertForSequenceClassification)

train = df2[:25] test = df2[25:] def convert_data_to_examples(train, test, text, Airline_Cat): train_InputExamples = train.apply(lambda x: InputExample(guid=None, ...
Nandhini Palanikumar's user avatar
2 votes
1 answer
984 views

Why does Transformer's BERT (for sequence classification) output depend heavily on maximum sequence length padding?

I am using Transformer's RobBERT (the dutch version of RoBERTa) for sequence classification - trained for sentiment analysis on the Dutch Book Reviews dataset. I wanted to test how well it works on a ...
Wouter S's user avatar
2 votes
3 answers
2k views

BERT Multi-class Sentiment Analysis got low accuracy?

I am working on a small data set which: Contains 1500 pieces of news articles. All of these articles were ranked by human beings with regard to their sentiment/degree of positive on a 5-point scale. ...
Xu Wang's user avatar
  • 21
2 votes
1 answer
6k views

CUDA error: CUBLAS_STATUS_INVALID_VALUE error when training BERT model using HuggingFace

I am working on sentiment analysis on steam reviews dataset using BERT model where I have 2 labels: positive and negative. I have fine-tuned the model with 2 Linear layers and the code for that is as ...
user11619814's user avatar
2 votes
1 answer
697 views

How to apply random forests to the output produced by Bert?

I'm trying to get the output embeddings of a RoBERTa model, so I can train a random forests classifier on it for text classification (sentiment analysis). The original dataset this is based on is 500 ...
pyroshark's user avatar
2 votes
2 answers
1k views

Is it necessary to re-train BERT models, specifically RoBERTa model?

I am looking for a sentiment analysis code with atleast 80%+ accuracy. I tried Vader and it I found it easy and usable, however it was giving accuracy of 64% only. Now, I was looking at some BERT ...
Shrumo's user avatar
  • 47
1 vote
3 answers
812 views

Finding the scores for each tweet with a BERT-based sentiment analysis model

I am doing a sentiment analysis of twitter posts and I have a question regarding “German Sentiment Classification with Bert”: I would like to display the sentiment score (positive, negative, neutral) ...
Valeriomerio's user avatar
1 vote
0 answers
2k views

How do I fix: AxisError: axis 1 is out of bounds for array of dimension 1

I am currently working on a twitter sentiment analysis project using BERT and HuggingFace transformer library. When it comes to training the model, I am facing this error: AxisError: axis 1 is out of ...
Vincent Van's user avatar
1 vote
0 answers
205 views

How to Distill model based Roberta?

I'd like apply distill process on a sentiment analysis model (pysentimiento/robertuito-sentiment-analysis). I'm following all steps, but I don't get good scores of the sentiment in student model (...
Erick Díaz's user avatar
1 vote
1 answer
147 views

How go view accuracy for both classes rather than each class accuracy being shown individually in bert sentiment analaysis

im pretty new at using bert and honestly i feel a bit lost. Ive been trying out various online github/kaggle codes to see how it works on my dataset. anyway im at the point that i get the accuracy of ...
Andrew Anorthosis Timotheou's user avatar
1 vote
1 answer
2k views

Bert Text Classification Loss is Nan

I'm try to make an model that classify the text in 3 categories.(Negative,Neural,Positive) I have csv file that contain comments on different apps with their rating. First I import all the necessary ...
user avatar
0 votes
1 answer
668 views

Huggingface giving pytorch index error on sentiment analysis task

I am trying to run sentiment analysis on a dataset of millions of tweets on the server. I am calling a API prediction function that takes a list of 100 tweets and iterate over the test of each tweet ...
Youcef's user avatar
  • 1,193
0 votes
2 answers
1k views

Does Fine-tunning Bert Model in multiple times with different dataset make it more accuracy?

i'm totally new in NLP and Bert Model. What im trying to do right now is Sentiment Analysis on Twitter Trending Hashtag ("neg", "neu", "pos") by using DistilBert Model, ...
Nguyen Hoang Chu's user avatar
0 votes
1 answer
573 views

Almost non-existent training accuracy and low test accuracy

I am really new to Machine Learning and I am not so well versed in coding in general. However there is need to look through the customers feedback at our store, that average quite a lot each year, yet ...
hhp's user avatar
  • 121
0 votes
2 answers
3k views

Bert Tokenizer is not working despite importing all packages. Is there a new syntax change to this?

Trying to run the tokenizer for Bert but I keep getting errors. Can anyone help where I am going wrong. FullTokenizer = bert.bert_tokenization.FullTokenizer bert_layer = hub.KerasLayer("https://tfhub....
L Akshay's user avatar
0 votes
1 answer
508 views

Problem completing BERT model for sentiment classification

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-...
Rewaster's user avatar
0 votes
1 answer
419 views

How can I change self attention layer numbers and multihead attention head numbers in my model with Pytorch?

I working on sarcasm dataset and my model like below: I first tokenize my input text: PRETRAINED_MODEL_NAME = "roberta-base" from transformers import AutoTokenizer tokenizer = AutoTokenizer....
mahdi rafiei's user avatar
0 votes
1 answer
219 views

OOM error when training the BERT Keras model

I am working on training the fine-tuned BERT model using Keras. However when I start the training on GPU, I am facing the OOM error. The below is the code of my model. max_len = 256 input_word_ids ...
user11619814's user avatar
0 votes
0 answers
33 views

Model Accuracy Using Transformer

I'm trying to increase the Accuracy of my Model. The model aims to leverage BERT's contextual understanding of language to perform binary classification on IMDb movie reviews. By fine-tuning specific ...
Syedumeerr's user avatar
0 votes
3 answers
431 views

Modifying last layer of a pre-trained sentiment classification model to get a linear output

How can I modify a pre-trained sentiment classification model (e.g., 'bert-base-multilingual-uncased-sentiment') to output a value between 0 and 1 instead of a classification tensor? The output should ...
GlitzerImHirn's user avatar
0 votes
0 answers
159 views

Fine tune BERT model to predict aspect-based sentiment analysis model

I'm new to transformers for NLP. I'm building an aspect-based sentiment analysis model. which is training a model to predict aspects of product features in the customer reviews on my website and ...
Lahiru_prabhath's user avatar
0 votes
0 answers
257 views

How do I fix ValueError: Classification metrics can't handle a mix of multiclass and continuous-multioutput targets?

I am currently learning how sentiment analysis and machine learning works. I am following this tutorial and this is the Github source code. When it comes to training the model, I am facing this error: ...
John's user avatar
  • 29
0 votes
1 answer
472 views

`logits` and `labels` must have the same shape, received ((None, 512, 768) vs (None, 1)) when using transformers

I get the next error when im trying to fine tuning a bert model to predict sentiment analysis. Im using as input: X-A list of strings that contains tweets y-a numeric list (0 - negative, 1 - positive) ...
Fran's user avatar
  • 3
0 votes
1 answer
271 views

Using static embeddings compatible with BERT

I have a dataset of utterances and corresponding sentiment label. I want to use an embedding of the sentiment label as an additional input to BERT (To simplify things, you can say that I want to ...
bh00t's user avatar
  • 71
0 votes
1 answer
87 views

Span-Aste with allennlp - testing against new unseen and unlabeled data

I am trying to use this colab of this github page to extract the triplet [term, opinion, value] from a sentence from my custom dataset. Here is an overview of the system architecture: While I can use ...
KeyPi's user avatar
  • 516
0 votes
1 answer
879 views

Fine-tune BERT model by removing unused layers

I came across this code for BERT sentiment analysis where the unused layers are removed, Update trainable vars/trainable weights are added and I am looking for documentation which shows what are the ...
user11619814's user avatar
0 votes
0 answers
617 views

Text classification using BERT model

I have built and trained the BERT model, using this code. Now I have this data: and using this built function to classify each row in the text column as 0 or 1. import random def predict_emotion(...
Michael Carrasco's user avatar
0 votes
1 answer
374 views

FastAPI return BERT model result and metrics

I have sentiment analysis model using BERT and I want to get the result from predicting text via FastAPI but it always give negative answer (I think it is because the prediction didn't give prediction ...
OctavianWR's user avatar
0 votes
0 answers
186 views

problem in training RNN using bert embeddings

I have been working with bert embedding using a neural network model for the sentiment classification task. during model fit it's giving indices error, and I am still new to this so could not able to ...
shankar's user avatar
  • 39
-1 votes
0 answers
22 views

TypeError: dropout(): argument 'input' (position 1) must be Tensor, not str

F.softmax(model(input_ids, attention_mask), dim=1) here is my code and show the error --------------------------------------------------------------------------- TypeError ...
night snow's user avatar
-1 votes
1 answer
495 views

How to get sentiment score for a word in a given dataset

I have a sentiment analysis dataset that is labeled in three categories: positive, negative, and neutral. I also have a list of words (mostly nouns), for which I want to calculate the sentiment value, ...
Dipto Das's user avatar
-2 votes
1 answer
91 views

Sentiment analysis in a generic text with Transformers

Is it correct to use BERT (or any other Transformers-based model) finetuned with a dataset like IMDb if I want to do sentiment analysis in a generic text (unrelated with movies)? If not, how should I ...
Antonio Gagliostro's user avatar