Codyfederer commited on
Commit
f6100c1
·
verified ·
1 Parent(s): 5fe830a

Delete load_dataset.txt

Browse files
Files changed (1) hide show
  1. load_dataset.txt +0 -46
load_dataset.txt DELETED
@@ -1,46 +0,0 @@
1
- # Dataset Loading Script
2
- # Save this as load_dataset.py to use
3
-
4
- import csv
5
- import os
6
- from datasets import Dataset, Audio, Value, Features
7
-
8
- def load_dataset():
9
- # Define features
10
- features = Features({
11
- # Preserve original sampling rates by not forcing a fixed rate
12
- "audio": Audio(sampling_rate=None),
13
- "text": Value("string"),
14
- "speaker_id": Value("string"),
15
- "emotion": Value("string"),
16
- "language": Value("string")
17
- })
18
-
19
- # Load data from CSV
20
- data = {
21
- "audio": [],
22
- "text": [],
23
- "speaker_id": [],
24
- "emotion": [],
25
- "language": []
26
- }
27
-
28
- # Read JSONL
29
- import json
30
- with open("data.jsonl", "r", encoding="utf-8") as f:
31
- for line in f:
32
- obj = json.loads(line)
33
- data["audio"].append(obj["audio"]) # relative path within repo
34
- data["text"].append(obj.get("text", ""))
35
- data["speaker_id"].append(obj.get("speaker_id", ""))
36
- data["emotion"].append(obj.get("emotion", "neutral"))
37
- data["language"].append(obj.get("language", "en"))
38
-
39
- # Create dataset
40
- dataset = Dataset.from_dict(data, features=features)
41
- return dataset
42
-
43
- # For direct loading
44
- if __name__ == "__main__":
45
- dataset = load_dataset()
46
- print(f"Dataset loaded with {len(dataset)} examples")