MCPcopy Create free account
hub / github.com/microsoft/Cream / ddpify

Method ddpify

TinyCLIP/src/open_clip/model.py:977–988  ·  view source on GitHub ↗
(self, ddp_fn)

Source from the content-addressed store, hash-verified

975 self._without_ddp[1] = self._text_encoder
976
977 def ddpify(self, ddp_fn):
978 def _ddp_fn(module):
979 cnt = sum([p.numel()
980 for p in module.parameters() if p.requires_grad])
981 if cnt > 0:
982 return ddp_fn(module)
983 return FakeDDP(module)
984 self._image_encoder = _ddp_fn(self.image_encoder_without_ddp)
985 self._text_encoder = _ddp_fn(self.text_encoder_without_ddp)
986 self._logit_scale = _ddp_fn(self.logit_scale_without_ddp)
987
988 self.used_ddp = True
989
990 def forward(self, image, text, normalized=True):
991 image_features = text_features = None

Callers 3

train_one_epochFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls

no outgoing calls

Tested by 1

mainFunction · 0.64