MCPcopy
hub / github.com/DrewThomasson/ebook2audiobook / update

Method update

ext/py/demucs/demucs/ema.py:42–53  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

40 self.state[key] = val.detach().to(device, copy=True)
41
42 def update(self):
43 if self.unbias:
44 self.count = self.count * self.decay + 1
45 w = 1 / self.count
46 else:
47 w = 1 - self.decay
48 for key, val in self.model.state_dict().items():
49 if val.dtype != torch.float32:
50 continue
51 device = self.device or val.device
52 self.state[key].mul_(1 - w)
53 self.state[key].add_(val.detach().to(device), alpha=w)
54
55 @contextmanager
56 def swap(self):

Callers 15

extract_custom_modelFunction · 0.45
compare_checksumsFunction · 0.45
convert_chapters2audioFunction · 0.45
translate_blocksFunction · 0.45
finalize_audiobookFunction · 0.45
_disable_componentsFunction · 0.45
_enable_componentsFunction · 0.45
_disable_on_voice_uploadFunction · 0.45
_enable_on_voice_uploadFunction · 0.45
_enable_on_custom_uploadFunction · 0.45
_restore_interfaceFunction · 0.45

Calls 1

state_dictMethod · 0.80

Tested by

no test coverage detected