Moved x0 logic to the model class instead of recalculating it multiple times in the trainer
This commit is contained in:
1 parent
c22f21fa95
commit
15303bf876
4 files changed
+32
-9
No files matched your search
@@ -1783,3 +1783,11 @@ class BaseModel:
|
||||
def scale_loss(self, loss):
|
||||
# called to get the loss scaler for the model. Can be overridden in child classes
|
||||
return loss
|
||||
|
||||
def get_x0_prediction(self, model_output: torch.Tensor, model_input: torch.Tensor, sigma: torch.Tensor):
|
||||
# can be overridden in child classes to get the x0 prediction from model output
|
||||
# step latent, use here or with do_fft_loss
|
||||
if self.x0_pred:
|
||||
return model_output
|
||||
else:
|
||||
return model_input - sigma * model_output
|
||||
Reference in new issue
Block a user