File size: 2,627 Bytes
254e4f3
 
 
 
 
 
 
 
 
 
 
 
 
 
c4fb37e
254e4f3
 
 
c4fb37e
 
 
254e4f3
 
 
c4fb37e
 
 
 
7f7b357
c4fb37e
 
7f7b357
254e4f3
 
 
7f7b357
254e4f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
license: mit
tags:
- generated_from_trainer
model-index:
- name: deep-haiku-gpt-2
  results: []
---

<!-- This model card has been generated automatically according to the information the Trainer had access to. You
should probably proofread and complete it, then remove this comment. -->

# deep-haiku-gpt-2

This model is a fine-tuned version of [gpt2](https://huggingface.co/gpt2) on the [haiku](https://huggingface.co/datasets/statworx/haiku) dataset.

## Model description

The model is a fine-tuned version of GPT-2 for generation of [Haikus](https://en.wikipedia.org/wiki/Haiku). The model, data and training procedure is inspired by a [blog post by Robert A. Gonsalves](https://towardsdatascience.com/deep-haiku-teaching-gpt-j-to-compose-with-syllable-patterns-5234bca9701). Instead of using a 8bit version of GPT-J 6B, we instead used vanilla GPT-2. From what we saw, the model performance comparable but is much easier to fine-tune.

We used the same multitask training approach as in der post, but significantly extended the dataset (almost double the size of the original on). A prepared version of the dataset can be found [here](https://huggingface.co/datasets/statworx/haiku). 

## Intended uses & limitations

The model is intended to generate Haikus. To do so, it was trained using a multitask learning approach (see [Caruana 1997](http://www.cs.cornell.edu/~caruana/mlj97.pdf)) with the following four different tasks: :

 - topic2graphemes       `(keywords = text)`
 - topic2phonemes        `<keyword_phonemes = text_phonemes>`
 - graphemes2phonemes   `[text = text_phonemes]`
 - phonemes2graphemes    `{text_phonemes = text}`
 
 To use the model, use an appropriate prompt like `"(dog rain ="` and let the model generate a Haiku given the keyword.

## Training and evaluation data

We used a collection of existing haikus for training. Furthermore, all haikus were used in their graphemes version as well as a phonemes version. In addition, we extracted key word for all haikus using [KeyBERT](https://github.com/MaartenGr/KeyBERT) and sorted out haikus with a low text quality according to the [GRUEN score](https://github.com/WanzhengZhu/GRUEN).

## Training procedure

### Training hyperparameters

The following hyperparameters were used during training:
- learning_rate: 5e-05
- train_batch_size: 2
- eval_batch_size: 2
- seed: 42
- optimizer: Adam with betas=(0.9,0.999) and epsilon=1e-08
- lr_scheduler_type: linear
- lr_scheduler_warmup_steps: 100
- num_epochs: 10

### Training results



### Framework versions

- Transformers 4.19.2
- Pytorch 1.11.0+cu102
- Datasets 2.2.1
- Tokenizers 0.12.1