(self, x_noisy, t, cond, return_ids=False)
| 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): |
| 860 | # hybrid case, cond is expected to be a dict |
| 861 | pass |
| 862 | else: |
| 863 | if not isinstance(cond, list): |
| 864 | cond = [cond] |
| 865 | key = 'c_concat' if self.model.conditioning_key == 'concat' else 'c_crossattn' |
| 866 | cond = {key: cond} |
| 867 | |
| 868 | x_recon = self.model(x_noisy, t, **cond) |
| 869 | |
| 870 | if isinstance(x_recon, tuple) and not return_ids: |
| 871 | return x_recon[0] |
| 872 | else: |
| 873 | return x_recon |
| 874 | |
| 875 | def _predict_eps_from_xstart(self, x_t, t, pred_xstart): |
| 876 | return (extract_into_tensor(self.sqrt_recip_alphas_cumprod, t, x_t.shape) * x_t - pred_xstart) / \ |
no outgoing calls
no test coverage detected