Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
|
4 |
+
```python
|
5 |
+
|
6 |
+
|
7 |
+
from datasets import load_dataset
|
8 |
+
dataset = load_dataset("LeroyDyer/Mahabharata", split = "train[:5000]")
|
9 |
+
EOS_TOKEN = tokenizer.eos_token
|
10 |
+
|
11 |
+
def formatting_func(example):
|
12 |
+
max_seq_length = 4098 # Maximum sequence length
|
13 |
+
text = example["Text"] + EOS_TOKEN
|
14 |
+
chunks = [text[i:i+max_seq_length] for i in range(0, len(text), max_seq_length)]
|
15 |
+
formatted_examples = [{"Text": chunk} for chunk in chunks]
|
16 |
+
return formatted_examples
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
```
|