Update README.md
Browse files
README.md
CHANGED
|
@@ -21,4 +21,13 @@ Full credits to: [fchollet](https://twitter.com/fchollet)
|
|
| 21 |
This example demonstrates how to implement text generation with a miniature GPT model. The model consists of a single Transformer block with causal masking in its attention layer.
|
| 22 |
|
| 23 |
## Datasets
|
| 24 |
-
IMDB sentiment classification dataset for training. The model generates new movie reviews for a given prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
This example demonstrates how to implement text generation with a miniature GPT model. The model consists of a single Transformer block with causal masking in its attention layer.
|
| 22 |
|
| 23 |
## Datasets
|
| 24 |
+
IMDB sentiment classification dataset for training. The model generates new movie reviews for a given prompt
|
| 25 |
+
|
| 26 |
+
## How to use
|
| 27 |
+
You can use this model directly with a pipeline for text generation. Since the generation relies on some randomness, I
|
| 28 |
+
set seed for reproducibility:
|
| 29 |
+
```python
|
| 30 |
+
>>>from transformers import pipeline, set_seed
|
| 31 |
+
>>>model = generation= pipeline('text-generation', model='keras-io/text-generation-miniature-gpt', tokenizer='bert-base-uncased')
|
| 32 |
+
>>>set_seed(20)
|
| 33 |
+
>>>generation("Once upon a time,", max_length=30, num_return_sequences=5)
|