Downloads · 30 days
11
0% of all-time downloads
JiaqiLee/robust-bert-yelp
robust-bert-yelp is a text classification model from JiaqiLee. Use it when you need a label for a piece of text. It is set up for transformers. The card lists the license as apache-2.0.
This model is a fine-tuned version of the bert-base-uncased model to classify the sentiment of yelp reviews. \ The BERT model is finetuned using adversarial training to boost robustness against textual adversarial att…
Downloads · 30 days
11
0% of all-time downloads
All-time downloads
2.3K
Public
Repo size
1.3 GB
Likes
1
Public
Click a slice to open those files.
.bin438 MB · 100%
From the Hugging Face model README
This model is a fine-tuned version of the bert-base-uncased model to classify the sentiment of yelp reviews.
The BERT model is finetuned using adversarial training to boost robustness against textual adversarial attacks.
You can use the model with the following code.
from transformers import BertForSequenceClassification, BertTokenizer, TextClassificationPipeline
model_path = "JiaqiLee/robust-bert-yelp"
tokenizer = BertTokenizer.from_pretrained(model_path)
model = BertForSequenceClassification.from_pretrained(model_path, num_labels=2)
pipeline = TextClassificationPipeline(model=model, tokenizer=tokenizer)
print(pipeline("Definitely a greasy spoon! Always packed here and always a wait but worth it."))
The training data comes from Huggingface yelp polarity dataset. We use 90% of the train.csv data to train the model.
We augment original training data with adversarial examples generated by PWWS, TextBugger and TextFooler.
The model achieves 0.9532 accuracy in yelp polarity test dataset.