Create README.md
Browse filesAdd script to create OWT subsamples
README.md
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
These files were created with the following script:
|
2 |
+
|
3 |
+
```python
|
4 |
+
from datasets import load_dataset
|
5 |
+
from tqdm import tqdm
|
6 |
+
import io
|
7 |
+
|
8 |
+
dataset = load_dataset("Skylion007/openwebtext")['train']
|
9 |
+
split_dataset = dataset.train_test_split(train_size=2400000, test_size=60000, seed=0)
|
10 |
+
|
11 |
+
|
12 |
+
with io.open('data/owt_train.txt','w') as fopen:
|
13 |
+
listout = []
|
14 |
+
for data in tqdm(split_dataset['train']):
|
15 |
+
listout.append(data['text']+'<|endoftext|>')
|
16 |
+
if len(listout) > 1000:
|
17 |
+
_ = fopen.write(''.join(listout))
|
18 |
+
listout = []
|
19 |
+
|
20 |
+
|
21 |
+
with io.open('data/owt_valid.txt','w') as fopen:
|
22 |
+
listout = []
|
23 |
+
for data in tqdm(split_dataset['test']):
|
24 |
+
listout.append(data['text']+'<|endoftext|>')
|
25 |
+
if len(listout) > 1000:
|
26 |
+
_ = fopen.write(''.join(listout))
|
27 |
+
listout = []
|
28 |
+
```
|