JeremyAlain
commited on
Commit
•
93364fd
1
Parent(s):
456d3f6
loading script created
Browse files- 123_test.py +2 -3
123_test.py
CHANGED
@@ -129,13 +129,12 @@ class FewshotPretraining(datasets.GeneratorBasedBuilder):
|
|
129 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
130 |
def _generate_examples(self, file_paths, split):
|
131 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
132 |
-
|
133 |
-
for file_path in file_paths:
|
134 |
data = pd.read_json(file_path, orient="records", lines=True)
|
135 |
for i in range(data.shape[0]):
|
136 |
row = data.iloc[i]
|
137 |
# Yields examples as (key, example) tuples
|
138 |
-
key = str(row["task"]) + "_{}".format(i)
|
139 |
yield key, {
|
140 |
"task": data["task"],
|
141 |
"input": data["input"],
|
|
|
129 |
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
130 |
def _generate_examples(self, file_paths, split):
|
131 |
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
132 |
+
for file_idx, file_path in enumerate(file_paths):
|
|
|
133 |
data = pd.read_json(file_path, orient="records", lines=True)
|
134 |
for i in range(data.shape[0]):
|
135 |
row = data.iloc[i]
|
136 |
# Yields examples as (key, example) tuples
|
137 |
+
key = str(row["task"]) + "{}_{}".format(file_idx, i)
|
138 |
yield key, {
|
139 |
"task": data["task"],
|
140 |
"input": data["input"],
|