Exemplo n.º 1
0
def _write_and_upload_video(clip_data, frames, clip_id, source, fps, gcs_path,
                            video_local_path, clip_local_path):
    with open(clip_local_path, 'wb') as f:
        pickle.dump(clip_data, f)  # Write clip to disk
    write_segment_to_video(frames, fname=video_local_path, fps=fps)
    upload_to_gcs(video_local_path, gcs_path)
    return clip_id, source
Exemplo n.º 2
0
def test_render_videos():
    env_id = "Hopper-v1"
    env = make_with_torque_removed(env_id)
    segments = segments_from_rand_rollout(env_id,
                                          make_with_torque_removed,
                                          n_desired_segments=1,
                                          clip_length_in_seconds=CLIP_LENGTH)

    for idx, segment in enumerate(segments):
        local_path = osp.join(TEST_RENDER_DIR, 'test-%s.mp4' % idx)
        print("Writing segment to: %s" % local_path)
        write_segment_to_video(segment, fname=local_path, env=env)
Exemplo n.º 3
0
def test_render_videos():
    env = make_with_torque_removed("Hopper-v1")
    collector = RandomRolloutSegmentCollector(20000, env=env)
    rl_teacher.agent.trpo.run_trpo_mujoco.train(
        num_timesteps=8000,
        env=env,
        seed=0,
        predictor=collector,
        random_rollout=True,
    )

    segments = collector.segments
    tmp_media_dir = '/tmp/rl_teacher_media_test'
    for segment in segments:
        local_path = osp.join(tmp_media_dir, str(uuid.uuid4()) + '.mp4')
        print("Writing segment to: %s" % local_path)
        write_segment_to_video(segment, fname=local_path, env=env)
Exemplo n.º 4
0
def _write_and_upload_video(env_id, gcs_path, local_path, segment):
    env = make_with_torque_removed(env_id)
    write_segment_to_video(segment, fname=local_path, env=env)
    upload_to_gcs(local_path, gcs_path)
def _write_and_upload_video( local_path, segment):
    # logger.info('write video !!!'+local_path)
    write_segment_to_video(segment, fname=local_path)
Exemplo n.º 6
0
def _write_and_upload_video(env_id, gcs_path, local_path, segment):
    os.mkdir('/tmp/233')
    env = make_with_torque_removed(env_id)
    write_segment_to_video(segment, fname=local_path, env=env)