Fix the sample code
#4
by
torotoki
- opened
README.md
CHANGED
|
@@ -62,16 +62,10 @@ dataset_info:
|
|
| 62 |
To use for e.g. character modelling:
|
| 63 |
|
| 64 |
```
|
| 65 |
-
d = datasets.load_dataset(
|
| 66 |
-
d = d.map(lambda x:
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
d = d.map(lambda x: {'cur_char': x[:-1], 'next_char': x[1:]})
|
| 70 |
-
d = d.unbatch()
|
| 71 |
-
seq_len = 100
|
| 72 |
-
batch_size = 2
|
| 73 |
-
d = d.batch(seq_len)
|
| 74 |
-
d = d.batch(batch_size)
|
| 75 |
```
|
| 76 |
|
| 77 |
### Supported Tasks and Leaderboards
|
|
|
|
| 62 |
To use for e.g. character modelling:
|
| 63 |
|
| 64 |
```
|
| 65 |
+
d = datasets.load_dataset('tiny_shakespeare', split='train')
|
| 66 |
+
d = d.map(lambda x: {'tokens': list(x['text'])})
|
| 67 |
+
vocabulary = set(d['tokens'][0])
|
| 68 |
+
print(d['tokens'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
```
|
| 70 |
|
| 71 |
### Supported Tasks and Leaderboards
|