Migrate model card from transformers-repo
Browse filesRead announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/lvwerra/gpt2-imdb/README.md
README.md
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# GPT2-IMDB
|
2 |
+
|
3 |
+
## What is it?
|
4 |
+
A GPT2 (`gpt2`) language model fine-tuned on the [IMDB dataset](https://www.kaggle.com/lakshmi25npathi/imdb-dataset-of-50k-movie-reviews).
|
5 |
+
|
6 |
+
## Training setting
|
7 |
+
|
8 |
+
The GPT2 language model was fine-tuned for 1 epoch on the IMDB dataset. All comments were joined into a single text file separated by the EOS token:
|
9 |
+
|
10 |
+
```
|
11 |
+
import pandas as pd
|
12 |
+
df = pd.read_csv("imdb-dataset.csv")
|
13 |
+
imdb_str = " <|endoftext|> ".join(df['review'].tolist())
|
14 |
+
|
15 |
+
with open ('imdb.txt', 'w') as f:
|
16 |
+
f.write(imdb_str)
|
17 |
+
```
|
18 |
+
|
19 |
+
To train the model the `run_language_modeling.py` script in the `transformer` library was used:
|
20 |
+
|
21 |
+
```
|
22 |
+
python run_language_modeling.py
|
23 |
+
--train_data_file imdb.txt
|
24 |
+
--output_dir gpt2-imdb
|
25 |
+
--model_type gpt2
|
26 |
+
--model_name_or_path gpt2
|
27 |
+
```
|