Skip to content

[BUG]FSDP initialization fails when transformer layer wrap names are stored as a set #1186

@Wangxiaoxiaoa

Description

@Wangxiaoxiaoa

Checklist

  • The error occurs when using our provided Docker image.
  • I can consistently reproduce the bug across multiple trials or random seeds.
  • If the error causes experiment abortion, I've verified that this error is the root
    cause, not a secondary error caused by peer workers.

Detailed Information

Describe the bug

FSDP initialization fails with TypeError: 'set' object is not subscriptable.

The failure happens when the transformer layer wrap names are represented as a
set, but the FSDP initialization path assumes the value is indexable.

Expected behavior

FSDP initialization should handle common container types for transformer wrap
names, including set, instead of failing on a type mismatch.

Full logs

Relevant excerpt from the real log:

(AReaL) 20260415-06:21:44.507 EngineBP ERROR: Engine method 'initialize' failed: 'set' object is not subscriptable
Traceback (most recent call last):
  File "areal/infra/rpc/guard/engine_blueprint.py", line 537, in execute_in_engine_thread
    result = method(*args_bcast, **kwargs_bcast)
  File "areal/engine/fsdp_engine.py", line 340, in initialize
    parallelize_model(
  File "areal/engine/fsdp_utils/parallel.py", line 396, in parallelize_model
    apply_fsdp2(model, fsdp_kwargs, wrap_policy)
  File "areal/engine/fsdp_utils/__init__.py", line 80, in apply_fsdp2
    and fsdp_transformer_layer_cls_to_wrap[0] is not None
TypeError: 'set' object is not subscriptable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions