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
2 changes: 1 addition & 1 deletion 3rdparty/Megatron-Bridge-workspace/Megatron-Bridge
Submodule Megatron-Bridge updated 512 files
7 changes: 5 additions & 2 deletions nemo_rl/models/policy/workers/megatron_policy_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
from megatron.core.dist_checkpointing.strategies.torch import get_async_strategy
from megatron.core.distributed import DistributedDataParallel
from megatron.core.distributed.fsdp.mcore_fsdp_adapter import (
FullyShardedDataParallel as custom_FSDP,
FullyShardedDataParallelV1,
FullyShardedDataParallelV2,
)
from megatron.core.optimizer import ChainedOptimizer
from megatron.core.rerun_state_machine import get_rerun_state_machine
Expand Down Expand Up @@ -2895,7 +2896,9 @@ def move_model(
raise ValueError(
f"Invalid device: {device}. Only strings 'cpu' and 'cuda' are supported."
)
elif isinstance(model, custom_FSDP):
elif isinstance(
model, (FullyShardedDataParallelV1, FullyShardedDataParallelV2)
):
if device == "cpu":
model.param_and_grad_buffer.offload_to_cpu(move_params, move_grads)
elif device == "cuda":
Expand Down
7 changes: 5 additions & 2 deletions nemo_rl/models/value/workers/megatron_value_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
from megatron.core import parallel_state
from megatron.core.distributed import DistributedDataParallel
from megatron.core.distributed.fsdp.mcore_fsdp_adapter import (
FullyShardedDataParallel as custom_FSDP,
FullyShardedDataParallelV1,
FullyShardedDataParallelV2,
)
from megatron.core.models.gpt import GPTModel
from megatron.core.optimizer import ChainedOptimizer
Expand Down Expand Up @@ -817,7 +818,9 @@ def move_model(
raise ValueError(
f"Invalid device: {device}. Only 'cpu' and 'cuda' are supported."
)
elif isinstance(model, custom_FSDP):
elif isinstance(
model, (FullyShardedDataParallelV1, FullyShardedDataParallelV2)
):
if device == "cpu":
model.param_and_grad_buffer.offload_to_cpu(move_params, move_grads)
elif device == "cuda":
Expand Down
Loading
Loading