robodojo-sft / README.md
embodied-analysis's picture
Update data
9d8d827
|
Raw History Blame Contribute Delete
7.29 kB
---
pretty_name: RoboDojo SFT Data for VLM Agents
license: cc-by-nc-4.0
extra_gated_heading: Request access to RoboDojo SFT Data for VLM Agents
extra_gated_prompt: >-
This dataset is released under CC BY-NC 4.0 for non-commercial use only. By requesting access you
agree to: (1) use the dataset, and anything derived from it, including models trained on it, only for
non-commercial research or education; (2) credit this dataset when you publish or share work that uses
it; (3) pass these terms on to anyone you share it with. Requests are reviewed by hand.
extra_gated_fields:
Name: text
Affiliation: text
Country: country
Intended use: text
I will use this dataset only for non-commercial purposes: checkbox
extra_gated_button_content: Agree and request access
configs:
- config_name: default
data_files:
- split: train
path: data/train-*.arrow
task_categories:
- robotics
- image-text-to-text
tags:
- robotics
- tool-use
- function-calling
- chain-of-thought
- openai-chat-format
size_categories:
- 1K<n<10K
---
# RoboDojo SFT Data for VLM Agents
RoboDojo demonstration (3500 episodes) in multimodal agent
conversation in the OpenAI chat and tool call format. Each turn the robot gets its state and three camera images, then
writes a short first-person chain of thought and calls the tool `move`. A last turn checks
the task's goal in the final views and stops without a tool call.
| | |
|---|---|
| Conversations (rows) | 3,500, one per episode |
| Steps (assistant turns with a `move` call) | 89,056 |
| Images (embedded JPEG, 640 × 480) | 277,668 |
| Chain-of-thought length per assistant turn | median 92 words, 90th percentile 131, max 153 |
| Size | 13.4 GB in 27 Arrow shards |
## Loading
```python
from datasets import load_dataset
ds = load_dataset("embodied-analysis/robodojo-sft", split="train") # a local path to this folder or a Hub repo id
ds = load_dataset("embodied-analysis/robodojo-sft", split="train", streaming=True) # no local cache copy
```
`load_dataset` on local files first copies them into the Hugging Face cache (`HF_DATASETS_CACHE`). To
memory-map the shards in place instead:
```python
import glob
from datasets import Dataset, concatenate_datasets
ds = concatenate_datasets([Dataset.from_file(p) for p in sorted(glob.glob("data/train-*.arrow"))])
```
**Batch sizes.** A row is about 4 MB, because it holds an episode's images. Arrow caps one binary column
at 2 GB per batch, and `map` and `cast` write 1,000 rows per batch by default. So pass smaller batches:
```python
ds = ds.map(fn, batch_size=32, writer_batch_size=32)
```
To read the stored JPEG bytes without decoding, use `ds.with_format("arrow")[i]`, or iterate with
`streaming=True`.
## Row schema
| Column | Type | Meaning |
|---|---|---|
| `episode` | string | `sim_<index>` |
| `episode_index` | int32 | 0–3499; task t is episodes 100t … 100t + 99 |
| `task` | string | RoboDojo task key |
| `robot` | string | `ARX X5 (sim)` |
| `instruction` | string | the task instruction |
| `messages` | list of messages | the conversation (below) |
| `images` | list of Image | every image of the conversation, in order of appearance |
| `tools` | string | the OpenAI `tools` list as JSON (the `move` function and its JSON schema) |
| `num_steps`, `num_images` | int32 | steps (tool calls) and images in the row |
A message has `role`, `content`, `tool_calls` and `tool_call_id`, with one Arrow schema for every
message:
- `content` is always a list of parts `{type, text, image_url: {url}}`.
- A field a message doesn't have is null: `tool_calls` outside assistant turns, `text` on image parts, and
so on.
- Each `image_url.url` is `<episode>/<turn>_<camera>.jpg`. It equals the `path` of the matching entry in
`images`, and the k-th image part is `images[k]`.
The conversation:
1. `system`: the system message, which describes the robot, units, frames and the `move` tool.
2. `user`: `Task: <instruction>`.
3. Per step:
- `user`: the state JSON (fingertip poses in mm, joint angles in degrees, gripper commands), then for
each camera a label `Camera: <name>; horizontal FOV <h> deg, vertical FOV <v> deg` and the image;
- `assistant`: the chain of thought, and one `move` call. Its `arguments` are JSON:
`{"left": {"delta_xyz": [x, y, z], "delta_rotation": [rx, ry, rz], "gripper_closed": b}, "right": {...}}`.
These are millimetres and a rotation vector in degrees, in the arm's current fingertip frame;
- `tool`: `{"state": ...}`, the measured state after the move.
4. `user`, then `assistant`: the final state and views, and a completion reply with no tool call (it ends
the episode).
### Plain OpenAI JSON
`to_openai` drops the null fields and turns a single text part back into a plain string, which gives
plain OpenAI chat JSON. With `images`, it also inlines each image as a data URL:
```python
def to_openai(messages, images=None):
"""A row's messages as OpenAI chat JSON: null fields dropped, a content of one text part back to a string.
With images (the row's `images`, decoded to PIL or as {bytes, path}), each image_url becomes a data URL."""
import base64
import io
out, k = [], 0
for m in messages:
parts = []
for p in m["content"]:
if p["type"] == "image_url":
url = p["image_url"]["url"]
if images is not None:
im = images[k]
if isinstance(im, dict):
data = im["bytes"]
else:
buf = io.BytesIO()
im.save(buf, format="JPEG", quality=95)
data = buf.getvalue()
url = "data:image/jpeg;base64," + base64.b64encode(data).decode()
k += 1
parts.append({"type": "image_url", "image_url": {"url": url}})
else:
parts.append({"type": p["type"], "text": p["text"]})
msg = {"role": m["role"]}
msg["content"] = parts[0]["text"] if len(parts) == 1 and parts[0]["type"] == "text" else parts
if m.get("tool_calls"):
msg["tool_calls"] = m["tool_calls"]
if m.get("tool_call_id") is not None:
msg["tool_call_id"] = m["tool_call_id"]
out.append(msg)
return out
import json
row = ds[0]
messages = to_openai(row["messages"]) # image_url.url stays the relative path
messages = to_openai(row["messages"], row["images"]) # image_url.url = data:image/jpeg;base64,...
tools = json.loads(row["tools"])
```
## Conventions
- **Fingertip frame:** origin midway between the fingertips, +X toward the fingertips, +Y across the jaws,
+Z = X × Y. A move is applied once, `T_goal = T_tip · T_delta`. The controller then drives the arms
until they arrive or stop moving, and sets the gripper after the motion.
- **Moves carry no step count or duration.** How long a move runs is up to the controller.
## License
[CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/) (full text in `LICENSE`): non-commercial
use only. Commercial use is not permitted under this license; for a commercial license, see Contact.
## Contact
For a commercial license, contact founders@embodiedanalysis.com.