Skip to content

GR00TN15Config dataclass fails on Python 3.10 (lerobot 0.4.4): "non-default argument 'backbone_cfg' follows default argument" #3775

Description

@HariKrishnan06082k

Ticket Type

🐛 Bug Report (Something isn't working)

Environment & System Info

- LeRobot version: 0.4.4
- Platform: Linux-6.14.0-1020-oem-x86_64-with-glibc2.39
- Python version: 3.10.20
- Huggingface Hub version: 1.18.0
- Datasets version: 4.8.5
- Numpy version: 2.2.6
- FFmpeg version: 6.1.1-3ubuntu5
- PyTorch version: 2.10.0+cu128
- Is PyTorch built with CUDA support?: True
- Cuda version: 12.8
- GPU model: NVIDIA RTX 6000 Ada Generation
- Using GPU in script?: <fill in>
- lerobot scripts: ['lerobot-calibrate', 'lerobot-dataset-viz', 'lerobot-edit-dataset', 'lerobot-eval', 'lerobot-find-cameras', 'lerobot-find-joint-limits', 'lerobot-find-port', 'lerobot-imgtransform-viz', 'lerobot-info', 'lerobot-record', 'lerobot-replay', 'lerobot-setup-can', 'lerobot-setup-motors', 'lerobot-teleoperate', 'lerobot-train', 'lerobot-train-tokenizer']

Description

Bug

GR00TN15Config (in lerobot/policies/groot/groot_n1.py) fails to construct on
Python 3.10 with TypeError: non-default argument 'backbone_cfg' follows default argument.

The crash happens at import time, not at use time — so any code path that touches
lerobot.policies transitively (the package's own __init__.py does) cannot even start.
That includes uninvolved policies like ACTPolicy, which is what blocked me first.

What's happening

@dataclass
class GR00TN15Config(PretrainedConfig):
    model_type = "gr00t_n1_5"
    backbone_cfg: dict     = field(init=False, metadata={"help": "..."})   # no default
    action_head_cfg: dict  = field(init=False, metadata={"help": "..."})   # no default
    action_horizon: int    = field(init=False, metadata={"help": "..."})   # no default
    action_dim: int        = field(init=False, metadata={"help": "..."})   # no default
    compute_dtype: str     = field(default="float32", metadata={"help": "..."})  # has default

On Python 3.10, field(init=False) without default= is treated as a non-default
field by dataclasses._init_fn. It then conflicts with compute_dtype (which does
have a default), and Python rejects the class with the field-ordering error. The class
never finishes being defined, so the entire groot_n1 module fails to import.

Reproduction (in this env)

python3.10 -c "from lerobot.policies.groot.groot_n1 import GR00TN15Config"
# TypeError: non-default argument 'backbone_cfg' follows default argument

# Or the more useful symptom — anything that touches lerobot.policies:
python3.10 -c "from lerobot.policies.act.configuration_act import ACTConfig"
# Same crash via lerobot/policies/__init__.py -> groot -> groot_n1.

Full traceback

File ".../lerobot/policies/groot/__init__.py", line 18, in <module>
    from .modeling_groot import GrootPolicy
File ".../lerobot/policies/groot/modeling_groot.py", line 46, in <module>
    from lerobot.policies.groot.groot_n1 import GR00TN15
File ".../lerobot/policies/groot/groot_n1.py", line 177, in <module>
    class GR00TN15Config(PretrainedConfig):
File ".../python3.10/dataclasses.py", line 1184, in dataclass
    return wrap(cls)
File ".../python3.10/dataclasses.py", line 544, in _init_fn
    raise TypeError(f'non-default argument {f.name!r} follows default argument')
TypeError: non-default argument 'backbone_cfg' follows default argument

Suggested one-line fix

Add default=None to each init=False field. The class's __init__(self, **kwargs)
already sets these attributes from kwargs immediately, so None is never observed at
runtime — it's purely there to satisfy the dataclass field-ordering rule:

backbone_cfg: dict    = field(default=None, init=False, metadata={"help": "..."})
action_head_cfg: dict = field(default=None, init=False, metadata={"help": "..."})
action_horizon: int   = field(default=None, init=False, metadata={"help": "..."})
action_dim: int       = field(default=None, init=False, metadata={"help": "..."})
compute_dtype: str    = field(default="float32", metadata={"help": "..."})

Verified locally: this patch makes the import succeed, and downstream imports
(ACTConfig, etc.) work again. No other behavior changes.

Related

Possibly the Python 3.10 / lerobot 0.4.4 variant of #
(StrictDataclassDefinitionError on Python 3.12 / lerobot 0.5.2). Same class,
different downstream failure depending on Python and huggingface_hub versions.
Both bugs likely close with the same one-line patch above; I'm happy to open a PR.

Context & Reproduction

python3.10 -c "from lerobot.policies.groot.groot_n1 import GR00TN15Config"
# TypeError: non-default argument 'backbone_cfg' follows default argument

# Or the more useful symptom — anything that touches lerobot.policies:
python3.10 -c "from lerobot.policies.act.configuration_act import ACTConfig"
# Same crash via lerobot/policies/__init__.py -> groot -> groot_n1.

Relevant logs or stack trace

File ".../lerobot/policies/groot/__init__.py", line 18, in <module>
    from .modeling_groot import GrootPolicy
File ".../lerobot/policies/groot/modeling_groot.py", line 46, in <module>
    from lerobot.policies.groot.groot_n1 import GR00TN15
File ".../lerobot/policies/groot/groot_n1.py", line 177, in <module>
    class GR00TN15Config(PretrainedConfig):
File ".../python3.10/dataclasses.py", line 1184, in dataclass
    return wrap(cls)
File ".../python3.10/dataclasses.py", line 544, in _init_fn
    raise TypeError(f'non-default argument {f.name!r} follows default argument')
TypeError: non-default argument 'backbone_cfg' follows default argument

Checklist

  • I have searched existing tickets to ensure this isn't a duplicate.
  • I am using the latest version of the main branch.
  • I have verified this is not an environment-specific problem.

Additional Info / Workarounds

Suggested one-line fix

Add default=None to each init=False field. The class's __init__(self, **kwargs)
already sets these attributes from kwargs immediately, so None is never observed at
runtime — it's purely there to satisfy the dataclass field-ordering rule:

backbone_cfg: dict    = field(default=None, init=False, metadata={"help": "..."})
action_head_cfg: dict = field(default=None, init=False, metadata={"help": "..."})
action_horizon: int   = field(default=None, init=False, metadata={"help": "..."})
action_dim: int       = field(default=None, init=False, metadata={"help": "..."})
compute_dtype: str    = field(default="float32", metadata={"help": "..."})

Verified locally: this patch makes the import succeed, and downstream imports
(ACTConfig, etc.) work again. No other behavior changes.

Related

Possibly the Python 3.10 / lerobot 0.4.4 variant of #
(StrictDataclassDefinitionError on Python 3.12 / lerobot 0.5.2). Same class,
different downstream failure depending on Python and huggingface_hub versions.
Both bugs likely close with the same one-line patch above; I'm happy to open a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn’t working correctlyconfigurationProblems with configuration files or settingspoliciesItems related to robot policies

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions