Commit
·
461a045
1
Parent(s):
d6de56f
update
Browse files- jester_embedding.py +3 -29
jester_embedding.py
CHANGED
|
@@ -57,36 +57,10 @@ class JesterEmbedding(datasets.GeneratorBasedBuilder):
|
|
| 57 |
"filepath": data_dir,
|
| 58 |
"split": "train",
|
| 59 |
},
|
| 60 |
-
)
|
| 61 |
-
datasets.SplitGenerator(
|
| 62 |
-
name=datasets.Split.VALIDATION,
|
| 63 |
-
# These kwargs will be passed to _generate_examples
|
| 64 |
-
gen_kwargs={
|
| 65 |
-
"filepath": data_dir,
|
| 66 |
-
"split": "dev",
|
| 67 |
-
},
|
| 68 |
-
),
|
| 69 |
-
datasets.SplitGenerator(
|
| 70 |
-
name=datasets.Split.TEST,
|
| 71 |
-
# These kwargs will be passed to _generate_examples
|
| 72 |
-
gen_kwargs={
|
| 73 |
-
"filepath": data_dir,
|
| 74 |
-
"split": "test"
|
| 75 |
-
},
|
| 76 |
-
),
|
| 77 |
]
|
| 78 |
|
| 79 |
def _generate_examples(self, filepath, split):
|
| 80 |
embeddings = pd.read_parquet(filepath).values
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
if split == "train":
|
| 85 |
-
for _id, x in enumerate(train):
|
| 86 |
-
yield _id, {"x": x.reshape(1, -1)}
|
| 87 |
-
elif split == "test":
|
| 88 |
-
for _id, x in enumerate(test):
|
| 89 |
-
yield _id, {"x": x.reshape(1, -1)}
|
| 90 |
-
else:
|
| 91 |
-
for _id, x in enumerate(val):
|
| 92 |
-
yield _id, {"x": x.reshape(1, -1)}
|
|
|
|
| 57 |
"filepath": data_dir,
|
| 58 |
"split": "train",
|
| 59 |
},
|
| 60 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
]
|
| 62 |
|
| 63 |
def _generate_examples(self, filepath, split):
|
| 64 |
embeddings = pd.read_parquet(filepath).values
|
| 65 |
+
for _id, x in enumerate(embeddings):
|
| 66 |
+
yield _id, {"x": x.reshape(1, -1)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|