Fix loops in eval.py (#128)
This commit is contained in:
parent
c77633c38c
commit
d747195c57
|
@ -324,7 +324,7 @@ def eval_policy(
|
||||||
}
|
}
|
||||||
|
|
||||||
# Maybe render video for visualization.
|
# Maybe render video for visualization.
|
||||||
if max_episodes_rendered > 0:
|
if max_episodes_rendered > 0 and len(ep_frames) > 0:
|
||||||
batch_stacked_frames = np.stack(ep_frames, axis=1) # (b, t, *)
|
batch_stacked_frames = np.stack(ep_frames, axis=1) # (b, t, *)
|
||||||
for stacked_frames, done_index in zip(
|
for stacked_frames, done_index in zip(
|
||||||
batch_stacked_frames, done_indices.flatten().tolist(), strict=False
|
batch_stacked_frames, done_indices.flatten().tolist(), strict=False
|
||||||
|
@ -349,7 +349,6 @@ def eval_policy(
|
||||||
progbar.set_postfix(
|
progbar.set_postfix(
|
||||||
{"running_success_rate": f"{np.mean(all_successes[:n_episodes]).item() * 100:.1f}%"}
|
{"running_success_rate": f"{np.mean(all_successes[:n_episodes]).item() * 100:.1f}%"}
|
||||||
)
|
)
|
||||||
progbar.update()
|
|
||||||
|
|
||||||
# Wait till all video rendering threads are done.
|
# Wait till all video rendering threads are done.
|
||||||
for thread in threads:
|
for thread in threads:
|
||||||
|
|
Loading…
Reference in New Issue