Update README.md
Browse files
README.md
CHANGED
|
@@ -79,16 +79,39 @@ In addition to the default features, we extracted the visual traces of future 16
|
|
| 79 |
|
| 80 |
## Dataset Loading
|
| 81 |
|
| 82 |
-
|
| 83 |
|
| 84 |
```py
|
| 85 |
from datasets import load_dataset
|
| 86 |
dataset = load_dataset("MagmaAI/Magma-OXE-ToM", streaming=True, split="train")
|
| 87 |
```
|
| 88 |
|
|
|
|
| 89 |
or specify a dataset by:
|
| 90 |
|
| 91 |
```py
|
| 92 |
from datasets import load_dataset
|
| 93 |
dataset = load_dataset("MagmaAI/Magma-OXE-ToM", data_dir="austin_buds_dataset_converted_externally_to_rlds", streaming=True, split="train")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
```
|
|
|
|
| 79 |
|
| 80 |
## Dataset Loading
|
| 81 |
|
| 82 |
+
### Full Dataset Load
|
| 83 |
|
| 84 |
```py
|
| 85 |
from datasets import load_dataset
|
| 86 |
dataset = load_dataset("MagmaAI/Magma-OXE-ToM", streaming=True, split="train")
|
| 87 |
```
|
| 88 |
|
| 89 |
+
### Individual Dataset Load
|
| 90 |
or specify a dataset by:
|
| 91 |
|
| 92 |
```py
|
| 93 |
from datasets import load_dataset
|
| 94 |
dataset = load_dataset("MagmaAI/Magma-OXE-ToM", data_dir="austin_buds_dataset_converted_externally_to_rlds", streaming=True, split="train")
|
| 95 |
+
```
|
| 96 |
+
|
| 97 |
+
### Sample Decoding
|
| 98 |
+
|
| 99 |
+
```py
|
| 100 |
+
# Helper function to deserialize binary fields
|
| 101 |
+
def deserialize_array(bytes_data):
|
| 102 |
+
return pickle.loads(bytes_data)
|
| 103 |
+
|
| 104 |
+
# Helper function to convert binary image data to PIL Image
|
| 105 |
+
def bytes_to_image(image_bytes):
|
| 106 |
+
return Image.open(io.BytesIO(image_bytes))
|
| 107 |
+
|
| 108 |
+
for i, example in enumerate(dataset):
|
| 109 |
+
# decode the image: 256 x 256 x 3
|
| 110 |
+
image = bytes_to_image(example['image'])
|
| 111 |
+
# decode action: 1 x 7
|
| 112 |
+
action = deserialize_array(example['action'])
|
| 113 |
+
# decode trace: 1 x 17 x 256 x 2
|
| 114 |
+
trace = deserialize_array(example['trace'])
|
| 115 |
+
# decode trace visibility: 1 x 17 x 256 x 1
|
| 116 |
+
trace_visibility = deserialize_array(example['trace_visibility'])
|
| 117 |
```
|