Commit
·
eec9b36
1
Parent(s):
59c35bb
Update LoadingScript
Browse files- LoadingScriptPractice.py +3 -3
LoadingScriptPractice.py
CHANGED
@@ -99,7 +99,7 @@ class LoadingScriptPractice(datasets.GeneratorBasedBuilder):
|
|
99 |
files : zip files
|
100 |
'''
|
101 |
# リポジトリからダウンロードしてとりあえずキャッシュしたURLリストを取得
|
102 |
-
split_metadata_path = split_metadata_paths[split][0]
|
103 |
downloaded_files_path = dl_manager.download_and_extract(files)
|
104 |
|
105 |
# 元のコードではzipファイルの中身を"filepath"としてそのまま_generate_exampleに引き渡している?
|
@@ -114,7 +114,7 @@ class LoadingScriptPractice(datasets.GeneratorBasedBuilder):
|
|
114 |
)
|
115 |
return gs
|
116 |
|
117 |
-
def _generate_examples(self, images, metadata_path
|
118 |
"""Generate images and captions for splits."""
|
119 |
# with open(metadata_path, encoding="utf-8") as f:
|
120 |
# files_to_keep = set(f.read().split("\n"))
|
@@ -124,7 +124,7 @@ class LoadingScriptPractice(datasets.GeneratorBasedBuilder):
|
|
124 |
num_list = list()
|
125 |
label_list = list()
|
126 |
|
127 |
-
with open(
|
128 |
for line in fin:
|
129 |
data = json.loads(line)
|
130 |
file_list.append(data["file_name"])
|
|
|
99 |
files : zip files
|
100 |
'''
|
101 |
# リポジトリからダウンロードしてとりあえずキャッシュしたURLリストを取得
|
102 |
+
split_metadata_path = dl_manager.download_and_extract(split_metadata_paths[split][0])
|
103 |
downloaded_files_path = dl_manager.download_and_extract(files)
|
104 |
|
105 |
# 元のコードではzipファイルの中身を"filepath"としてそのまま_generate_exampleに引き渡している?
|
|
|
114 |
)
|
115 |
return gs
|
116 |
|
117 |
+
def _generate_examples(self, images, metadata_path):
|
118 |
"""Generate images and captions for splits."""
|
119 |
# with open(metadata_path, encoding="utf-8") as f:
|
120 |
# files_to_keep = set(f.read().split("\n"))
|
|
|
124 |
num_list = list()
|
125 |
label_list = list()
|
126 |
|
127 |
+
with open(metadata_path) as fin:
|
128 |
for line in fin:
|
129 |
data = json.loads(line)
|
130 |
file_list.append(data["file_name"])
|