Download scripts/episode_lengths.py from ducido/diffusion_policy_gbc: direct link, hf CLI and curl.
- Browser
- Download file 687 Bytes
-
https://huggingface.co/ducido/diffusion_policy_gbc/resolve/main/scripts/episode_lengths.py
- Command line
-
hf download hf://ducido/diffusion_policy_gbc/scripts/episode_lengths.py
-
curl -L -o episode_lengths.py https://huggingface.co/ducido/diffusion_policy_gbc/resolve/main/scripts/episode_lengths.py
687 Bytes
| if __name__ == "__main__": | |
| import sys | |
| import os | |
| import pathlib | |
| ROOT_DIR = str(pathlib.Path(__file__).parent.parent.parent) | |
| sys.path.append(ROOT_DIR) | |
| import click | |
| import numpy as np | |
| import json | |
| from diffusion_policy.common.replay_buffer import ReplayBuffer | |
| def main(input, dt): | |
| buffer = ReplayBuffer.create_from_path(input) | |
| lengths = buffer.episode_lengths | |
| durations = lengths * dt | |
| result = { | |
| 'duration/mean': np.mean(durations) | |
| } | |
| text = json.dumps(result, indent=2) | |
| print(text) | |
| if __name__ == '__main__': | |
| main() | |