File size: 23,049 Bytes
8221873
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
# LeRobot v3.0 Format Complete Knowledge Base

## Table of Contents
1. [Overview](#overview)
2. [Critical Requirements](#critical-requirements)
3. [Dataset Structure](#dataset-structure)
4. [Two Valid Task Approaches](#two-valid-task-approaches)
5. [Chunking Strategy](#chunking-strategy)
6. [Episode-to-File Mapping](#episode-to-file-mapping)
7. [Configuration Parameters](#configuration-parameters)
8. [Best Practices](#best-practices)
9. [v2.1 vs v3.0 Changes](#v21-vs-v30-changes)
10. [Our Dataset Strategy](#our-dataset-strategy)

---

## Overview

LeRobot v3.0 introduces a **consolidated file format** for improved scalability, efficiency, and standardization. Instead of one file per episode (v2.1), v3.0 groups multiple episodes into larger Parquet data files and MP4 video files.

**Key Benefits:**
- **Scalability**: Handle massive datasets (1M+ episodes)
- **Efficiency**: Fewer, larger files = faster I/O
- **Standardization**: Parquet for all metadata
- **Flexibility**: Configurable chunking strategies

**Source:** Verified against Phospho.ai documentation and real datasets (SVLA, LIBERO)

---

## Critical Requirements

### 1. Language Instructions are MANDATORY for VLA

**All Vision-Language-Action (VLA) models require natural language task descriptions:**
- **SmolVLA**: Processes language through tokenizer, conditions actions on language embeddings
- **Pi0/Pi0.5**: Uses Paligemma (vision-language model), requires task descriptions
- **XVLA**: Uses Florence-2 backbone with language tokenizer

**Quality Requirements:**
-**Full sentences**: "Pick up the red cube from the left side"
-**Not labels**: "red_cube" or "pickup"
- ✅ **Specific & descriptive**: Include object details, spatial context
- ✅ **Natural language**: How a human would describe the task
- ✅ **Goal-oriented**: Describe what to achieve, not just object names

**Example (from LIBERO dataset):**
```
"put the white mug on the left plate and put the yellow and white mug on the right plate"
"put the yellow and white mug in the microwave and close it"
"turn on the stove and put the moka pot on it"
```

### 2. Proper HDF5 Paths (if converting from HDF5)

**Correct structure:**
- `observation/state` (singular, not `observations/state`)
- `action` (singular, not `actions`)
- `timestamp` (singular, not `timestamps`)

---

## Dataset Structure

### Complete v3.0 Directory Layout

```
dataset_name/
├── meta/
│   ├── info.json                        # Dataset configuration
│   ├── stats.json                       # Aggregated statistics
│   ├── tasks.parquet                    # Task definitions (optional, see approaches below)
│   └── episodes/
│       ├── chunk-000/
│       │   ├── file-000.parquet         # Episodes 0-999 metadata
│       │   └── file-001.parquet         # Episodes 1000-1999 metadata (if >1000 episodes)
│       └── chunk-001/                   # If >1000 episode metadata files
│           └── file-000.parquet
├── data/
│   ├── chunk-000/
│   │   ├── file-000.parquet             # Frame data for episodes 0-14
│   │   ├── file-001.parquet             # Frame data for episodes 15-29
│   │   └── ...                          # More files based on data_files_size_in_mb
│   └── chunk-001/                       # If >1000 data files
│       └── file-000.parquet
└── videos/
    ├── observation.images.camera1/
    │   ├── chunk-000/
    │   │   ├── file-000.mp4             # Video(s) for episodes 0-N
    │   │   ├── file-001.mp4
    │   │   └── ...                      # Number depends on strategy
    │   └── chunk-001/                   # If >1000 video files
    │       └── file-000.mp4
    └── observation.images.camera2/
        └── chunk-000/
            └── ...
```

### File Schemas

#### meta/info.json
```json
{
    "codebase_version": "v3.0",
    "robot_type": "piper",
    "total_episodes": 13,
    "total_frames": 5016,
    "total_tasks": 12,
    "total_videos": 26,
    "total_chunks": 1,
    "chunks_size": 1000,
    "data_files_size_in_mb": 50,
    "video_files_size_in_mb": 200,
    "fps": 30,
    "features": {
        "observation.state": {
            "dtype": "float32",
            "shape": [7],
            "names": {"motors": ["joint_1", ..., "joint_7"]},
            "fps": 30.0
        },
        "action": {
            "dtype": "float32",
            "shape": [7],
            "names": {"motors": ["joint_1", ..., "joint_7"]},
            "fps": 30.0
        },
        "observation.images.table_cam": {
            "dtype": "video",
            "shape": [720, 800, 3],
            "video_info": {
                "video.fps": 30.0,
                "video.codec": "av1",
                "video.pix_fmt": "yuv420p"
            }
        }
        // ... other features
    }
}
```

#### data/chunk-000/file-000.parquet
Frame-level data:
```python
{
    'observation.state': [7],          # Robot state
    'action': [7],                     # Robot action
    'timestamp': float,                # Frame timestamp
    'frame_index': int,                # Frame within episode
    'episode_index': int,              # Which episode
    'index': int,                      # Global frame index
    'task_index': int,                 # Maps to tasks.parquet (LIBERO approach)
    'next.done': bool                  # True on last frame of episode
}
```

#### meta/episodes/chunk-000/file-000.parquet
Episode-level metadata:
```python
{
    'episode_index': 0,
    'length': 324,                                    # Number of frames
    
    # Data file location
    'data/chunk_index': 0,                            # Which data chunk
    'data/file_index': 0,                             # Which file in that chunk
    'dataset_from_index': 0,                          # Start frame in that file
    'dataset_to_index': 324,                          # End frame in that file
    
    # Video file locations (per camera)
    'videos/observation.images.table_cam/chunk_index': 0,
    'videos/observation.images.table_cam/file_index': 0,
    'videos/observation.images.table_cam/from_timestamp': 0.0,
    'videos/observation.images.table_cam/to_timestamp': 10.8,
    
    'videos/observation.images.wrist_cam/chunk_index': 0,
    'videos/observation.images.wrist_cam/file_index': 0,
    'videos/observation.images.wrist_cam/from_timestamp': 0.0,
    'videos/observation.images.wrist_cam/to_timestamp': 10.8,
    
    # Per-episode statistics
    'stats/action/min': [7],
    'stats/action/max': [7],
    'stats/action/mean': [7],
    'stats/action/std': [7],
    'stats/observation.state/min': [7],
    'stats/observation.state/max': [7],
    // ... other stats
    
    # Task information (optional, depends on approach)
    'tasks': ["Pick up the screwdriver from the table."],  # SVLA approach
    'task_index': 7                                         # LIBERO approach
}
```

#### meta/tasks.parquet (LIBERO approach)
```python
# Task descriptions are the INDEX of the DataFrame!
index (task description)                              | task_index
------------------------------------------------------|------------
"put the white mug on the left plate and..."         | 0
"put the white mug on the plate and put..."          | 1
"pick up the screwdriver from the table."            | 7
```

#### meta/stats.json
Aggregated statistics for normalization:
```json
{
    "observation.state": {
        "mean": [7 values],
        "std": [7 values],
        "min": [7 values],
        "max": [7 values]
    },
    "action": {
        "mean": [7 values],
        "std": [7 values],
        "min": [7 values],
        "max": [7 values]
    }
}
```

---

## Two Valid Task Approaches

### Approach 1: Tasks in Episode Metadata (SVLA Style)

**Use when:**
- Single task repeated across all episodes
- Per-episode task variations needed
- Episodes can have multiple task descriptions

**Structure:**
```python
# meta/episodes/chunk-000/file-000.parquet
{
    'episode_index': 0,
    'tasks': ['Put the red cube on top of the blue cube.'],  # List of strings
    'length': 447,
    // ... other metadata
}
```

**Example Dataset:** svla_so100_stacking
- 56 episodes, 1 task
- All episodes do same task
- Task stored in each episode's metadata

**Pros:**
- Simple for single-task datasets
- Allows per-episode task variations
- Tasks directly in episode metadata

**Cons:**
- Redundant for multi-task datasets
- Harder to manage many distinct tasks

### Approach 2: Separate tasks.parquet (LIBERO Style) ✅

**Use when:**
- Multiple distinct tasks in dataset
- Each episode demonstrates one task
- Want centralized task management

**Structure:**
```python
# meta/tasks.parquet (task descriptions are INDEX!)
index="Pick up the screwdriver..." | task_index=7

# data/chunk-000/file-000.parquet (each frame)
{
    'observation.state': [...],
    'action': [...],
    'task_index': 7,  # Maps to tasks.parquet!
    'episode_index': 0,
    // ... other frame data
}

# meta/episodes/chunk-000/file-000.parquet
{
    'episode_index': 0,
    'length': 214,
    # NO tasks field!
    // ... video metadata, data indices
}
```

**Example Dataset:** LIBERO
- 1,693 episodes, 40 tasks
- Each episode has one task type
- tasks.parquet centralizes task definitions

**Pros:**
- ✅ Clean task definition management
- ✅ Define each task once
- ✅ Easy to add new tasks
- ✅ Better for multi-task datasets
- ✅ Explicit task conditioning via task_index

**Cons:**
- Extra file to manage
- Slightly more complex lookup

**Both approaches are valid v3.0 and work with VLA models!**

---

## Chunking Strategy

### Three Types of Chunking

#### 1. Directory Chunks (`chunks_size`)
**Purpose:** Limit number of FILES per directory for filesystem performance

**Configuration:**
```json
{
    "chunks_size": 1000  // Max 1000 files per chunk-XXX directory
}
```

**When it splits:**
- ✅ More than 1000 files → creates chunk-001, chunk-002, etc.
- ❌ Fewer than 1000 files → everything stays in chunk-000

**Example (LIBERO videos):**
```
1,693 video files (one per episode):
- chunk-000/: file-000.mp4 through file-999.mp4 (1000 files)
- chunk-001/: file-000.mp4 through file-692.mp4 (693 files)
```

**Why:** File system performance degrades with 1000+ files in one directory

#### 2. Data File Chunks (`data_files_size_in_mb`)
**Purpose:** Target parquet file size for efficient I/O

**Configuration:**
```json
{
    "data_files_size_in_mb": 100  // Target ~100MB per data parquet file
}
```

**How it works:**
- Multiple episodes consolidated into each parquet file
- System creates new file when size target reached
- Episode metadata tracks which file contains each episode

**Examples:**
- **LIBERO**: 273,465 frames → 377 files (~730 frames per file, ~100MB each)
- **SVLA**: 22,956 frames → 1 file (~20MB total, under target)
- **PIPER**: 5,016 frames → 1 file (~0.4MB total, well under target)

**Key Insight:** Data files often contain MULTIPLE episodes!

#### 3. Video File Strategy (`video_files_size_in_mb`)
**Purpose:** Target video file size for streaming/download

**Configuration:**
```json
{
    "video_files_size_in_mb": 500  // Target ~500MB per video file
}
```

**Two valid strategies:**

**Strategy A: One video per episode (LIBERO)**
- Each episode = separate MP4 file
- Good for: Different episode lengths, multi-task, selective loading
- Example: LIBERO has 1,693 MP4s per camera (one per episode)

**Strategy B: Multiple episodes per video (SVLA)**
- Episodes concatenated into fewer large videos
- Good for: Uniform episodes, sequential access, single-task
- Example: SVLA has 1 MP4 per camera (all 56 episodes concatenated)

**Both are valid v3.0!** Choice depends on dataset characteristics.

### Comparison: Data vs Video Chunking

| Aspect | Data Files | Video Files |
|--------|-----------|-------------|
| **Consolidation** | Always multiple episodes per file | Depends on strategy |
| **File count** | Few (377 in LIBERO) | Can be many (1,693 in LIBERO) or few (1 in SVLA) |
| **When splits** | Based on data size | Based on strategy choice |
| **Directory chunks** | Rare (377 < 1000) | Common if one-per-episode (1693 > 1000) |
| **Episode mapping** | Via from/to indices | Via timestamps or per-file |

### When to Split into Chunks?

| Scenario | Data Chunks | Video Chunks | Directory Chunks |
|----------|-------------|--------------|------------------|
| **Small dataset (<100 episodes)** | 1 file in chunk-000 | 1 file or 1-per-episode in chunk-000 | All in chunk-000 |
| **Medium dataset (100-1000 episodes)** | Multiple files in chunk-000 | Multiple files in chunk-000 | All in chunk-000 |
| **Large dataset (1000-10000 episodes)** | Many files, maybe 2 chunks | Many files, likely 2-10 chunks | Multiple chunk-XXX dirs |
| **Massive dataset (>10000 episodes)** | Many files, many chunks | Many files, many chunks | Many chunk-XXX dirs |

---

## Episode-to-File Mapping

### How the System Tracks Episodes

Episode metadata includes ALL location information:

```python
{
    'episode_index': 1234,
    
    # Where is the data?
    'data/chunk_index': 0,           # data/chunk-000/
    'data/file_index': 82,            # file-082.parquet
    'dataset_from_index': 123450,     # Starts at global frame 123450
    'dataset_to_index': 123774,       # Ends at global frame 123774 (324 frames)
    
    # Where are the videos?
    'videos/observation.images.camera1/chunk_index': 1,     # videos/.../chunk-001/
    'videos/observation.images.camera1/file_index': 234,    # file-234.mp4
    'videos/observation.images.camera1/from_timestamp': 0.0,
    'videos/observation.images.camera1/to_timestamp': 10.8, # 324 frames @ 30fps
}
```

### Lookup Process

**To load episode 1234:**
1. Read `meta/episodes/chunk-000/file-XXX.parquet`
2. Find row where `episode_index == 1234`
3. **For data:** Go to `data/chunk-000/file-082.parquet`, read rows 123450-123774
4. **For video:** Go to `videos/.../chunk-001/file-234.mp4`, decode timestamps 0.0-10.8

### Patterns

**LIBERO (one video per episode):**
```python
video_file_index == episode_index  # Direct mapping!
from_timestamp == 0.0              # Each video starts at 0
```

**SVLA (all episodes in one video):**
```python
video_file_index == 0              # All episodes in file-000.mp4
from_timestamp varies              # Use timestamps to locate episode
```

---

## Configuration Parameters

### Complete info.json Configuration

```json
{
    "codebase_version": "v3.0",
    "robot_type": "your_robot",
    "total_episodes": 13,
    "total_frames": 5016,
    "total_tasks": 12,
    "total_videos": 26,
    "total_chunks": 1,
    
    "chunks_size": 1000,                  // Max FILES per directory chunk
    "data_files_size_in_mb": 100,         // Target size for EACH data parquet
    "video_files_size_in_mb": 500,        // Target size for EACH video MP4
    
    "fps": 30,
    "features": { /* ... */ }
}
```

### What Each Parameter Controls

| Parameter | Controls | Example | Impact |
|-----------|----------|---------|--------|
| `chunks_size` | Max files per chunk-XXX dir | 1000 | 1693 files → 2 chunks |
| `data_files_size_in_mb` | Target data file size | 100 | Creates new file when reached |
| `video_files_size_in_mb` | Target video file size | 500 | Strategy-dependent |
| `fps` | Frame rate | 30 | Affects timestamp calculations |

**Common mistake:** Thinking `chunks_size` controls episodes per chunk
**Reality:** It controls FILES per directory (for filesystem performance)

---

## Best Practices

### Language Instructions

1. **Be specific**: "Pick up the red cube from the left side" > "pick cube"
2. **Include spatial context**: "Put the mug on the left plate"
3. **Describe the goal**: Not just object names
4. **Use natural language**: How a human would explain it
5. **Consistency**: Similar phrasing for similar tasks
6. **Variation**: Multiple phrasings help generalization

### Dataset Quality for VLA Fine-Tuning

From SmolVLA/Pi0 documentation:

1. **50+ episodes recommended** for good performance
2. **Language diversity**: Vary descriptions, include context
3. **Visual variations**: Multiple object positions, angles
4. **Multiple camera views**: Helps spatial understanding
5. **Consistent frame rate**: 30 FPS standard
6. **Quality over quantity**: Good demos > many poor demos

### Chunking Recommendations

**Small datasets (<100 episodes):**
```json
{
    "chunks_size": 1000,
    "data_files_size_in_mb": 50,
    "video_files_size_in_mb": 200
}
```
- Use LIBERO approach (one video per episode)
- All in chunk-000
- 1 data file sufficient

**Medium datasets (100-1000 episodes):**
```json
{
    "chunks_size": 1000,
    "data_files_size_in_mb": 100,
    "video_files_size_in_mb": 500
}
```
- Use LIBERO approach if multi-task
- May need multiple data files
- All in chunk-000

**Large datasets (>1000 episodes):**
```json
{
    "chunks_size": 1000,
    "data_files_size_in_mb": 100,
    "video_files_size_in_mb": 500
}
```
- Will need multiple chunks
- Many data files
- Consider SVLA consolidation if single-task

---

## v2.1 vs v3.0 Changes

### File Organization

**v2.1:**
```
dataset/
├── episode_000000.parquet
├── episode_000001.parquet
├── video_000000.mp4
├── video_000001.mp4
└── ...
```
- One file per episode
- Can have 1000s of files
- Scattered structure

**v3.0:**
```
dataset/
├── data/chunk-000/file-000.parquet       # Many episodes
├── videos/.../chunk-000/file-000.mp4     # One or many episodes
└── meta/episodes/chunk-000/file-000.parquet
```
- Consolidated files
- Organized chunks
- Metadata-driven access

### Metadata Format

**v2.1:**
- tasks.jsonl (JSON Lines)
- episodes_stats.jsonl
- JSON-based metadata

**v3.0:**
- tasks.parquet (Parquet)
- meta/episodes/chunk-000/*.parquet
- Parquet-based metadata

**Benefits:** Columnar storage, compression, schema evolution

### Scalability

**v2.1:**
- Works well for <1000 episodes
- File system struggles with large datasets
- Slow directory listing

**v3.0:**
- Handles millions of episodes
- Efficient chunk-based organization
- Fast I/O with larger files

### Migration

**Automatic conversion available:**
```bash
python scripts/convert_dataset_v2_to_v3.py
```

**Or create v3.0 directly using LeRobotDataset.create()**

---

## Our Dataset Strategy

### piper_picking_tests Characteristics

```
Total Episodes: 13
Total Frames: 5,016
Total Tasks: 12 (one duplicate: scissors/scissors_hidden)
Cameras: 2 (table_cam 800×720, wrist_cam 640×480)
FPS: 30
Robot: 7-DOF arm
State: 7D joint angles
Action: 7D commands
```

### Recommended Structure: LIBERO Multi-Task Style

**Why LIBERO approach?**
- ✅ Multi-task dataset (12 distinct tasks)
- ✅ Each episode = one task type
- ✅ Easier task management
- ✅ Better for VLA training
- ✅ Explicit task conditioning

**File Structure:**
```
piper_picking_tests_v3/
├── meta/
│   ├── info.json
│   ├── stats.json
│   ├── tasks.parquet                    # 12 tasks, descriptions as index
│   └── episodes/
│       └── chunk-000/
│           └── file-000.parquet         # 13 episodes (NO tasks field)
├── data/
│   └── chunk-000/
│       └── file-000.parquet             # All 5,016 frames (WITH task_index)
└── videos/
    ├── observation.images.table_cam/
    │   └── chunk-000/
    │       ├── file-000.mp4             # Episode 0 (cleaningcloth)
    │       ├── file-001.mp4             # Episode 1 (fillamentroll)
    │       └── ...                      # 13 files total
    └── observation.images.wrist_cam/
        └── chunk-000/
            └── ...                      # 13 files total
```

### Configuration

```json
{
    "codebase_version": "v3.0",
    "robot_type": "piper",
    "total_episodes": 13,
    "total_frames": 5016,
    "total_tasks": 12,
    "chunks_size": 1000,
    "data_files_size_in_mb": 50,
    "video_files_size_in_mb": 200,
    "fps": 30
}
```

### Task Language Mapping

```python
TASK_LANGUAGE_MAP = {
    0: "Pick up the cleaning cloth from the table.",
    1: "Grasp and pick up the filament roll.",
    2: "Pick up the game controller from the table.",
    3: "Pick up the hex wrench tool.",
    4: "Grasp and pick up the pencil.",
    5: "Pick up the scissors from the table.",
    6: "Find and pick up the scissors that are partially hidden.",
    7: "Pick up the screwdriver from the table.",
    8: "Grasp and pick up the small key.",
    9: "Pick up the small piece of paper.",
    10: "Pick up the small wooden stick.",
    11: "Pick up the thin metal disk.",
}
```

### Expected Sizes

- **Data parquet**: ~0.4 MB (5,016 frames × 80 bytes/frame)
- **Videos**: ~8 MB per episode per camera (compressed av1)
  - 13 episodes × 2 cameras × 8 MB = ~208 MB total
- **Metadata**: <1 MB
- **Total**: ~210 MB (vs 6.2 GB current PNG format)

### Why This Strategy?

1.**Multi-task structure** matches dataset nature
2.**One video per episode** enables flexible loading
3.**LIBERO approach** provides clean task management
4.**task_index in frames** ensures proper VLA conditioning
5. ✅ **Single chunk** sufficient for 13 episodes
6. ✅ **Scalable** if we add more episodes later

---

## Verification Checklist

### Format Compliance
- [ ] data/ directory with parquet files
- [ ] videos/ directories with MP4 files (av1 codec)
- [ ] meta/info.json with v3.0 schema
- [ ] meta/episodes/ with parquet metadata
- [ ] meta/tasks.parquet (if LIBERO approach)
- [ ] meta/stats.json with aggregated statistics

### Data Integrity
- [ ] All episodes present (13)
- [ ] All frames present (5,016)
- [ ] All tasks defined (12)
- [ ] task_index in data frames (LIBERO approach)
- [ ] Episode metadata includes file mappings
- [ ] Videos playable and correct length

### VLA Compatibility
- [ ] Language instructions are natural, descriptive
- [ ] task_index maps correctly to language descriptions
- [ ] Can load with LeRobotDataset.load()
- [ ] Test with SmolVLA/Pi0 data loading
- [ ] Language conditioning works in VLA models

### Statistics
- [ ] Per-episode stats in episode metadata
- [ ] Aggregated stats in meta/stats.json
- [ ] Reasonable value ranges
- [ ] Mean/std suitable for normalization

---

## References

- [Phospho.ai LeRobot Dataset Documentation](https://docs.phospho.ai/learn/lerobot-dataset)
- [LeRobot v3.0 Official Docs](https://huggingface.co/docs/lerobot/lerobot-dataset-v3)
- [Porting Datasets Guide](https://huggingface.co/docs/lerobot/porting_datasets_v3)
- **Example Datasets Analyzed:**
  - svla_so100_stacking (56 episodes, 1 task, SVLA approach)
  - LIBERO (1,693 episodes, 40 tasks, LIBERO approach)

**Document Version:** 1.0 (December 2025)
**Verified Against:** LeRobot v3.0, Phospho.ai docs, SVLA, LIBERO datasets