Download scripts/load_examples.py from yflantmy/DecisionRobust: direct link, hf CLI and curl.
- Browser
- Download file 576 Bytes
-
https://huggingface.co/datasets/yflantmy/DecisionRobust/resolve/main/scripts/load_examples.py
- Command line
-
hf download hf://datasets/yflantmy/DecisionRobust/scripts/load_examples.py
-
curl -L -o load_examples.py https://huggingface.co/datasets/yflantmy/DecisionRobust/resolve/main/scripts/load_examples.py
576 Bytes
| from pathlib import Path | |
| from datasets import load_dataset | |
| from io_utils import decode_record | |
| root = Path(__file__).resolve().parents[1] | |
| for config in ('text_adversarial_curated','text_injection_curated','image_perturbation_curated','image_overlay_curated','image_instruction_curated'): | |
| ds = load_dataset(str(root), config, split='test') | |
| row = ds[0] | |
| record = decode_record(row) | |
| print(config, len(ds), record['id'], record['task'], record['gt']) | |
| if 'clean_image' in row: | |
| print('Decoded image sizes:', row['clean_image'].size, row['adv_image'].size) | |