mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-09-03 05:07:07 +08:00
test
This commit is contained in:
parent
a30704e0c0
commit
ee8a636cb7
@ -440,7 +440,7 @@ class WanModel(torch.nn.Module):
|
|||||||
|
|
||||||
# embeddings
|
# embeddings
|
||||||
self.patch_embedding = operations.Conv3d(
|
self.patch_embedding = operations.Conv3d(
|
||||||
in_dim, dim, kernel_size=patch_size, stride=patch_size, device=operation_settings.get("device"), dtype=torch.float32)
|
20, dim, kernel_size=patch_size, stride=patch_size, device=operation_settings.get("device"), dtype=torch.float32)
|
||||||
self.text_embedding = nn.Sequential(
|
self.text_embedding = nn.Sequential(
|
||||||
operations.Linear(text_dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")), nn.GELU(approximate='tanh'),
|
operations.Linear(text_dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")), nn.GELU(approximate='tanh'),
|
||||||
operations.Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")))
|
operations.Linear(dim, dim, device=operation_settings.get("device"), dtype=operation_settings.get("dtype")))
|
||||||
|
|||||||
@ -1064,6 +1064,7 @@ class WAN21(BaseModel):
|
|||||||
def concat_cond(self, **kwargs):
|
def concat_cond(self, **kwargs):
|
||||||
noise = kwargs.get("noise", None)
|
noise = kwargs.get("noise", None)
|
||||||
extra_channels = self.diffusion_model.patch_embedding.weight.shape[1] - noise.shape[1]
|
extra_channels = self.diffusion_model.patch_embedding.weight.shape[1] - noise.shape[1]
|
||||||
|
print(f"extra channels: {extra_channels}, noise shape: {noise.shape}, patch embedding weight shape: {self.diffusion_model.patch_embedding.weight.shape}")
|
||||||
if extra_channels == 0:
|
if extra_channels == 0:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -1080,6 +1081,7 @@ class WAN21(BaseModel):
|
|||||||
image[:, i: i + 16] = self.process_latent_in(image[:, i: i + 16])
|
image[:, i: i + 16] = self.process_latent_in(image[:, i: i + 16])
|
||||||
image = utils.resize_to_batch_size(image, noise.shape[0])
|
image = utils.resize_to_batch_size(image, noise.shape[0])
|
||||||
|
|
||||||
|
print(f"image shape: {image.shape}")
|
||||||
if not self.image_to_video or extra_channels == image.shape[1]:
|
if not self.image_to_video or extra_channels == image.shape[1]:
|
||||||
return image
|
return image
|
||||||
|
|
||||||
@ -1098,8 +1100,10 @@ class WAN21(BaseModel):
|
|||||||
mask = torch.nn.functional.pad(mask, (0, 0, 0, 0, 0, noise.shape[-3] - mask.shape[-3]), mode='constant', value=0)
|
mask = torch.nn.functional.pad(mask, (0, 0, 0, 0, 0, noise.shape[-3] - mask.shape[-3]), mode='constant', value=0)
|
||||||
if mask.shape[1] == 1:
|
if mask.shape[1] == 1:
|
||||||
mask = mask.repeat(1, 4, 1, 1, 1)
|
mask = mask.repeat(1, 4, 1, 1, 1)
|
||||||
mask = utils.resize_to_batch_size(mask, noise.shape[0])
|
|
||||||
|
|
||||||
|
print(f"Mask shape: {mask.shape}, noise shape: {noise.shape}")
|
||||||
|
mask = utils.resize_to_batch_size(mask, noise.shape[0])
|
||||||
|
print(f"image shape: {image.shape}, mask shape: {mask.shape}")
|
||||||
return torch.cat((mask, image), dim=1)
|
return torch.cat((mask, image), dim=1)
|
||||||
|
|
||||||
def extra_conds(self, **kwargs):
|
def extra_conds(self, **kwargs):
|
||||||
|
|||||||
@ -657,7 +657,6 @@ class WanTrackToVideo:
|
|||||||
zero_frames = torch.zeros(3, 81 - 1, height, width)
|
zero_frames = torch.zeros(3, 81 - 1, height, width)
|
||||||
|
|
||||||
start_image = start_image.permute(3,0,1,2) # C, T, H, W
|
start_image = start_image.permute(3,0,1,2) # C, T, H, W
|
||||||
start_image = start_image * 2 - 1
|
|
||||||
res = torch.concat([
|
res = torch.concat([
|
||||||
start_image.to(start_image.device),
|
start_image.to(start_image.device),
|
||||||
zero_frames
|
zero_frames
|
||||||
@ -668,7 +667,7 @@ class WanTrackToVideo:
|
|||||||
res.permute(1,2,3,0)[:, :, :, :3] # T, H, W, C
|
res.permute(1,2,3,0)[:, :, :, :3] # T, H, W, C
|
||||||
)[0]
|
)[0]
|
||||||
y = torch.concat([msk, y])
|
y = torch.concat([msk, y])
|
||||||
|
print('?')
|
||||||
motion_patched = patch_motion(processed_tracks, y, temperature, (4, 16), topk)[None]
|
motion_patched = patch_motion(processed_tracks, y, temperature, (4, 16), topk)[None]
|
||||||
mask, video = motion_patched[:, 0:4], motion_patched[:, 4:]
|
mask, video = motion_patched[:, 0:4], motion_patched[:, 4:]
|
||||||
# Add motion features to conditioning
|
# Add motion features to conditioning
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user