(self, x, c, *args, **kwargs)
| 845 | return loss |
| 846 | |
| 847 | def forward(self, x, c, *args, **kwargs): |
| 848 | t = torch.randint(0, self.num_timesteps, (x.shape[0],), device=self.device).long() |
| 849 | if self.model.conditioning_key is not None: |
| 850 | assert c is not None |
| 851 | if self.cond_stage_trainable: |
| 852 | c = self.get_learned_conditioning(c) |
| 853 | if self.shorten_cond_schedule: # TODO: drop this option |
| 854 | tc = self.cond_ids[t].to(self.device) |
| 855 | c = self.q_sample(x_start=c, t=tc, noise=torch.randn_like(c.float())) |
| 856 | return self.p_losses(x, c, t, *args, **kwargs) |
| 857 | |
| 858 | def apply_model(self, x_noisy, t, cond, return_ids=False): |
| 859 | if isinstance(cond, dict): |
nothing calls this directly
no test coverage detected