Skip to content

Commit

Permalink
Remove multiprocessing from gif making script
Browse files Browse the repository at this point in the history
  • Loading branch information
jagdeepsb committed Jan 29, 2022
1 parent 05bf3ba commit da3a050
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions examples/make_gifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,19 +222,31 @@ def generate(self, load_dir, save_dir, depth=0):
# sort and generate
robots = sorted(robots, key=lambda x: x.reward, reverse=True)
ranks = self.ranks if self.ranks is not None else [i for i in range(len(robots))]
group = mp.Group()
for i, robot in zip(ranks, robots):
gif_args = (

# make gifs
for i, robot in zip(ranks, robots):
save_robot_gif(
os.path.join(save_dir, f'{i}_{robot}'),
robot.env_name,
robot.body_path,
robot.ctrl_path
)
group.add_job(save_robot_gif, gif_args, callback=dummy_callback)
group.run_jobs(NUM_PROC)

# multiprocessing is currently broken

# group = mp.Group()
# for i, robot in zip(ranks, robots):
# gif_args = (
# os.path.join(save_dir, f'{i}_{robot}'),
# robot.env_name,
# robot.body_path,
# robot.ctrl_path
# )
# group.add_job(save_robot_gif, gif_args, callback=dummy_callback)
# group.run_jobs(NUM_PROC)

GIF_RESOLUTION = (1280/5, 720/5)
NUM_PROC = 8
# NUM_PROC = 8
if __name__ == '__main__':
exp_root = os.path.join('saved_data')
save_dir = os.path.join(root_dir, 'saved_data', 'all_media')
Expand Down

0 comments on commit da3a050

Please sign in to comment.