Datasets:
Update dataset.py
Browse files- dataset.py +2 -2
dataset.py
CHANGED
@@ -4,11 +4,11 @@ from datasets import DatasetDict, Dataset, Audio
|
|
4 |
from sklearn.model_selection import train_test_split
|
5 |
|
6 |
def load_data(data_dir, test_size=0.2, seed=42):
|
7 |
-
|
8 |
metadata = pd.read_csv(os.path.join(data_dir, "metadata.csv"))
|
9 |
|
10 |
# Split the data into train and test subsets
|
11 |
-
train_data, test_data = train_test_split(metadata, test_size=
|
12 |
|
13 |
# Convert to Hugging Face datasets
|
14 |
train_dataset = Dataset.from_pandas(train_data)
|
|
|
4 |
from sklearn.model_selection import train_test_split
|
5 |
|
6 |
def load_data(data_dir, test_size=0.2, seed=42):
|
7 |
+
|
8 |
metadata = pd.read_csv(os.path.join(data_dir, "metadata.csv"))
|
9 |
|
10 |
# Split the data into train and test subsets
|
11 |
+
train_data, test_data = train_test_split(metadata, test_size=0.2, random_state=seed)
|
12 |
|
13 |
# Convert to Hugging Face datasets
|
14 |
train_dataset = Dataset.from_pandas(train_data)
|