Add model cards (#3537)
* feat: add model card bert-imdb * feat: add model card gpt2-imdb-pos * feat: add model card gpt2-imdb
This commit is contained in:
committed by
GitHub
parent
e5c393dceb
commit
a6c4ee27fd
14
model_cards/lvwerra/bert-imdb/README.md
Normal file
14
model_cards/lvwerra/bert-imdb/README.md
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
# BERT-IMDB
|
||||||
|
|
||||||
|
## What is it?
|
||||||
|
BERT (`bert-large-cased`) trained for sentiment classification on the [IMDB dataset](https://www.kaggle.com/lakshmi25npathi/imdb-dataset-of-50k-movie-reviews).
|
||||||
|
|
||||||
|
## Training setting
|
||||||
|
|
||||||
|
The model was trained on 80% of the IMDB dataset for sentiment classification for three epochs with a learning rate of `1e-5` with the `simpletransformers` library. The library uses a learning rate schedule.
|
||||||
|
|
||||||
|
## Result
|
||||||
|
The model achieved 90% classification accuracy on the validation set.
|
||||||
|
|
||||||
|
## Reference
|
||||||
|
The full experiment is available in the [tlr repo](https://lvwerra.github.io/trl/03-bert-imdb-training/).
|
||||||
18
model_cards/lvwerra/gpt2-imdb-pos/README.md
Normal file
18
model_cards/lvwerra/gpt2-imdb-pos/README.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# GPT2-IMDB-pos
|
||||||
|
|
||||||
|
## What is it?
|
||||||
|
A small GPT2 (`lvwerra/gpt2-imdb`) language model fine-tuned to produce positive movie reviews based the [IMDB dataset](https://www.kaggle.com/lakshmi25npathi/imdb-dataset-of-50k-movie-reviews). The model is trained with rewards from a BERT sentiment classifier (`lvwerra/gpt2-imdb`) via PPO.
|
||||||
|
|
||||||
|
## Training setting
|
||||||
|
The model was trained for `100` optimisation steps with a batch size of `256` which corresponds to `25600` training samples. The full experiment setup can be found in the Jupyter notebook in the [trl repo](https://lvwerra.github.io/trl/04-gpt2-sentiment-ppo-training/).
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
A few examples of the model response to a query before and after optimisation:
|
||||||
|
|
||||||
|
| query | response (before) | response (after) | rewards (before) | rewards (after) |
|
||||||
|
|-------|-------------------|------------------|------------------|-----------------|
|
||||||
|
|I'd never seen a |heavier, woodier example of Victorian archite... |film of this caliber, and I think it's wonder... |3.297736 |4.158653|
|
||||||
|
|I love John's work |but I actually have to write language as in w... |and I hereby recommend this film. I am really... |-1.904006 |4.159198 |
|
||||||
|
|I's a big struggle |to see anyone who acts in that way. by Jim Th... |, but overall I'm happy with the changes even ... |-1.595925 |2.651260|
|
||||||
|
|
||||||
|
|
||||||
27
model_cards/lvwerra/gpt2-imdb/README.md
Normal file
27
model_cards/lvwerra/gpt2-imdb/README.md
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
# GPT2-IMDB
|
||||||
|
|
||||||
|
## What is it?
|
||||||
|
A GPT2 (`gpt2`) language model fine-tuned on the [IMDB dataset](https://www.kaggle.com/lakshmi25npathi/imdb-dataset-of-50k-movie-reviews).
|
||||||
|
|
||||||
|
## Training setting
|
||||||
|
|
||||||
|
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:
|
||||||
|
|
||||||
|
```
|
||||||
|
import pandas as pd
|
||||||
|
df = pd.read_csv("imdb-dataset.csv")
|
||||||
|
imdb_str = " <|endoftext|> ".join(df['review'].tolist())
|
||||||
|
|
||||||
|
with open ('imdb.txt', 'w') as f:
|
||||||
|
f.write(imdb_str)
|
||||||
|
```
|
||||||
|
|
||||||
|
To train the model the `run_language_modeling.py` script in the `transformer` library was used:
|
||||||
|
|
||||||
|
```
|
||||||
|
python run_language_modeling.py
|
||||||
|
--train_data_file imdb.txt
|
||||||
|
--output_dir gpt2-imdb
|
||||||
|
--model_type gpt2
|
||||||
|
--model_name_or_path gpt2
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user