Download example.py from YuMoool/astra-robodojo-rollouts: direct link, hf CLI and curl.
- Browser
- Download file 1.31 kB
-
https://huggingface.co/datasets/YuMoool/astra-robodojo-rollouts/resolve/main/example.py
- Command line
-
hf download hf://datasets/YuMoool/astra-robodojo-rollouts/example.py
-
curl -L -o example.py https://huggingface.co/datasets/YuMoool/astra-robodojo-rollouts/resolve/main/example.py
1.31 kB
| """Example: python example.py /path/to/download --method hybrid --task fold_clothes.""" | |
| import argparse | |
| try: | |
| from .reader import Dataset | |
| except ImportError: | |
| from reader import Dataset | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument('directory') | |
| parser.add_argument('--method', choices=['hybrid', 'direct'], default='hybrid') | |
| parser.add_argument('--task', default='fold_clothes') | |
| args = parser.parse_args() | |
| dataset = Dataset(args.directory) | |
| record = dataset.select(method=args.method, task=args.task)[0] | |
| with dataset.open(record['episode_id'], verify=True) as episode: | |
| print('Case:', episode.metadata['case']) | |
| print('Outcome:', episode.metadata['outcome']) | |
| for decision in episode.decisions[:3]: | |
| obs = decision.observation(images='preview') | |
| print('Decision', decision.index, 'before-step', decision.record['start_tick'], | |
| 'mode', decision.record['source_detail'], 'executed', decision.executed_actions.shape, | |
| 'head preview', obs['cam_high'].shape) | |
| proposal = decision.pi05_proposal | |
| if proposal is not None: | |
| print('pi05 candidate:', proposal['actions'].shape) | |
| print('Reason:', decision.requested_response.get('reason')) | |
| print('Corrective step targets:', len(decision.eef_targets)) | |