mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-24 18:26:11 +00:00
migration: fall back to structural-only when joint dim isn't a multiple of 6
Datasets whose action/state dim is not a multiple of 6 (e.g. 7-dim with an appended EE pose, or 10-dim) are not a plain stack of SO arms, so the degrees mapping doesn't apply. Migrate them structurally instead of aborting the whole dataset with a ValueError.
This commit is contained in:
@@ -8,7 +8,7 @@ import numpy as np
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
|
||||||
import so_arm_frame
|
import so_arm_frame
|
||||||
from classify import classify
|
from classify import classify, load_info
|
||||||
|
|
||||||
VALUE_COLS = ("observation.state", "action")
|
VALUE_COLS = ("observation.state", "action")
|
||||||
|
|
||||||
@@ -78,6 +78,14 @@ def fix_dataset_in_place(root) -> dict:
|
|||||||
return {**cls, "converted": False,
|
return {**cls, "converted": False,
|
||||||
"action": "structural v2.1->v3.0 only; joint values kept in normalized units "
|
"action": "structural v2.1->v3.0 only; joint values kept in normalized units "
|
||||||
"(-100..100 / 0..100), NOT converted to degrees (uncalibrated -> APPROXIMATE)"}
|
"(-100..100 / 0..100), NOT converted to degrees (uncalibrated -> APPROXIMATE)"}
|
||||||
|
feats = load_info(root).get("features", {})
|
||||||
|
dims = [feats[c]["shape"][0] for c in VALUE_COLS if c in feats and feats[c].get("shape")]
|
||||||
|
if any(d % 6 != 0 for d in dims):
|
||||||
|
# Not a plain stack of 6-joint SO arms (e.g. 7-dim with an appended EE pose): the
|
||||||
|
# degrees mapping doesn't apply, so migrate structurally and leave the values alone.
|
||||||
|
return {**cls, "converted": False,
|
||||||
|
"action": f"structural v2.1->v3.0 only; joint dims {dims} not a multiple of 6 "
|
||||||
|
"(non-standard arm), joint values left unchanged"}
|
||||||
# drop stray files that would otherwise be uploaded
|
# drop stray files that would otherwise be uploaded
|
||||||
for junk in (root / "meta").glob("info.json.bak"):
|
for junk in (root / "meta").glob("info.json.bak"):
|
||||||
junk.unlink()
|
junk.unlink()
|
||||||
|
|||||||
Reference in New Issue
Block a user