Spaces:
Runtime error
Runtime error
Robin Rombach
commited on
Commit
·
d2152a2
1
Parent(s):
384c3f4
Update ddpm.py
Browse filesclean up no.1
Former-commit-id: 2b46bcb98c8e8fdb250cb8ff2e20874f3ccdd768
ldm/models/diffusion/ddpm.py
CHANGED
|
@@ -461,7 +461,7 @@ class LatentDiffusion(DDPM):
|
|
| 461 |
self.instantiate_cond_stage(cond_stage_config)
|
| 462 |
self.cond_stage_forward = cond_stage_forward
|
| 463 |
self.clip_denoised = False
|
| 464 |
-
self.bbox_tokenizer = None
|
| 465 |
|
| 466 |
self.restarted_from_ckpt = False
|
| 467 |
if ckpt_path is not None:
|
|
@@ -598,7 +598,7 @@ class LatentDiffusion(DDPM):
|
|
| 598 |
weighting = weighting * L_weighting
|
| 599 |
return weighting
|
| 600 |
|
| 601 |
-
def get_fold_unfold(self, x, kernel_size, stride, uf=1, df=1): # todo load once not every time, shorten code
|
| 602 |
"""
|
| 603 |
:param x: img of size (bs, c, h, w)
|
| 604 |
:return: n img crops of size (n, bs, c, kernel_size[0], kernel_size[1])
|
|
@@ -793,7 +793,7 @@ class LatentDiffusion(DDPM):
|
|
| 793 |
z = z.view((z.shape[0], -1, ks[0], ks[1], z.shape[-1])) # (bn, nc, ks[0], ks[1], L )
|
| 794 |
|
| 795 |
# 2. apply model loop over last dim
|
| 796 |
-
if isinstance(self.first_stage_model, VQModelInterface):
|
| 797 |
output_list = [self.first_stage_model.decode(z[:, :, :, :, i],
|
| 798 |
force_not_quantize=predict_cids or force_not_quantize)
|
| 799 |
for i in range(z.shape[-1])]
|
|
@@ -901,7 +901,7 @@ class LatentDiffusion(DDPM):
|
|
| 901 |
|
| 902 |
if hasattr(self, "split_input_params"):
|
| 903 |
assert len(cond) == 1 # todo can only deal with one conditioning atm
|
| 904 |
-
assert not return_ids
|
| 905 |
ks = self.split_input_params["ks"] # eg. (128, 128)
|
| 906 |
stride = self.split_input_params["stride"] # eg. (64, 64)
|
| 907 |
|
|
|
|
| 461 |
self.instantiate_cond_stage(cond_stage_config)
|
| 462 |
self.cond_stage_forward = cond_stage_forward
|
| 463 |
self.clip_denoised = False
|
| 464 |
+
self.bbox_tokenizer = None
|
| 465 |
|
| 466 |
self.restarted_from_ckpt = False
|
| 467 |
if ckpt_path is not None:
|
|
|
|
| 598 |
weighting = weighting * L_weighting
|
| 599 |
return weighting
|
| 600 |
|
| 601 |
+
def get_fold_unfold(self, x, kernel_size, stride, uf=1, df=1): # todo load once not every time, shorten code
|
| 602 |
"""
|
| 603 |
:param x: img of size (bs, c, h, w)
|
| 604 |
:return: n img crops of size (n, bs, c, kernel_size[0], kernel_size[1])
|
|
|
|
| 793 |
z = z.view((z.shape[0], -1, ks[0], ks[1], z.shape[-1])) # (bn, nc, ks[0], ks[1], L )
|
| 794 |
|
| 795 |
# 2. apply model loop over last dim
|
| 796 |
+
if isinstance(self.first_stage_model, VQModelInterface):
|
| 797 |
output_list = [self.first_stage_model.decode(z[:, :, :, :, i],
|
| 798 |
force_not_quantize=predict_cids or force_not_quantize)
|
| 799 |
for i in range(z.shape[-1])]
|
|
|
|
| 901 |
|
| 902 |
if hasattr(self, "split_input_params"):
|
| 903 |
assert len(cond) == 1 # todo can only deal with one conditioning atm
|
| 904 |
+
assert not return_ids
|
| 905 |
ks = self.split_input_params["ks"] # eg. (128, 128)
|
| 906 |
stride = self.split_input_params["stride"] # eg. (64, 64)
|
| 907 |
|