Skip to content

Commit

Permalink
Skip fsdp2 import if running with deploy (pytorch#2483)
Browse files Browse the repository at this point in the history
Summary:

title, this breaks deploy models

Reviewed By: sayitmemory

Differential Revision: D64237929
  • Loading branch information
s4ayub authored and facebook-github-bot committed Oct 22, 2024
1 parent e7690e2 commit 8aa7c36
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion torchrec/distributed/train_pipeline/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,17 @@
Union,
)

import torch
from torch import distributed as dist

from torch.distributed._composable.fsdp.fully_shard import FSDPModule as FSDP2
if not torch._running_with_deploy():
from torch.distributed._composable.fsdp.fully_shard import FSDPModule as FSDP2
else:

class FSDP2:
pass


from torch.distributed.fsdp import FullyShardedDataParallel as FSDP
from torch.fx.immutable_collections import (
immutable_dict as fx_immutable_dict,
Expand Down

0 comments on commit 8aa7c36

Please sign in to comment.