fix the white result

This commit is contained in:
zhang
2023-12-12 20:41:10 +08:00
parent 4173387fee
commit 47c1794050
2 changed files with 5 additions and 4 deletions
@@ -353,7 +353,7 @@ class AnimationPipeline(DiffusionPipeline):
def prepare_condition(self, condition, num_videos_per_prompt, device, dtype, do_classifier_free_guidance):
# prepare conditions for controlnet
condition = torch.from_numpy(condition.copy()).to(device=device, dtype=dtype) #/ 255.0
condition = torch.from_numpy(condition.copy()).to(device=device, dtype=dtype) / 255.0
condition = torch.stack([condition for _ in range(num_videos_per_prompt)], dim=0)
condition = rearrange(condition, 'b f h w c -> (b f) c h w').clone()
if do_classifier_free_guidance:
@@ -389,7 +389,7 @@ class AnimationPipeline(DiffusionPipeline):
Convert RGB image to VAE latents
"""
device = self._execution_device
images = torch.from_numpy(images).float().to(dtype) # / 127.5 - 1
images = torch.from_numpy(images).float().to(dtype) / 127.5 - 1
images = rearrange(images, "f h w c -> f c h w").to(device)
latents = []
for frame_idx in range(images.shape[0]):
+3 -2
View File
@@ -231,7 +231,8 @@ class MagicAnimate:
image = self.resize_image_frame(image, size)
# print(image.shape)
H, W, C = image.shape
image = image * 255
prompt = ""
n_prompt = ""
control = pose_video.detach().cpu().numpy() # (num_frames, H, W, C)
@@ -246,7 +247,7 @@ class MagicAnimate:
original_length = control.shape[0]
if control.shape[0] % config.L > 0:
control = np.pad(control, ((0, config.L-control.shape[0] % config.L), (0, 0), (0, 0), (0, 0)), mode='edge')
control = control * 255
self.generator.manual_seed(seed)
dist_kwargs = {"rank":0, "world_size":1, "dist":False}