Skip to content

Droid Dataset Finetuning action dimension mismatch #580

Description

@AsDeadAsADodo

Hi, thanks for the great work! I'm trying to fine-tune the Pi0 base model on the Droid dataset. I defined a TrainConfig as follows:

    TrainConfig(
        name="pi0_droid_finetune",
        model=pi0.Pi0Config(
            paligemma_variant="gemma_2b_lora", 
            action_expert_variant="gemma_300m_lora",
            action_dim = 8,            
            action_horizon=16,
            max_token_len=180),
        # The freeze filter defines which parameters should be frozen during training.
        # We have a convenience function in the model config that returns the default freeze filter
        # for the given model config for LoRA finetuning. Just make sure it matches the model config
        # you chose above.
        freeze_filter=pi0.Pi0Config(
            paligemma_variant="gemma_2b_lora", 
            action_expert_variant="gemma_300m_lora",
            action_dim = 8,            
            action_horizon=16,
            max_token_len=180,
        ).get_freeze_filter(),
        # Turn off EMA for LoRA finetuning.
        ema_decay=None,
        data=RLDSDroidDataConfig(
            repo_id="droid",
            # Set this to the path to your DROID RLDS dataset (the parent directory of the `droid` directory).
            rlds_data_dir="/root/autodl-tmp/",
            action_space=droid_rlds_dataset.DroidActionSpace.JOINT_POSITION,
        ),
        weight_loader=weight_loaders.CheckpointWeightLoader("/root/autodl-tmp/openpi/pi0_base/params"),
        num_train_steps=30_000,
        num_workers=0
    )

After computing the norm stats, I ran the following command:

uv run --group rlds scripts/train.py pi0_droid_finetune --exp-name=my_experiment --overwrite

I got a dimension mismatch error:

Traceback (most recent call last):
  File "/root/autodl-tmp/openpi/scripts/train.py", line 281, in <module>
    main(_config.cli())
  File "/root/autodl-tmp/openpi/scripts/train.py", line 237, in main
    train_state, train_state_sharding = init_train_state(config, init_rng, mesh, resume=resuming)
                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/autodl-tmp/openpi/.venv/lib/python3.11/site-packages/jaxtyping/_decorator.py", line 559, in wrapped_fn
    return wrapped_fn_impl(args, kwargs, bound, memos)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/autodl-tmp/openpi/.venv/lib/python3.11/site-packages/jaxtyping/_decorator.py", line 483, in wrapped_fn_impl
    out = fn(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^
  File "/root/autodl-tmp/openpi/scripts/train.py", line 122, in init_train_state
    partial_params = _load_weights_and_validate(config.weight_loader, train_state_shape.params.to_pure_dict())
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/autodl-tmp/openpi/scripts/train.py", line 76, in _load_weights_and_validate
    at.check_pytree_equality(expected=params_shape, got=loaded_params, check_shapes=True, check_dtypes=True)
  File "/root/autodl-tmp/openpi/src/openpi/shared/array_typing.py", line 87, in check_pytree_equality
    jax.tree_util.tree_map_with_path(check, expected, got)
  File "/root/autodl-tmp/openpi/.venv/lib/python3.11/site-packages/jax/_src/tree_util.py", line 1183, in tree_map_with_path
    return treedef.unflatten(f(*xs) for xs in zip(*all_keypath_leaves))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/autodl-tmp/openpi/.venv/lib/python3.11/site-packages/jax/_src/tree_util.py", line 1183, in <genexpr>
    return treedef.unflatten(f(*xs) for xs in zip(*all_keypath_leaves))
                             ^^^^^^
  File "/root/autodl-tmp/openpi/src/openpi/shared/array_typing.py", line 82, in check
    raise ValueError(f"Shape mismatch at {jax.tree_util.keystr(kp)}: expected {x.shape}, got {y.shape}")
ValueError: Shape mismatch at ['action_in_proj']['kernel']: expected (8, 1024), got (32, 1024)

The Droid dataset requires an action dimension of 8, but the checkpoint seems to use 32.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions