Skip to content
Open
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
5 changes: 5 additions & 0 deletions training/phema.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ def __init__(self, net, stds=[0.010, 0.050, 0.100]):
self.net = net
self.stds = stds
self.emas = [copy.deepcopy(net) for _std in stds]
# Added eval() mode, prevent EDM2 to self-normalize and change weights at sampling/evaluation.
for ema in self.emas:
ema.eval()

@torch.no_grad()
def reset(self):
Expand Down Expand Up @@ -133,6 +136,8 @@ def __init__(self, net, ema_beta=0.9999, halflife_Mimg=None, rampup_ratio=None):
self.halflife_Mimg = halflife_Mimg
self.rampup_ratio = rampup_ratio
self.ema = copy.deepcopy(net)
# Added eval() mode, prevent EDM2 to self-normalize and change weights at sampling/evaluation.
self.ema.eval()

@torch.no_grad()
def reset(self):
Expand Down