Commit
·
fe86b68
1
Parent(s):
c672dbe
Update README.md
Browse files
README.md
CHANGED
@@ -36,7 +36,7 @@ It achieves the following results on the evaluation set:
|
|
36 |
- F1: 95.084
|
37 |
- Gen Len: 2.4976
|
38 |
|
39 |
-
```
|
40 |
precision recall f1-score support
|
41 |
|
42 |
0 0.97 0.88 0.92 12500
|
@@ -56,12 +56,12 @@ This model was trained on the imdb train dataset with 25,000 data and then teste
|
|
56 |
|
57 |
## Usage
|
58 |
|
59 |
-
|
60 |
```python
|
61 |
!pip install transformers==4.28.1 datasets
|
62 |
```
|
63 |
|
64 |
-
|
65 |
```python
|
66 |
from datasets import load_dataset
|
67 |
|
@@ -71,7 +71,7 @@ dataset_id = "imdb"
|
|
71 |
dataset = load_dataset(dataset_id)
|
72 |
```
|
73 |
|
74 |
-
|
75 |
```python
|
76 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
77 |
tokenizer = AutoTokenizer.from_pretrained("mohammadtaghizadeh/flan-t5-base-imdb-text-classification")
|
@@ -79,7 +79,7 @@ model = AutoModelForSeq2SeqLM.from_pretrained("mohammadtaghizadeh/flan-t5-base-i
|
|
79 |
model.to('cuda')
|
80 |
```
|
81 |
|
82 |
-
|
83 |
```python
|
84 |
from tqdm.auto import tqdm
|
85 |
|
@@ -98,7 +98,7 @@ for i in range(samples_number):
|
|
98 |
progress_bar.update(1)
|
99 |
```
|
100 |
|
101 |
-
|
102 |
```python
|
103 |
from sklearn.metrics import classification_report
|
104 |
|
@@ -109,7 +109,7 @@ report = classification_report(str_labels_list, predictions_list)
|
|
109 |
print(report)
|
110 |
```
|
111 |
|
112 |
-
|
113 |
```cmd
|
114 |
precision recall f1-score support
|
115 |
|
|
|
36 |
- F1: 95.084
|
37 |
- Gen Len: 2.4976
|
38 |
|
39 |
+
```cmd
|
40 |
precision recall f1-score support
|
41 |
|
42 |
0 0.97 0.88 0.92 12500
|
|
|
56 |
|
57 |
## Usage
|
58 |
|
59 |
+
1. Install dependencies
|
60 |
```python
|
61 |
!pip install transformers==4.28.1 datasets
|
62 |
```
|
63 |
|
64 |
+
2. Load IMDB Corpus
|
65 |
```python
|
66 |
from datasets import load_dataset
|
67 |
|
|
|
71 |
dataset = load_dataset(dataset_id)
|
72 |
```
|
73 |
|
74 |
+
3. Load fine tune flan t5 model
|
75 |
```python
|
76 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
77 |
tokenizer = AutoTokenizer.from_pretrained("mohammadtaghizadeh/flan-t5-base-imdb-text-classification")
|
|
|
79 |
model.to('cuda')
|
80 |
```
|
81 |
|
82 |
+
4. Test the model
|
83 |
```python
|
84 |
from tqdm.auto import tqdm
|
85 |
|
|
|
98 |
progress_bar.update(1)
|
99 |
```
|
100 |
|
101 |
+
5. Classification report
|
102 |
```python
|
103 |
from sklearn.metrics import classification_report
|
104 |
|
|
|
109 |
print(report)
|
110 |
```
|
111 |
|
112 |
+
Output
|
113 |
```cmd
|
114 |
precision recall f1-score support
|
115 |
|