File size: 1,240 Bytes
a12c07f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | import os
import subprocess
from tqdm import tqdm
from huggingface_hub import hf_hub_download
env = os.environ.copy()
# Step 1: download the blendergym data zip file
if not os.path.isfile('bench_data.zip') and not os.path.isdir('bench_data'):
command = '''
wget https://huggingface.co/datasets/richard-guyunqi/BG_bench_data/resolve/main/bench_data.zip
'''
subprocess.run(command, env=env, shell=True)
# Step 2: Unzip the dataset and organize the files
if not os.path.isdir('bench_data'):
command = '''
unzip bench_data.zip
'''
subprocess.run(command, env=env, shell=True)
# Step 2: for each blender_file, copy it to the correct place
blender_files_dir = "bench_data/blender_files"
for blender_file_name in tqdm(os.listdir(blender_files_dir)):
blender_file_path = os.path.join(blender_files_dir, blender_file_name)
task, start, end = blender_file_name.split('.')[0].split('_')
start = int(start)
end = int(end)
for i in range(start, end +1):
command = f"cp {blender_file_path} bench_data/{task}{i}/blender_file.blend"
print(command)
subprocess.run(command, env=env, shell=True)
# # Step 4:
|