Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions verl/workers/config/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,10 @@ def __post_init__(self):
"""Validate FSDP actor configuration parameters."""
super().__post_init__()
self.engine = self.fsdp_config
# Sync strategy to engine config so engine_workers can pick the right FSDP version.
# EngineConfig.strategy defaults to None, so without this, engine_workers.py always
# falls back to FSDP1 even when actor.strategy="fsdp2".
object.__setattr__(self.engine, "strategy", self.strategy)

# backward compatibility
if self.ulysses_sequence_parallel_size > 1:
Expand Down
4 changes: 4 additions & 0 deletions verl/workers/config/critic.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ def __post_init__(self):
"""Validate FSDP critic configuration parameters."""
super().__post_init__()
self.engine = self.fsdp
# Sync strategy to engine config so engine_workers can pick the right FSDP version.
# EngineConfig.strategy defaults to None, so without this, engine_workers.py always
# falls back to FSDP1 even when critic.strategy="fsdp2".
object.__setattr__(self.engine, "strategy", self.strategy)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

In addition to syncing the strategy, ulysses_sequence_parallel_size should also be synced to the engine configuration in FSDPCriticConfig for consistency and backward compatibility, similar to the implementation in FSDPActorConfig. Without this, sequence parallelism settings defined at the top level of the critic configuration will not propagate to the underlying FSDP engine.

Note that ulysses_sequence_parallel_size is already defined as a mutable field in FSDPEngineConfig, so direct assignment is permitted.

        object.__setattr__(self.engine, "strategy", self.strategy)

        # backward compatibility
        if self.ulysses_sequence_parallel_size > 1:
            self.fsdp.ulysses_sequence_parallel_size = self.ulysses_sequence_parallel_size


if self.strategy in {"fsdp", "fsdp2"}:
if self.ulysses_sequence_parallel_size > 1:
Expand Down
Loading