latent batch and size complete rewrite

This commit is contained in:
nullquant
2024-05-04 17:55:29 +03:00
parent 2aee7ea204
commit b35357b69a
2 changed files with 47 additions and 33 deletions
-12
View File
@@ -822,18 +822,6 @@ class BrushNetModel(ModelMixin, ConfigMixin):
# 2. pre-process
if sample.shape[2] != brushnet_cond.shape[2] or sample.shape[3] != brushnet_cond.shape[3]:
print("Image "+ str(brushnet_cond.shape) +" and latent " + str(sample.shape) + " have different size, resizing image")
brushnet_cond = torch.nn.functional.interpolate(
brushnet_cond, size=(
sample.shape[2],
sample.shape[3],
), mode='bicubic',
).to(sample.device).to(sample.dtype)
if sample.shape[0] > 1:
brushnet_cond = torch.cat([brushnet_cond] * sample.shape[0], dim=0).to(sample.device)
brushnet_cond=torch.concat([sample,brushnet_cond],1)
sample = self.conv_in_condition(brushnet_cond)