Datasets:
KennethEnevoldsen
commited on
Commit
•
237a43a
1
Parent(s):
f1b4261
reformatted data to jsonl.gz due to utf decode error
Browse files
data/{test-00000-of-00001.parquet → test.jsonl.gz}
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:095362409a8a4e06819ad18d4b59d03604716e9d4e3ac1070cc3019e5146e576
|
3 |
+
size 7528112
|
data/{train-00000-of-00001.parquet → train.jsonl.gz}
RENAMED
@@ -1,3 +1,3 @@
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:
|
3 |
-
size
|
|
|
1 |
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:fe4f87ffad31bf6caf3da56a6b671bbc1150e53b839a6e0f9580347334e2488f
|
3 |
+
size 9018863
|
remove_empty/remove_empty.log
CHANGED
The diff for this file is too large to render.
See raw diff
|
|
remove_empty/remove_empty.py
CHANGED
@@ -9,9 +9,10 @@ if log_file_path.exists():
|
|
9 |
log_file_path.unlink()
|
10 |
|
11 |
tasks = mteb.get_tasks(tasks=["STS22"])
|
12 |
-
task = tasks[0]
|
13 |
|
14 |
-
|
|
|
|
|
15 |
|
16 |
|
17 |
def filter_sample(x):
|
@@ -24,31 +25,26 @@ def filter_sample(x):
|
|
24 |
return False
|
25 |
|
26 |
|
27 |
-
for
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
log
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
save_path
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
log = f"Saved {hf_subset} - {split} to {save_path / split / (hf_subset + '.jsonl.gz')}"
|
51 |
-
|
52 |
-
with open(log_file_path, "a") as f:
|
53 |
-
f.write(log + "\n")
|
54 |
-
print(log)
|
|
|
9 |
log_file_path.unlink()
|
10 |
|
11 |
tasks = mteb.get_tasks(tasks=["STS22"])
|
|
|
12 |
|
13 |
+
from datasets import load_dataset
|
14 |
+
|
15 |
+
dataset = load_dataset(**tasks[0].metadata.dataset)
|
16 |
|
17 |
|
18 |
def filter_sample(x):
|
|
|
25 |
return False
|
26 |
|
27 |
|
28 |
+
for split in dataset:
|
29 |
+
ds = dataset[split]
|
30 |
+
# filter empty sentences
|
31 |
+
n_samples = len(ds)
|
32 |
+
ds = ds.filter(lambda x: filter_sample(x))
|
33 |
+
n_left = len(ds)
|
34 |
+
log = f"Filtered {n_samples - n_left} samples from {n_samples} in {split}"
|
35 |
+
with open(log_file_path, "a") as f:
|
36 |
+
f.write(log + "\n")
|
37 |
+
print(log)
|
38 |
+
|
39 |
+
dataset[split] = ds
|
40 |
+
|
41 |
+
|
42 |
+
save_path = Path(__file__).parent.parent / "data"
|
43 |
+
for split in dataset:
|
44 |
+
# dataset[split].to_parquet(save_path / f"{split}-00000-of-00001.parquet")
|
45 |
+
dataset[split].to_json(save_path / f"{split}.jsonl.gz", compression="gzip")
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
ds = load_dataset(tasks[0].metadata.dataset["path"])
|
|
|
|
|
|
|
|
|
|