Bingsu commited on
Commit
48f9962
1 Parent(s): 6813784

0.1.3: load scripts, try-except for ReadError

Browse files
laion2b_multi_korean_subset_with_image.py CHANGED
@@ -18,11 +18,11 @@ _URLS = [f"data/{i:0>5}.tar" for i in range(2123)]
18
 
19
  class Laion2bMultiKoreanSubsetWithImage(GeneratorBasedBuilder):
20
 
21
- VERSION = "0.1.2"
22
 
23
  def _info(self):
24
  return DatasetInfo(
25
- description="laion2b_multi_korean_subset data with images downloaded successfully",
26
  features=Features(
27
  {
28
  "image": Image(),
@@ -54,7 +54,14 @@ class Laion2bMultiKoreanSubsetWithImage(GeneratorBasedBuilder):
54
  temp = defaultdict(dict)
55
 
56
  for archive in archives:
57
- for path, file in archive:
 
 
 
 
 
 
 
58
  if path.endswith(".txt"):
59
  continue
60
 
@@ -84,4 +91,4 @@ class Laion2bMultiKoreanSubsetWithImage(GeneratorBasedBuilder):
84
  yield idx, temp.pop(file_id)
85
  idx += 1
86
 
87
- temp.clear()
 
18
 
19
  class Laion2bMultiKoreanSubsetWithImage(GeneratorBasedBuilder):
20
 
21
+ VERSION = "0.1.3"
22
 
23
  def _info(self):
24
  return DatasetInfo(
25
+ description="laion2b_multi_korean_subset data with images",
26
  features=Features(
27
  {
28
  "image": Image(),
 
54
  temp = defaultdict(dict)
55
 
56
  for archive in archives:
57
+ iter_archive = iter(archive)
58
+ while True:
59
+ # for tarfile.ReadError
60
+ try:
61
+ path, file = next(iter_archive)
62
+ except Exception:
63
+ break
64
+
65
  if path.endswith(".txt"):
66
  continue
67
 
 
91
  yield idx, temp.pop(file_id)
92
  idx += 1
93
 
94
+ temp.clear()