File size: 411 Bytes
0dc226d
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
from datasets import load_dataset

# Load the dataset with only the "text" column
dataset = load_dataset("nRuaif/MusicLM", split="train", columns=["text"], streaming=True)

# Open a file to write the text data to
with open("output.txt", "w") as f:
    # Stream through the dataset and write the "text" column to the file, separated by newline
    for example in dataset:
        f.write(example["text"] + "\n")