Skip to content

Commit

Permalink
Rename weights to c_weight
Browse files Browse the repository at this point in the history
  • Loading branch information
crowsonkb committed Aug 12, 2023
1 parent d911c4b commit 100ea11
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions k_diffusion/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def get_scalings(self, sigma):

def loss(self, input, noise, sigma, **kwargs):
c_skip, c_out, c_in = [utils.append_dims(x, input.ndim) for x in self.get_scalings(sigma)]
c_weight = self.weighting(sigma)
noised_input = input + noise * utils.append_dims(sigma, input.ndim)
model_output = self.inner_model(noised_input * c_in, sigma, **kwargs)
target = (input - c_skip * noised_input) / c_out
weights = self.weighting(sigma)
return (model_output - target).pow(2).flatten(1).mean(1) * weights
return (model_output - target).pow(2).flatten(1).mean(1) * c_weight

def forward(self, input, sigma, **kwargs):
c_skip, c_out, c_in = [utils.append_dims(x, input.ndim) for x in self.get_scalings(sigma)]
Expand Down

0 comments on commit 100ea11

Please sign in to comment.