Datasets:
Update dataset_setup.py
Browse files- dataset_setup.py +8 -5
dataset_setup.py
CHANGED
|
@@ -12,22 +12,25 @@ def extract_video_tasks():
|
|
| 12 |
bundles = [os.path.join(root, x) for x in bundles]
|
| 13 |
if len(bundles) > 1:
|
| 14 |
cat = subprocess.Popen(['cat'] + bundles, stdout=subprocess.PIPE)
|
| 15 |
-
cat.wait()
|
| 16 |
-
cat.stdout.close()
|
| 17 |
cmd = ['tar', '-xzf', '-', '-C', output_dir]
|
| 18 |
tar = subprocess.Popen(cmd, stdin=cat.stdout)
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
else:
|
| 21 |
assert len(bundles) == 1, f'Unexpected size'
|
| 22 |
tar = subprocess.run(['tar', '-xzfv', bundles[0], '-C', output_dir])
|
| 23 |
-
print('
|
| 24 |
|
| 25 |
def extract_image_tasks():
|
| 26 |
root = 'image_tasks'
|
| 27 |
for task in ['mmeb_v1', 'visdoc']:
|
| 28 |
print(f'Extracting {task} task ... ...')
|
| 29 |
subprocess.run(['tar', '-xzf', os.path.join(root, f'{task}.tar.gz'), '-C', root])
|
| 30 |
-
print('
|
| 31 |
|
| 32 |
def main():
|
| 33 |
extract_image_tasks()
|
|
|
|
| 12 |
bundles = [os.path.join(root, x) for x in bundles]
|
| 13 |
if len(bundles) > 1:
|
| 14 |
cat = subprocess.Popen(['cat'] + bundles, stdout=subprocess.PIPE)
|
|
|
|
|
|
|
| 15 |
cmd = ['tar', '-xzf', '-', '-C', output_dir]
|
| 16 |
tar = subprocess.Popen(cmd, stdin=cat.stdout)
|
| 17 |
+
cat_return_code = cat.wait()
|
| 18 |
+
tar_return_code = tar.wait()
|
| 19 |
+
if cat_return_code != 0:
|
| 20 |
+
raise RuntimeError('Error occured during concatenation!')
|
| 21 |
+
if tar_return_code != 0:
|
| 22 |
+
raise RuntimeError('Error occured during extraction!')
|
| 23 |
else:
|
| 24 |
assert len(bundles) == 1, f'Unexpected size'
|
| 25 |
tar = subprocess.run(['tar', '-xzfv', bundles[0], '-C', output_dir])
|
| 26 |
+
print('All video tasks completed!')
|
| 27 |
|
| 28 |
def extract_image_tasks():
|
| 29 |
root = 'image_tasks'
|
| 30 |
for task in ['mmeb_v1', 'visdoc']:
|
| 31 |
print(f'Extracting {task} task ... ...')
|
| 32 |
subprocess.run(['tar', '-xzf', os.path.join(root, f'{task}.tar.gz'), '-C', root])
|
| 33 |
+
print('All image tasks completed!')
|
| 34 |
|
| 35 |
def main():
|
| 36 |
extract_image_tasks()
|