Update Getting Started code as previous version doesn't work anymore
#4
by
celex
- opened
README.md
CHANGED
|
@@ -24,10 +24,10 @@ Preprocessing, training and implementation details can be found in the [personaG
|
|
| 24 |
```python
|
| 25 |
from transformers import GPT2Tokenizer, GPT2LMHeadModel
|
| 26 |
import torch
|
| 27 |
-
tokenizer =
|
| 28 |
-
model =
|
| 29 |
if torch.cuda.is_available():
|
| 30 |
-
|
| 31 |
## utility functions ##
|
| 32 |
flatten = lambda l: [item for sublist in l for item in sublist]
|
| 33 |
|
|
|
|
| 24 |
```python
|
| 25 |
from transformers import GPT2Tokenizer, GPT2LMHeadModel
|
| 26 |
import torch
|
| 27 |
+
tokenizer = GPT2Tokenizer.from_pretrained("af1tang/personaGPT")
|
| 28 |
+
model = GPT2LMHeadModel.from_pretrained("af1tang/personaGPT")
|
| 29 |
if torch.cuda.is_available():
|
| 30 |
+
model = model.cuda()
|
| 31 |
## utility functions ##
|
| 32 |
flatten = lambda l: [item for sublist in l for item in sublist]
|
| 33 |
|