Update README.md
Browse files
README.md
CHANGED
|
@@ -68,14 +68,48 @@ Each JSON sample (one file per scene) contains the following core fields:
|
|
| 68 |
|
| 69 |
## Usage
|
| 70 |
|
|
|
|
| 71 |
```python
|
| 72 |
-
from
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
|
| 77 |
-
#
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
data = requests.get(url).json()
|
| 81 |
```
|
|
|
|
| 68 |
|
| 69 |
## Usage
|
| 70 |
|
| 71 |
+
### Recommended: Batch Download (Official HF Method)
|
| 72 |
```python
|
| 73 |
+
from huggingface_hub import snapshot_download
|
| 74 |
|
| 75 |
+
snapshot_download(
|
| 76 |
+
repo_id="ESI-Bench/esi-bench",
|
| 77 |
+
repo_type="dataset",
|
| 78 |
+
local_dir="./esi-bench"
|
| 79 |
+
)
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
### Load a Specific Task Index
|
| 83 |
+
```python
|
| 84 |
+
from huggingface_hub import hf_hub_download
|
| 85 |
+
import json
|
| 86 |
+
|
| 87 |
+
path = hf_hub_download(
|
| 88 |
+
repo_id="ESI-Bench/esi-bench",
|
| 89 |
+
filename="data/Action Sequencing.json",
|
| 90 |
+
repo_type="dataset"
|
| 91 |
+
)
|
| 92 |
+
with open(path) as f:
|
| 93 |
+
index = json.load(f)
|
| 94 |
+
|
| 95 |
+
# index["json_paths"] contains relative paths to all samples in this category
|
| 96 |
+
print(index["json_paths"][:5])
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
### Load a Single Sample
|
| 100 |
+
```python
|
| 101 |
+
from huggingface_hub import hf_hub_download
|
| 102 |
+
import json
|
| 103 |
+
|
| 104 |
+
path = hf_hub_download(
|
| 105 |
+
repo_id="ESI-Bench/esi-bench",
|
| 106 |
+
filename="data/Action Sequencing/Action Order Inference/Beechwood_0_garden/kitchen_0/Beechwood_0_garden__kitchen_0.json",
|
| 107 |
+
repo_type="dataset"
|
| 108 |
+
)
|
| 109 |
+
with open(path) as f:
|
| 110 |
+
sample = json.load(f)
|
| 111 |
|
| 112 |
+
print(sample["task"]) # action_order_inference
|
| 113 |
+
print(sample["scene"]) # Beechwood_0_garden
|
| 114 |
+
print(sample["qa"]["question"])
|
|
|
|
| 115 |
```
|