PartialFC: Distributing only part of the model #15701
Unanswered
w2ex
asked this question in
DDP / multi-GPU / multi-node
Replies: 1 comment
-
Hi, @w2ex! Have you implemented PartialFC in pytorch lightning? Or did you stick to torch for following architecture? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am willing to implement PartialFC based on InsightFace implementation, which is fully Pytorch.
The main idea is to distribute the backbone of the model with
torch.nn.distributed.DistributedDataParallel
(see here ), but not the head. This is straightforward in plain Pytorch, but not in Pytorch Lightning.If I understand correctly, in Pytorch Lightning, the parallelized strategy has to be specified through the
strategy
argument of theTrainer
.My question is : if i create a new strategy inherited from
DDPStrategy
, and override the_setup_model()
function as follow (only apply DDP onmodel.backbone
and not the full model), will it be enough ?I know I also have to deal with some instance check in
_register_ddp_hooks
andteardown
, but I want to know if I am missing anything else.Last, will I be able to launch my script using
torchrun
or is there any incompatibility with Pytorch Lightning ?Thank you very much.
Beta Was this translation helpful? Give feedback.
All reactions