Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
thumbnail:
|
| 5 |
+
tags:
|
| 6 |
+
- text-classification
|
| 7 |
+
license: mit
|
| 8 |
+
datasets:
|
| 9 |
+
- imdb
|
| 10 |
+
metrics:
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# IMDB Sentiment Task: roberta-base
|
| 14 |
+
|
| 15 |
+
## Model description
|
| 16 |
+
|
| 17 |
+
A simple base roBERTa model trained on the "imdb" dataset.
|
| 18 |
+
|
| 19 |
+
## Intended uses & limitations
|
| 20 |
+
|
| 21 |
+
#### How to use
|
| 22 |
+
|
| 23 |
+
##### Transformers
|
| 24 |
+
|
| 25 |
+
```python
|
| 26 |
+
# Load model and tokenizer
|
| 27 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 28 |
+
|
| 29 |
+
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
| 30 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 31 |
+
|
| 32 |
+
# Use pipeline
|
| 33 |
+
from transformers import pipeline
|
| 34 |
+
|
| 35 |
+
model_name = "aychang/roberta-base-imdb"
|
| 36 |
+
|
| 37 |
+
nlp = pipeline("sentiment-analysis", model=model_name, tokenizer=model_name)
|
| 38 |
+
|
| 39 |
+
results = nlp(["I didn't really like it because it was so terrible.", "I love how easy it is to watch and get good results."])
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
##### AdaptNLP
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
from adaptnlp import EasySequenceClassifier
|
| 46 |
+
|
| 47 |
+
model_name = "aychang/roberta-base-imdb"
|
| 48 |
+
texts = ["I didn't really like it because it was so terrible.", "I love how easy it is to watch and get good results."]
|
| 49 |
+
|
| 50 |
+
classifer = EasySequenceClassifier
|
| 51 |
+
results = classifier.tag_text(text=texts, model_name_or_path=model_name, mini_batch_size=2)
|
| 52 |
+
```
|
| 53 |
+
|
| 54 |
+
#### Limitations and bias
|
| 55 |
+
|
| 56 |
+
This is minimal language model trained on a benchmark dataset.
|
| 57 |
+
|
| 58 |
+
## Training data
|
| 59 |
+
|
| 60 |
+
IMDB https://huggingface.co/datasets/imdb
|
| 61 |
+
|
| 62 |
+
## Training procedure
|
| 63 |
+
|
| 64 |
+
#### Hardware
|
| 65 |
+
One V100
|
| 66 |
+
|
| 67 |
+
#### Hyperparameters and Training Args
|
| 68 |
+
```python
|
| 69 |
+
from transformers import TrainingArguments
|
| 70 |
+
|
| 71 |
+
training_args = TrainingArguments(
|
| 72 |
+
output_dir='./models',
|
| 73 |
+
overwrite_output_dir=False,
|
| 74 |
+
num_train_epochs=2,
|
| 75 |
+
per_device_train_batch_size=8,
|
| 76 |
+
per_device_eval_batch_size=8,
|
| 77 |
+
warmup_steps=500,
|
| 78 |
+
weight_decay=0.01,
|
| 79 |
+
evaluation_strategy="steps",
|
| 80 |
+
logging_dir='./logs',
|
| 81 |
+
fp16=False,
|
| 82 |
+
eval_steps=800,
|
| 83 |
+
save_steps=300000
|
| 84 |
+
)
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
## Eval results
|
| 88 |
+
|
| 89 |
+
```
|
| 90 |
+
{'epoch': 2.0,
|
| 91 |
+
'eval_accuracy': 0.94668,
|
| 92 |
+
'eval_f1': array([0.94603457, 0.94731017]),
|
| 93 |
+
'eval_loss': 0.2578844428062439,
|
| 94 |
+
'eval_precision': array([0.95762642, 0.93624502]),
|
| 95 |
+
'eval_recall': array([0.93472, 0.95864]),
|
| 96 |
+
'eval_runtime': 244.7522,
|
| 97 |
+
'eval_samples_per_second': 102.144}
|
| 98 |
+
```
|