Skip to content

Commit 47f2d34

Browse files
authored
Merge pull request #15 from isaac-sim/xyao/fix_license
Simplified task index & name in dataset conversion
2 parents 17465e0 + cb59b1d commit 47f2d34

File tree

2 files changed

+14
-20
lines changed

2 files changed

+14
-20
lines changed

README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,15 +141,15 @@ The process involved converting demonstration data (Mimic-generated motion traje
141141
- Using a python interpreter or conda/virtual env that has Isaac Lab, GR00T and Eavluation Tasks installed, convert Mimic-generated trajectories by
142142

143143
```bash
144-
# Example: Set `task_index` Based on Task
144+
# Example: Set `task_name` Based on Task
145145
# Nut Pouring
146-
export TASK_INDEX=0
147-
# Uncomment the below is Task is Exhaust Pipe Sorting
148-
# export TASK_INDEX=2
146+
export TASK_NAME="nutpouring"
147+
# Uncomment the below when Task is Exhaust Pipe Sorting
148+
# export TASK_NAME="pipesorting"
149149

150150
# Within IsaacLabEvalTasks directory
151151
# DATASET_ROOT_DIR is directory of where Mimic-generated HDF5 is saved locally
152-
python scripts/convert_hdf5_to_lerobot.py --task_index $TASK_INDEX --data_root $DATASET_ROOT_DIR
152+
python scripts/convert_hdf5_to_lerobot.py --task_name $TASK_NAME--data_root $DATASET_ROOT_DIR
153153
```
154154

155155
The GR00T-LeRobot-compatible datasets will be available in `DATASET_ROOT_DIR`.
@@ -181,9 +181,7 @@ tasks. The ordered sets of joints observed in simulation ([i.e. robot states fro
181181

182182
GR00T-Lerobot schema also requires [additional metadata](https://github.com/NVIDIA/Isaac-GR00T/blob/main/getting_started/LeRobot_compatible_data_schema.md#meta). We include them ([info.json](scripts/config/gr00t/info.json), [modality.json](scripts/config/gr00t/info.json)) as templates to facilitate conversion. If you are working with other embodiments and data configurations, please modify them accordingly.
183183

184-
The `TASK_INDEX` is associated with the pre-defined task description in [`Gr00tN1DatasetConfig`](scripts/config/args.py) class, where 1 is reserved for data validity check, following GR00T-N1 guidelines. You may want to add other indices for your self-defined task.
185-
186-
If you are interested in leveraging this tool for other tasks, please change the task metadata in `EvalTaskConfig' defined in the [configuration](scripts/config/args.py). More manipulation tasks are coming soon!
184+
If you are interested in leveraging this tool for other tasks, please change the task metadata in `EvalTaskConfig` defined in the [configuration](scripts/config/args.py). The `TASK_NAME` is associated with the pre-defined task description in [`Gr00tN1DatasetConfig`](scripts/config/args.py) class. The task_index indicates the index associated with language description, and 1 is reserved for data validity check, following GR00T-N1 guidelines. You may want to add other indices for your self-defined task. More manipulation tasks are coming soon!
187185

188186
### Post Training
189187

scripts/config/args.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,23 @@ class EvalTaskConfig(Enum):
2929
" the metallic measuring scale."
3030
),
3131
"nut_pouring_task.hdf5",
32+
0 # 1 is reserved for data validity check, following GR00T-N1 guidelines.
3233
)
3334
PIPESORTING = (
3435
"Isaac-ExhaustPipe-GR1T2-ClosedLoop-v0",
3536
"/home/gr00t/GR00T-N1-2B-tuned-Exhaust-Pipe-Sorting-task",
3637
"Pick up the blue pipe and place it into the blue bin.",
3738
"exhaust_pipe_sorting_task.hdf5",
39+
2 # 1 is reserved for data validity check, following GR00T-N1 guidelines.
3840
)
3941

40-
def __init__(self, task: str, model_path: str, language_instruction: str, hdf5_name: str):
42+
def __init__(self, task: str, model_path: str, language_instruction: str, hdf5_name: str, task_index: int):
4143
self.task = task
4244
self.model_path = model_path
4345
self.language_instruction = language_instruction
4446
self.hdf5_name = hdf5_name
45-
47+
assert task_index != 1, "task_index must not be 1. (Use 0 for nutpouring, 2 for exhaustpipe, etc.)"
48+
self.task_index = task_index
4649

4750
@dataclass
4851
class Gr00tN1ClosedLoopArguments:
@@ -194,14 +197,7 @@ class Gr00tN1DatasetConfig:
194197
default="", metadata={"description": "Instruction given to the policy in natural language."}
195198
)
196199
hdf5_name: str = field(default="", metadata={"description": "Name of the HDF5 file to use for the dataset."})
197-
task_index: int = field(
198-
default=0,
199-
metadata={
200-
"description": (
201-
"Index of the task in the task list. Do not use 1. (E.g. 0 for nutpouring, 2 for exhaustpipe)."
202-
)
203-
},
204-
)
200+
205201
# Mimic-generated HDF5 datafield
206202
state_name_sim: str = field(
207203
default="robot_joint_pos", metadata={"description": "Name of the state in the HDF5 file."}
@@ -293,17 +289,17 @@ class Gr00tN1DatasetConfig:
293289

294290
hdf5_file_path: Path = field(init=False)
295291
lerobot_data_dir: Path = field(init=False)
292+
task_index: int = field(init=False) # task index for the task description in LeRobot file
296293

297294
def __post_init__(self):
298-
# Reserve task_index 1 for the validity check field
299-
assert self.task_index != 1, "task_index must not be 1. (Use 0 for nutpouring, 2 for exhaustpipe, etc.)"
300295

301296
# Populate fields from enum based on task_name
302297
if self.task_name.upper() not in EvalTaskConfig.__members__:
303298
raise ValueError(f"task_name must be one of: {', '.join(EvalTaskConfig.__members__.keys())}")
304299
config = EvalTaskConfig[self.task_name.upper()]
305300
self.language_instruction = config.language_instruction
306301
self.hdf5_name = config.hdf5_name
302+
self.task_index = config.task_index
307303

308304
self.hdf5_file_path = self.data_root / self.hdf5_name
309305
self.lerobot_data_dir = self.data_root / self.hdf5_name.replace(".hdf5", "") / "lerobot"

0 commit comments

Comments
 (0)