JiaqiLee commited on
Commit
d0bed35
1 Parent(s): ed761eb

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +36 -0
README.md ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ datasets:
4
+ - yelp_polarity
5
+ language:
6
+ - en
7
+ metrics:
8
+ - accuracy
9
+ library_name: transformers
10
+ pipeline_tag: text-classification
11
+ ---
12
+
13
+ ## Model description
14
+ This model is a fine-tuned version of the [bert-base-uncased](https://huggingface.co/transformers/model_doc/bert.html) model to classify the sentiment of yelp reviews. \
15
+ The BERT model is finetuned using adversarial training to boost robustness against textual adversarial attacks.
16
+
17
+ ## How to use
18
+
19
+ You can use the model with the following code.
20
+
21
+ ```python
22
+ from transformers import BertForSequenceClassification, BertTokenizer, TextClassificationPipeline
23
+ model_path = "JiaqiLee/robust-bert-yelp"
24
+ tokenizer = BertTokenizer.from_pretrained(model_path)
25
+ model = BertForSequenceClassification.from_pretrained(model_path, num_labels=2)
26
+ pipeline = TextClassificationPipeline(model=model, tokenizer=tokenizer)
27
+ print(pipeline("Definitely a greasy spoon! Always packed here and always a wait but worth it."))
28
+ ```
29
+
30
+ ## Training data
31
+ The training data comes Huggingface [yelp polarity dataset](https://huggingface.co/datasets/yelp_polarity). We use 90% of the `train.csv` data to train the model. \
32
+ We augment original training data with adversarial examples generated by PWWS, TextBugger and TextFooler.
33
+
34
+ ## Evaluation results
35
+
36
+ The model achieves 0.9532 accuracy in yelp polarity test dataset.