KennethEnevoldsen commited on
Commit
df528fb
1 Parent(s): de9d86b

removed empty text files

Browse files
remove_empty/remove_empty.log ADDED
The diff for this file is too large to render. See raw diff
 
remove_empty/remove_empty.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+
3
+ import mteb
4
+
5
+ log_file_path = Path("remove_empty.log")
6
+
7
+ # remove log file if exists
8
+ if log_file_path.exists():
9
+ log_file_path.unlink()
10
+
11
+ tasks = mteb.get_tasks(tasks=["STS22"])
12
+ task = tasks[0]
13
+
14
+ task.load_data()
15
+
16
+
17
+ def filter_sample(x):
18
+ if len(x["sentence1"]) > 0 and len(x["sentence2"]) > 0:
19
+ return True
20
+ log = f"Filtered: {x['sentence1']} -- {x['sentence2']}"
21
+ with open(log_file_path, "a") as f:
22
+ f.write(log + "\n")
23
+ print(log)
24
+ return False
25
+
26
+
27
+ for hf_subset in task.dataset:
28
+ _ds = task.dataset[hf_subset]
29
+ for split in _ds:
30
+ ds = _ds[split]
31
+ # filter empty sentences
32
+ n_samples = len(ds)
33
+ ds = ds.filter(lambda x: filter_sample(x))
34
+ n_left = len(ds)
35
+ log = f"Filtered {n_samples - n_left} samples from {n_samples} in {hf_subset} - {split}"
36
+ with open(log_file_path, "a") as f:
37
+ f.write(log + "\n")
38
+ print(log)
39
+ _ds[split] = ds
40
+
41
+ task.dataset[hf_subset] = _ds
42
+
43
+ save_path = Path(__file__).parent.parent
44
+
45
+ for hf_subset in task.dataset:
46
+ _ds = task.dataset[hf_subset]
47
+ for split in _ds:
48
+ ds = _ds[split]
49
+ ds.to_json(save_path / split / (hf_subset + ".jsonl.gz"), compression="gzip")
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)
test/ar.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:482e2583089d2d1ee96f5de89ee32303424720970f53ee32351c6389607594ce
3
- size 330527
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:187eb168ffec0aefee35ca6b3229f7d6584acbf889850152f4d6bda2a4e7a176
3
+ size 328511
test/de-en.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d4ffbb87e265949fd6dfa8a9fbf45fe953607a5e28cc98c4243830c814f7acd7
3
- size 309923
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:90f8e602800fa5ff941d97b84d120084b55e9ada3124f1a174a373ab25eb0d39
3
+ size 308458
test/de-fr.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:af974a3ef7233f3daf17423da8cf33f1b8edfaf1a9bde7e1c31fb9842150576d
3
- size 238019
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a86358f459079e8a764747eae4c76d1bd87b7ba0ca759e7ad695e5cb9edae17
3
+ size 236251
test/de-pl.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:4f539d98e7eee04ff76e4dd0cf1ddb0ed9b6d231e54673ec1f81ece448b714fa
3
- size 91335
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9818e535b44bcd78a479ebd85b54f8ea392885f78a102f2651c2ec46b0ad2c0e
3
+ size 91332
test/de.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:358ac46b9b69084b557e07658aca3c95a151b877d8d9b8f6d198bf9fccfd1b6a
3
- size 819094
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:28d2ddb2d30b768f6a6ee0869808adf861e4293d843d546d97b352c403792bb8
3
+ size 819127
test/en.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:3eb7deabd4c2761eb07273ff35514dc4ded6205c10686dbebab94175219a730a
3
- size 425380
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee23e28a49d9cf8441ce152600c6bf5334fc5346effd62d8359d26e3314e63eb
3
+ size 425298
test/es-en.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ba4fafebb3ba50ad5ae40e9ff20cf36b759499d304b835d533b2110799067e58
3
- size 844168
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:01b3fbe3909d6795d4508279d5a994b3c9434e0dd80b8eb219bb4d63992f3179
3
+ size 836853
test/es-it.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:cbe06055870ed8aceebe431bc3bf1c1cee0f3a6ab273f4311ccc254218c172a2
3
- size 436068
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a453d85ad8451de6f13c8931d5b3b18f3ea4c73ee23d11fd410d27bdaef4e07c
3
+ size 432309
test/es.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:1ea4f04077af7bd3db3d535b7622c55550c7907b4fb7eac5696efbd698f7c0f3
3
- size 282680
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e282ee0378ad37ab77f3b32a9eca4e5e487bd124235dc47df9d0a5198ec4ec9c
3
+ size 279325
test/fr-pl.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:97438ffff5bb73ef213f0da3a6ee714838fb63066c1655c2a340daf658363eaa
3
- size 22061
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d12bbfb51e2a13ac7b12406fe98616ab42c2cbf3eb09c6a29505d91470a4462b
3
+ size 22047
test/fr.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c3c934cee064e671e54e1bf4038ad3583b94c7610860c5ee9647cb8763ced4b0
3
- size 203823
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62f4b1e305145c36c4565951e60f934776f83267b8c17eb06e76d0c89519e78c
3
+ size 200329
test/it.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:43cc535b8e382c5fc103451fa67afab6ffbe081271484cda4e8e6721cbc4ae33
3
- size 581916
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e50cc118bff99f42767a40817e2de9a5e78668f6c371239ac1358fa8c15ba00b
3
+ size 580370
test/pl-en.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:8e82f48677cbb0b9134c5f748c060d8679bc1e977b8e35175abba7fc4896f4c0
3
- size 121706
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a88c480b346723fbec627b98db6d0897e5c3e26ec2e6989313a264a470e8a8a
3
+ size 120128
test/pl.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:895aeddaa2cd782ef8e4f631bea056d6a092c6bca82949a93432182d248fab41
3
- size 307248
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e1ced4c58d7a804393b7b53bf1486645e07b9f703188458f1610822d58b33402
3
+ size 304228
test/ru.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f7819276616cd80b76d0a8b66d1ebe487f1185d74120d559e77e3548ff5628b0
3
- size 499215
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:752faa8c082023be8dc3c23353b9a0968b14ad009dcc31035c7c654315bbe939
3
+ size 495875
test/tr.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e44ede954ebff4fdb46c5d92edcc76053b023ab7432ce0cf1518d78a20c1adea
3
- size 332418
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:53bc7b2c311a2e278d5901953624e837bd17609b2e52f68e514ae4fc43a211b8
3
+ size 327831
test/zh-en.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6f451473eed14a9db17565d3c8c6059979af87e223886ea1b5d9b1a601b22a29
3
- size 526594
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:99176a7078e9d69ef35f435afd926473b2a0a79cc9ef10b8f4a2f4b3cc134039
3
+ size 513457
test/zh.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:bccc54f9e7a853fe06a15b5fc223e1d2f2a940d06668188abf2c2051228c8f23
3
- size 1230947
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:06f285366193eb6604032995c296a6146eacf8aa0128b4a8c4a40397bdf7992b
3
+ size 1208745
train/ar.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7853a2809701d5891ac03aec487e053a5449c80d13a2240f22de139329025652
3
- size 371563
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:77e7a31949f26449b17282ebf8f2a3781b870c9cb36b0c0d9b0706d7283b8de6
3
+ size 367773
train/de-en.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6802677561cc61c2e35d660d5431943d4f173983b55a9549c2641fb294244039
3
- size 1127741
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:87ccfb4866958da246a7528102d282e7cc4081e5bfd49d6dcb799e18abc63524
3
+ size 1114867
train/de.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7056da109dd23751a642211b2ab49f9cb5edcd9045e7d35e9847893129451f91
3
- size 1420141
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1b37b74ade3a3787e5bce1b6d8d7876cb59f866ecfbb7d488127a0d1e7b1a862
3
+ size 1417784
train/en.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:aef91d07eaa45a1e9713903450f460db180d902ac63580b5d6c50e0bf45dbea9
3
- size 4032008
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:042075ce053649000d1398f15fc9557ebae62068f91f778d78ff60cd85e6c6a9
3
+ size 4004671
train/es.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:41a7a9719d8d587a0d4f90d08de1ae1ad6325f9fb8c39ac85015783eb0498309
3
- size 845425
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3098d94fb89df84a40fe0f8ffcba32f0afb21861978bffc20794b9ac59ad6103
3
+ size 841866
train/fr.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:202ce0a0fdd82e547471b4d6e6959c5d8faeb857896bef134d310e8a4bee759e
3
- size 131188
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8d8f7b01354495aec086f3dfaf59473faa2d314925f53505913b8e505fdebfd
3
+ size 131109
train/pl.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0ed9f1ecbca15fb9f1948fae0b4530c5e0eabde4dc02160804c0ab0b51780d99
3
- size 579890
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0683c5982f16c2ea73176af6b0e0c1f3d05daf16dfd9159b02f6131ed90d37af
3
+ size 578179
train/tr.jsonl.gz CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f32b0b109914ca930a1f7c58225779162bc2844fd07723e8a988da12289430fb
3
- size 573751
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0be5cf7a35777547f266c3dc2c92496a2e2e92ce1fcd9469311667980cdec49
3
+ size 560057