add HellMeme V2
This commit is contained in:
@@ -9,6 +9,6 @@
|
||||
"""
|
||||
|
||||
from .hm_denoising_motion import HMDenoisingMotion
|
||||
from .hm_control import HMControlNet, HMControlNet2
|
||||
from .hm_control import HMControlNet, HMControlNet2, HMV2ControlNet, HMV2ControlNet2
|
||||
from .hm_blocks import HMReferenceAdapter
|
||||
from .hm_denoising_3d import HMDenoising3D
|
||||
|
||||
@@ -50,28 +50,29 @@ class HMReferenceAdapter(ModelMixin, ConfigMixin):
|
||||
"CrossAttnUpBlock2D",
|
||||
"CrossAttnUpBlock2D"),
|
||||
num_attention_heads: Optional[Union[int, Tuple[int]]] = 8,
|
||||
version='v1'
|
||||
):
|
||||
super().__init__()
|
||||
|
||||
self.reference_modules_down = nn.ModuleList([])
|
||||
|
||||
if isinstance(num_attention_heads, int):
|
||||
num_attention_heads = (num_attention_heads,) * len(down_block_types)
|
||||
|
||||
for i, down_block_type in enumerate(down_block_types):
|
||||
output_channel = block_out_channels[i]
|
||||
if version == 'v1':
|
||||
self.reference_modules_down = nn.ModuleList([])
|
||||
for i, down_block_type in enumerate(down_block_types):
|
||||
output_channel = block_out_channels[i]
|
||||
|
||||
self.reference_modules_down.append(
|
||||
SKReferenceAttention(
|
||||
in_channels=output_channel,
|
||||
num_attention_heads=num_attention_heads[i],
|
||||
self.reference_modules_down.append(
|
||||
SKReferenceAttention(
|
||||
in_channels=output_channel,
|
||||
num_attention_heads=num_attention_heads[i],
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
self.reference_modules_mid = SKReferenceAttention(
|
||||
in_channels=block_out_channels[-1],
|
||||
num_attention_heads=num_attention_heads[-1],
|
||||
)
|
||||
self.reference_modules_mid = SKReferenceAttention(
|
||||
in_channels=block_out_channels[-1],
|
||||
num_attention_heads=num_attention_heads[-1],
|
||||
)
|
||||
|
||||
self.reference_modules_up = nn.ModuleList([])
|
||||
|
||||
@@ -326,7 +327,10 @@ class InsertReferenceAdapter(object):
|
||||
self.reference_modules_up = None
|
||||
|
||||
def insert_reference_adapter(self, adapter: HMReferenceAdapter):
|
||||
self.reference_modules_down = copy.deepcopy(adapter.reference_modules_down)
|
||||
self.reference_modules_mid = copy.deepcopy(adapter.reference_modules_mid)
|
||||
self.reference_modules_up = copy.deepcopy(adapter.reference_modules_up)
|
||||
if hasattr(adapter, "reference_modules_down"):
|
||||
self.reference_modules_down = copy.deepcopy(adapter.reference_modules_down)
|
||||
if hasattr(adapter, "reference_modules_mid"):
|
||||
self.reference_modules_mid = copy.deepcopy(adapter.reference_modules_mid)
|
||||
if hasattr(adapter, "reference_modules_up"):
|
||||
self.reference_modules_up = copy.deepcopy(adapter.reference_modules_up)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class HMControlNet(ModelMixin, ConfigMixin):
|
||||
@register_to_config
|
||||
def __init__(
|
||||
self,
|
||||
embedding_channels: int,
|
||||
embedding_channels: int = 1280,
|
||||
input_channels: int = 3,
|
||||
scale_factor: int = 8,
|
||||
cross_attention_dim: int = 320,
|
||||
@@ -91,7 +91,7 @@ class HMControlNet2(ModelMixin, ConfigMixin):
|
||||
@register_to_config
|
||||
def __init__(
|
||||
self,
|
||||
embedding_channels: int,
|
||||
embedding_channels: int = 1280,
|
||||
input_channels: int = 3,
|
||||
scale_factor: int = 8,
|
||||
cross_attention_dim: int = 320,
|
||||
@@ -143,4 +143,129 @@ class HMControlNet2(ModelMixin, ConfigMixin):
|
||||
ret_dict[f'down2_{idx}'] = rearrange(embedding,
|
||||
"(b f) c h w -> b c f h w",
|
||||
f=video_length)
|
||||
return ret_dict
|
||||
|
||||
class HMV2ControlNet(ModelMixin, ConfigMixin):
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
embedding_channels: int = 1280,
|
||||
input_channels: int = 3,
|
||||
scale_factor: int = 4,
|
||||
cross_attention_dim: int = 320,
|
||||
block_out_channels: Tuple[int] = (128, 640, 1280, 1280, 1280),
|
||||
):
|
||||
super().__init__()
|
||||
self.scale_factor = scale_factor
|
||||
self.embedding_channels = embedding_channels
|
||||
self.cross_attention_dim = cross_attention_dim
|
||||
self.conv_in = nn.Conv2d(input_channels, block_out_channels[0], kernel_size=3, padding=1, bias=False)
|
||||
|
||||
self.exp_embedding = Timesteps(cross_attention_dim, True, 0)
|
||||
self.exp_proj = TimestepEmbedding(cross_attention_dim, cross_attention_dim)
|
||||
self.face_proj = TimestepEmbedding(1024, cross_attention_dim)
|
||||
|
||||
self.blocks_down = nn.ModuleList([])
|
||||
for i in range(1, len(block_out_channels)):
|
||||
channel_in = block_out_channels[i - 1]
|
||||
channel_out = block_out_channels[i]
|
||||
self.blocks_down.append(
|
||||
SKCrossAttention(
|
||||
channel_in=channel_in,
|
||||
channel_out=channel_out,
|
||||
cross_attention_dim=cross_attention_dim,
|
||||
num_positional_embeddings=64,
|
||||
num_positional_embeddings_hidden=1024
|
||||
)
|
||||
)
|
||||
|
||||
def forward(self, condition, drive_coeff, face_parts):
|
||||
bs, _, video_length, h, w = condition.shape
|
||||
|
||||
conditioning = rearrange(condition, "b c f h w -> (b f) c h w")
|
||||
conditioning = F.interpolate(conditioning,
|
||||
size=(h // self.scale_factor, w // self.scale_factor),
|
||||
mode='bilinear',
|
||||
align_corners=False)
|
||||
embedding = self.conv_in(conditioning)
|
||||
|
||||
drive_coeff = rearrange(drive_coeff * 500., "b f c -> (b f c)")
|
||||
drive_embedding = self.exp_embedding(drive_coeff).to(dtype=embedding.dtype)
|
||||
drive_embedding = rearrange(drive_embedding, "(b f c) d -> b f c d",
|
||||
b=bs, f=video_length, d=self.cross_attention_dim)
|
||||
|
||||
face_parts = rearrange(face_parts, "b f c d -> (b f) c d")
|
||||
face_embedding = self.face_proj(face_parts)
|
||||
|
||||
face_embedding = rearrange(face_embedding, "(b f) c d -> b f c d", f=video_length)
|
||||
|
||||
drive_embedding = torch.cat([face_embedding, drive_embedding], dim=2)
|
||||
drive_embedding = rearrange(drive_embedding, "b f c d -> (b f) c d")
|
||||
|
||||
drive_embedding = self.exp_proj(drive_embedding)
|
||||
|
||||
ret_dict = {}
|
||||
for idx, block in enumerate(self.blocks_down):
|
||||
embedding = block(embedding, drive_embedding)
|
||||
ret_dict[f'up_v2_{len(self.blocks_down) - idx - 1}'] = rearrange(embedding,
|
||||
"(b f) c h w -> b c f h w",
|
||||
f=video_length)
|
||||
return ret_dict
|
||||
|
||||
class HMV2ControlNet2(ModelMixin, ConfigMixin):
|
||||
def __init__(
|
||||
self,
|
||||
embedding_channels: int = 1280,
|
||||
input_channels: int = 3,
|
||||
scale_factor: int = 4,
|
||||
cross_attention_dim: int = 320,
|
||||
block_out_channels: Tuple[int] = (128, 640, 1280, 1280, 1280),
|
||||
):
|
||||
super().__init__()
|
||||
self.scale_factor = scale_factor
|
||||
self.embedding_channels = embedding_channels
|
||||
self.cross_attention_dim = cross_attention_dim
|
||||
self.conv_in = nn.Conv2d(input_channels, block_out_channels[0], kernel_size=3, padding=1, bias=False)
|
||||
|
||||
self.exp_embedding = Timesteps(cross_attention_dim, True, 0)
|
||||
self.emo_proj = TimestepEmbedding(cross_attention_dim, cross_attention_dim)
|
||||
# self.face_proj = TimestepEmbedding(1024, cross_attention_dim)
|
||||
|
||||
self.blocks_down = nn.ModuleList([])
|
||||
for i in range(1, len(block_out_channels)):
|
||||
channel_in = block_out_channels[i-1]
|
||||
channel_out = block_out_channels[i]
|
||||
self.blocks_down.append(
|
||||
SKCrossAttention(
|
||||
channel_in=channel_in,
|
||||
channel_out=channel_out,
|
||||
cross_attention_dim=cross_attention_dim,
|
||||
num_positional_embeddings=64,
|
||||
num_positional_embeddings_hidden=1024
|
||||
)
|
||||
)
|
||||
|
||||
def forward(self, condition, emo_embedding):
|
||||
bs, _, video_length, h, w = condition.shape
|
||||
|
||||
conditioning = rearrange(condition, "b c f h w -> (b f) c h w")
|
||||
conditioning = F.interpolate(conditioning,
|
||||
size=(h // self.scale_factor, w // self.scale_factor),
|
||||
mode='bilinear',
|
||||
align_corners=False)
|
||||
embedding = self.conv_in(conditioning)
|
||||
|
||||
drive_coeff = rearrange(emo_embedding * 20., "b f c -> (b f c)")
|
||||
drive_embedding = self.exp_embedding(drive_coeff).to(dtype=embedding.dtype)
|
||||
drive_embedding = rearrange(drive_embedding, "(b f c) d -> b f c d",
|
||||
b=bs, f=video_length, d=self.cross_attention_dim)
|
||||
drive_embedding = rearrange(drive_embedding, "b f c d -> (b f) c d")
|
||||
drive_embedding = self.emo_proj(drive_embedding)
|
||||
|
||||
ret_dict = {}
|
||||
for idx, block in enumerate(self.blocks_down):
|
||||
embedding = block(embedding, drive_embedding)
|
||||
ret_dict[f'up2_v2_{len(self.blocks_down)-idx-1}'] = rearrange(embedding,
|
||||
"(b f) c h w -> b c f h w",
|
||||
f=video_length)
|
||||
return ret_dict
|
||||
@@ -251,6 +251,10 @@ class HMDenoising3D(UNet2DConditionModel, CopyWeights, InsertReferenceAdapter):
|
||||
|
||||
if hasattr(upsample_block, "has_cross_attention") and upsample_block.has_cross_attention:
|
||||
res_cache[f"up_{i}"] = sample.clone()
|
||||
if not control_hidden_states is None and f'up_v2_{i}' in control_hidden_states:
|
||||
sample += rearrange(control_hidden_states[f'up_v2_{i}'], "b c f h w -> (b f) c h w")
|
||||
if not control_hidden_states is None and f'up2_v2_{i}' in control_hidden_states:
|
||||
sample += rearrange(control_hidden_states[f'up2_v2_{i}'], "b c f h w -> (b f) c h w")
|
||||
if hasattr(self, "reference_modules_up") and not reference_hidden_states is None and f'up_{i}' in reference_hidden_states:
|
||||
sample = self.reference_modules_up[i-1](sample, reference_hidden_states[f'up_{i}'], num_frames)
|
||||
|
||||
@@ -265,6 +269,10 @@ class HMDenoising3D(UNet2DConditionModel, CopyWeights, InsertReferenceAdapter):
|
||||
encoder_attention_mask=encoder_attention_mask,
|
||||
)
|
||||
else:
|
||||
if not control_hidden_states is None and f'up_v2_{i}' in control_hidden_states:
|
||||
sample += rearrange(control_hidden_states[f'up_v2_{i}'], "b c f h w -> (b f) c h w")
|
||||
if not control_hidden_states is None and f'up2_v2_{i}' in control_hidden_states:
|
||||
sample += rearrange(control_hidden_states[f'up2_v2_{i}'], "b c f h w -> (b f) c h w")
|
||||
sample = upsample_block(
|
||||
hidden_states=sample,
|
||||
temb=emb,
|
||||
|
||||
@@ -202,6 +202,10 @@ class HMDenoisingMotion(UNetMotionModel, InsertReferenceAdapter):
|
||||
|
||||
if hasattr(upsample_block, "has_cross_attention") and upsample_block.has_cross_attention:
|
||||
if hasattr(upsample_block, "has_cross_attention") and upsample_block.has_cross_attention:
|
||||
if not control_hidden_states is None and f'up_v2_{i}' in control_hidden_states:
|
||||
sample += rearrange(control_hidden_states[f'up_v2_{i}'], "b c f h w -> (b f) c h w")
|
||||
if not control_hidden_states is None and f'up2_v2_{i}' in control_hidden_states:
|
||||
sample += rearrange(control_hidden_states[f'up2_v2_{i}'], "b c f h w -> (b f) c h w")
|
||||
if hasattr(self,
|
||||
"reference_modules_up") and not reference_hidden_states is None and f'up_{i}' in reference_hidden_states:
|
||||
sample = self.reference_modules_up[i - 1](sample, reference_hidden_states[f'up_{i}'],
|
||||
@@ -218,6 +222,10 @@ class HMDenoisingMotion(UNetMotionModel, InsertReferenceAdapter):
|
||||
cross_attention_kwargs=cross_attention_kwargs,
|
||||
)
|
||||
else:
|
||||
if not control_hidden_states is None and f'up_v2_{i}' in control_hidden_states:
|
||||
sample += rearrange(control_hidden_states[f'up_v2_{i}'], "b c f h w -> (b f) c h w")
|
||||
if not control_hidden_states is None and f'up2_v2_{i}' in control_hidden_states:
|
||||
sample += rearrange(control_hidden_states[f'up2_v2_{i}'], "b c f h w -> (b f) c h w")
|
||||
sample = upsample_block(
|
||||
hidden_states=sample,
|
||||
temb=emb,
|
||||
|
||||
@@ -22,42 +22,44 @@ from diffusers.pipelines.stable_diffusion.pipeline_output import StableDiffusion
|
||||
from diffusers import StableDiffusionImg2ImgPipeline
|
||||
from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img import retrieve_timesteps, retrieve_latents
|
||||
|
||||
from ..models import HMDenoising3D, HMControlNet, HMControlNet2
|
||||
from ..models import HMDenoising3D, HMControlNet, HMControlNet2, HMV2ControlNet, HMV2ControlNet2
|
||||
from ..models import HMReferenceAdapter
|
||||
|
||||
class HMImagePipeline(StableDiffusionImg2ImgPipeline):
|
||||
def caryomitosis(self, **kwargs):
|
||||
if not hasattr(self, "unet_ref"):
|
||||
self.unet_ref = HMDenoising3D.from_unet2d(self.unet)
|
||||
self.unet_ref.cpu()
|
||||
if not isinstance(self.unet, HMDenoising3D):
|
||||
unet = HMDenoising3D.from_unet2d(unet=self.unet)
|
||||
# todo: 不够优雅
|
||||
del self.unet
|
||||
self.unet = unet
|
||||
self.unet.cpu()
|
||||
self.vae_decode = copy.deepcopy(self.vae)
|
||||
|
||||
def insert_hm_modules(self, dtype):
|
||||
def insert_hm_modules(self, version, dtype):
|
||||
if isinstance(self.unet, HMDenoising3D):
|
||||
hm_adapter = HMReferenceAdapter.from_pretrained('songkey/hm_reference')
|
||||
if version == 'v1':
|
||||
hm_adapter = HMReferenceAdapter.from_pretrained('songkey/hm_reference')
|
||||
else:
|
||||
hm_adapter = HMReferenceAdapter.from_pretrained('songkey/hm2_reference')
|
||||
self.unet.insert_reference_adapter(hm_adapter)
|
||||
self.unet_ref.insert_reference_adapter(hm_adapter)
|
||||
self.unet_ref.to(device='cpu', dtype=dtype).eval()
|
||||
self.unet.to(device='cpu', dtype=dtype).eval()
|
||||
|
||||
if hasattr(self, "mp_control"):
|
||||
del self.mp_control
|
||||
self.mp_control = HMControlNet.from_pretrained('songkey/hm_control')
|
||||
if version == 'v1':
|
||||
self.mp_control = HMControlNet.from_pretrained('songkey/hm_control')
|
||||
else:
|
||||
self.mp_control = HMV2ControlNet.from_pretrained('songkey/hm2_control')
|
||||
self.mp_control.to(device='cpu', dtype=dtype).eval()
|
||||
|
||||
if hasattr(self, "mp_control2"):
|
||||
del self.mp_control2
|
||||
self.mp_control2 = HMControlNet2.from_pretrained('songkey/hm_control2')
|
||||
if version == 'v1':
|
||||
self.mp_control2 = HMControlNet2.from_pretrained('songkey/hm_control2')
|
||||
else:
|
||||
self.mp_control2 = HMV2ControlNet2.from_pretrained('songkey/hm2_control2')
|
||||
self.mp_control2.to(device='cpu', dtype=dtype).eval()
|
||||
|
||||
self.vae.to(device='cpu', dtype=dtype).eval()
|
||||
self.vae_decode.to(device='cpu', dtype=dtype).eval()
|
||||
self.text_encoder.to(device='cpu', dtype=dtype).eval()
|
||||
|
||||
@torch.no_grad()
|
||||
@@ -230,15 +232,13 @@ class HMImagePipeline(StableDiffusionImg2ImgPipeline):
|
||||
)
|
||||
|
||||
latent_model_input = torch.cat([torch.zeros_like(ref_latents), ref_latents]) if self.do_classifier_free_guidance else ref_latents
|
||||
self.unet_ref.to(device=device)
|
||||
cached_res = self.unet_ref(
|
||||
self.unet.to(device=device)
|
||||
cached_res = self.unet(
|
||||
latent_model_input.unsqueeze(2),
|
||||
0,
|
||||
encoder_hidden_states=prompt_embeds,
|
||||
# control_hidden_states=control_latents,
|
||||
return_dict=False,
|
||||
)[1]
|
||||
self.unet_ref.cpu()
|
||||
|
||||
# 7.2 Optionally get Guidance Scale Embedding
|
||||
timestep_cond = None
|
||||
@@ -304,14 +304,14 @@ class HMImagePipeline(StableDiffusionImg2ImgPipeline):
|
||||
|
||||
self.unet.cpu()
|
||||
|
||||
self.vae_decode.to(device=device)
|
||||
self.vae.to(device=device)
|
||||
if not output_type == "latent":
|
||||
image = self.vae_decode.decode(latents / self.vae.config.scaling_factor, return_dict=False, generator=generator)[
|
||||
image = self.vae.decode(latents / self.vae.config.scaling_factor, return_dict=False, generator=generator)[
|
||||
0
|
||||
]
|
||||
else:
|
||||
image = latents
|
||||
self.vae_decode.cpu()
|
||||
self.vae.cpu()
|
||||
|
||||
do_denormalize = [True] * image.shape[0]
|
||||
|
||||
|
||||
@@ -21,54 +21,58 @@ from diffusers.utils.torch_utils import randn_tensor
|
||||
from diffusers.pipelines.stable_diffusion.pipeline_stable_diffusion_img2img import retrieve_timesteps, retrieve_latents
|
||||
from diffusers import StableDiffusionImg2ImgPipeline, MotionAdapter, EulerDiscreteScheduler
|
||||
|
||||
from ..models import HMDenoising3D, HMDenoisingMotion, HMControlNet, HMControlNet2
|
||||
from ..models import HMDenoising3D, HMDenoisingMotion, HMControlNet, HMControlNet2, HMV2ControlNet, HMV2ControlNet2
|
||||
from ..models import HMReferenceAdapter
|
||||
from ..utils import dicts_to_device, cat_dicts, cat_dicts_ref
|
||||
|
||||
class HMVideoPipeline(StableDiffusionImg2ImgPipeline):
|
||||
def caryomitosis(self, patch_frames=12, **kwargs):
|
||||
def caryomitosis(self, version, **kwargs):
|
||||
if hasattr(self, "unet_ref"):
|
||||
del self.unet_ref
|
||||
self.unet_ref = HMDenoising3D.from_unet2d(self.unet)
|
||||
self.unet_ref.cpu()
|
||||
self.unet_pre = HMDenoising3D.from_unet2d(self.unet)
|
||||
self.unet_pre.cpu()
|
||||
|
||||
self.num_frames = 12
|
||||
adapter = MotionAdapter.from_pretrained("songkey/hm_animatediff_frame12", torch_dtype=torch.float16)
|
||||
if version == 'v1':
|
||||
adapter = MotionAdapter.from_pretrained("songkey/hm_animatediff_frame12", torch_dtype=torch.float16)
|
||||
else:
|
||||
adapter = MotionAdapter.from_pretrained("songkey/hm2_animatediff_frame12", torch_dtype=torch.float16)
|
||||
unet = HMDenoisingMotion.from_unet2d(unet=self.unet, motion_adapter=adapter, load_weights=True)
|
||||
# todo: 不够优雅
|
||||
del self.unet
|
||||
self.unet = unet
|
||||
|
||||
self.vae_decode = copy.deepcopy(self.vae)
|
||||
|
||||
def insert_hm_modules(self, dtype):
|
||||
hm_adapter = HMReferenceAdapter.from_pretrained('songkey/hm_reference')
|
||||
def insert_hm_modules(self, version, dtype):
|
||||
if version == 'v1':
|
||||
hm_adapter = HMReferenceAdapter.from_pretrained('songkey/hm_reference')
|
||||
else:
|
||||
hm_adapter = HMReferenceAdapter.from_pretrained('songkey/hm2_reference')
|
||||
if isinstance(self.unet, HMDenoisingMotion):
|
||||
self.unet.insert_reference_adapter(hm_adapter)
|
||||
self.unet.to(device='cpu', dtype=dtype).eval()
|
||||
|
||||
if hasattr(self, "unet_ref"):
|
||||
self.unet_ref.insert_reference_adapter(hm_adapter)
|
||||
self.unet_ref.to(device='cpu', dtype=dtype).eval()
|
||||
|
||||
if hasattr(self, "unet_pre"):
|
||||
self.unet_pre.insert_reference_adapter(hm_adapter)
|
||||
self.unet_pre.to(device='cpu', dtype=dtype).eval()
|
||||
|
||||
if hasattr(self, "mp_control"):
|
||||
del self.mp_control
|
||||
self.mp_control = HMControlNet.from_pretrained('songkey/hm_control')
|
||||
if version == 'v1':
|
||||
self.mp_control = HMControlNet.from_pretrained('songkey/hm_control')
|
||||
else:
|
||||
self.mp_control = HMV2ControlNet.from_pretrained('songkey/hm2_control')
|
||||
|
||||
self.mp_control.to(device='cpu', dtype=dtype).eval()
|
||||
|
||||
if hasattr(self, "mp_control2"):
|
||||
del self.mp_control2
|
||||
self.mp_control2 = HMControlNet2.from_pretrained('songkey/hm_control2')
|
||||
if version == 'v1':
|
||||
self.mp_control2 = HMControlNet2.from_pretrained('songkey/hm_control2')
|
||||
else:
|
||||
self.mp_control2 = HMV2ControlNet2.from_pretrained('songkey/hm2_control2')
|
||||
self.mp_control2.to(device='cpu', dtype=dtype).eval()
|
||||
|
||||
self.vae.to(device='cpu', dtype=dtype).eval()
|
||||
self.vae_decode.to(device='cpu', dtype=dtype).eval()
|
||||
self.text_encoder.to(device='cpu', dtype=dtype).eval()
|
||||
|
||||
@torch.no_grad()
|
||||
@@ -218,15 +222,14 @@ class HMVideoPipeline(StableDiffusionImg2ImgPipeline):
|
||||
guidance_scale_tensor, embedding_dim=self.unet.config.time_cond_proj_dim
|
||||
).to(device=device, dtype=prompt_embeds.dtype)
|
||||
|
||||
self.unet_ref.to(device=device)
|
||||
cached_res = self.unet_ref(
|
||||
self.unet_pre.to(device=device)
|
||||
cached_res = self.unet_pre(
|
||||
torch.cat([torch.zeros_like(ref_latents), ref_latents], dim=0) if
|
||||
self.do_classifier_free_guidance else ref_latents,
|
||||
0,
|
||||
encoder_hidden_states=prompt_embeds,
|
||||
return_dict=False,
|
||||
)[1]
|
||||
self.unet_ref.cpu()
|
||||
|
||||
pre_latents = []
|
||||
control_latents = []
|
||||
@@ -234,7 +237,6 @@ class HMVideoPipeline(StableDiffusionImg2ImgPipeline):
|
||||
base_noise = randn_tensor([batch_size, c, 1, h, w], dtype=prompt_embeds.dtype, generator=generator).to(device=device)
|
||||
self.mp_control.to(device=device)
|
||||
self.mp_control2.to(device=device)
|
||||
self.unet_pre.to(device=device)
|
||||
with self.progress_bar(total=raw_video_len) as progress_bar:
|
||||
for idx in range(raw_video_len):
|
||||
condition = drive_params['condition'][:, :, idx:idx+1].clone().to(device=device)
|
||||
@@ -313,7 +315,6 @@ class HMVideoPipeline(StableDiffusionImg2ImgPipeline):
|
||||
self.mp_control.cpu()
|
||||
self.mp_control2.cpu()
|
||||
self.unet_pre.cpu()
|
||||
self.unet_ref.cpu()
|
||||
|
||||
chunk_size = self.num_frames
|
||||
chunk_overlap = min(max(0, chunk_overlap), chunk_size // 2 - 1)
|
||||
@@ -421,15 +422,15 @@ class HMVideoPipeline(StableDiffusionImg2ImgPipeline):
|
||||
self.unet.cpu()
|
||||
latents_res = latents / self.vae.config.scaling_factor
|
||||
|
||||
self.vae_decode.to(device=device)
|
||||
self.vae.to(device=device)
|
||||
res_frames = []
|
||||
with self.progress_bar(total=raw_video_len) as progress_bar:
|
||||
for i in range(raw_video_len):
|
||||
ret_tensor = self.vae_decode.decode(latents_res[:, :, i, :, :].to(device=device),
|
||||
ret_tensor = self.vae.decode(latents_res[:, :, i, :, :].to(device=device),
|
||||
return_dict=False, generator=generator)[0]
|
||||
ret_image = self.image_processor.postprocess(ret_tensor, output_type=output_type)
|
||||
res_frames.append(ret_image)
|
||||
progress_bar.set_description(f"VAE DECODE")
|
||||
progress_bar.update()
|
||||
self.vae_decode.cpu()
|
||||
self.vae.cpu()
|
||||
return res_frames, latents_res
|
||||
|
||||
@@ -72,7 +72,9 @@ def append_pipline_weights(pipeline, checkpoint=None, lora=None, vae=None):
|
||||
raw_stats = torch.load(checkpoint_path)
|
||||
|
||||
if raw_stats:
|
||||
state_dict = convert_ldm_unet_checkpoint(raw_stats, pipeline.unet_ref.config)
|
||||
state_dict = convert_ldm_unet_checkpoint(raw_stats,
|
||||
pipeline.unet_pre.config if hasattr(pipeline, 'unet_pre')
|
||||
else pipeline.unet.config)
|
||||
if hasattr(pipeline, 'unet_pre'):
|
||||
pipeline.unet_pre.load_state_dict(state_dict, strict=False)
|
||||
pipeline.unet.load_state_dict(state_dict, strict=False)
|
||||
@@ -92,9 +94,8 @@ def append_pipline_weights(pipeline, checkpoint=None, lora=None, vae=None):
|
||||
raw_vae_stats = torch.load(real_vae_path)
|
||||
|
||||
if raw_vae_stats:
|
||||
vae_state_dict = convert_ldm_vae_checkpoint(raw_vae_stats, pipeline.vae_decode.config)
|
||||
if hasattr(pipeline, 'vae_decode'):
|
||||
pipeline.vae_decode.load_state_dict(vae_state_dict, strict=True)
|
||||
vae_state_dict = convert_ldm_vae_checkpoint(raw_vae_stats, pipeline.vae.config)
|
||||
pipeline.vae.load_state_dict(vae_state_dict, strict=True)
|
||||
|
||||
### lora
|
||||
if lora and not lora.startswith('None'):
|
||||
@@ -113,21 +114,22 @@ class HMImagePipelineLoader:
|
||||
"checkpoint": (checkpoint_files, ),
|
||||
"lora": (lora_files, ),
|
||||
"vae": (vae_files, ),
|
||||
"version": (['v1', 'v2'], ),
|
||||
}
|
||||
}
|
||||
RETURN_TYPES = ("HMIMAGEPIPELINE", )
|
||||
RETURN_NAMES = ("hm_image_pipeline", )
|
||||
FUNCTION = "load_pipeline"
|
||||
CATEGORY = "hellomeme"
|
||||
def load_pipeline(self, checkpoint=None, lora=None, vae=None):
|
||||
def load_pipeline(self, checkpoint=None, lora=None, vae=None, version='v2'):
|
||||
dtype = torch.float16
|
||||
pipeline = HMImagePipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5")
|
||||
pipeline.to(dtype=dtype)
|
||||
pipeline.caryomitosis()
|
||||
pipeline.caryomitosis(version=version)
|
||||
|
||||
append_pipline_weights(pipeline, checkpoint=checkpoint, lora=lora, vae=vae)
|
||||
|
||||
pipeline.insert_hm_modules(dtype=dtype)
|
||||
pipeline.insert_hm_modules(version=version, dtype=dtype)
|
||||
|
||||
return (pipeline, )
|
||||
|
||||
@@ -142,7 +144,7 @@ class HMVideoPipelineLoader:
|
||||
"checkpoint": (checkpoint_files, ),
|
||||
"lora": (lora_files, ),
|
||||
"vae": (vae_files, ),
|
||||
"patch_frames": ([12], ),
|
||||
"version": (['v1', 'v2'], ),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,15 +153,15 @@ class HMVideoPipelineLoader:
|
||||
FUNCTION = "load_pipeline"
|
||||
CATEGORY = "hellomeme"
|
||||
|
||||
def load_pipeline(self, checkpoint=None, lora=None, vae=None, patch_frames=12):
|
||||
def load_pipeline(self, checkpoint=None, lora=None, vae=None, version='v2'):
|
||||
dtype = torch.float16
|
||||
pipeline = HMVideoPipeline.from_pretrained("stable-diffusion-v1-5/stable-diffusion-v1-5")
|
||||
pipeline.to(dtype=dtype)
|
||||
pipeline.caryomitosis(patch_frames=patch_frames)
|
||||
pipeline.caryomitosis(version=version)
|
||||
|
||||
append_pipline_weights(pipeline, checkpoint=checkpoint, lora=lora, vae=vae)
|
||||
|
||||
pipeline.insert_hm_modules(dtype=dtype)
|
||||
pipeline.insert_hm_modules(version=version, dtype=dtype)
|
||||
|
||||
return (pipeline,)
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,569 +1 @@
|
||||
{
|
||||
"last_node_id": 64,
|
||||
"last_link_id": 133,
|
||||
"nodes": [
|
||||
{
|
||||
"id": 39,
|
||||
"type": "CropPortrait",
|
||||
"pos": {
|
||||
"0": 516,
|
||||
"1": 537
|
||||
},
|
||||
"size": {
|
||||
"0": 241.79998779296875,
|
||||
"1": 46
|
||||
},
|
||||
"flags": {},
|
||||
"order": 4,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "image",
|
||||
"type": "IMAGE",
|
||||
"link": 128
|
||||
},
|
||||
{
|
||||
"name": "face_toolkits",
|
||||
"type": "FACE_TOOLKITS",
|
||||
"link": 57
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
118
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CropPortrait"
|
||||
},
|
||||
"widgets_values": []
|
||||
},
|
||||
{
|
||||
"id": 44,
|
||||
"type": "GetDrivePose",
|
||||
"pos": {
|
||||
"0": 852,
|
||||
"1": 661
|
||||
},
|
||||
"size": {
|
||||
"0": 304.79998779296875,
|
||||
"1": 66
|
||||
},
|
||||
"flags": {},
|
||||
"order": 6,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "face_toolkits",
|
||||
"type": "FACE_TOOLKITS",
|
||||
"link": 65
|
||||
},
|
||||
{
|
||||
"name": "images",
|
||||
"type": "IMAGE",
|
||||
"link": 116
|
||||
},
|
||||
{
|
||||
"name": "landmarks",
|
||||
"type": "FACELANDMARKS222",
|
||||
"link": 64
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "drive_pose",
|
||||
"type": "DRIVE_POSE",
|
||||
"links": [
|
||||
120
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "GetDrivePose"
|
||||
},
|
||||
"widgets_values": []
|
||||
},
|
||||
{
|
||||
"id": 58,
|
||||
"type": "HMPipelineImage",
|
||||
"pos": {
|
||||
"0": 1274,
|
||||
"1": 584
|
||||
},
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 302
|
||||
},
|
||||
"flags": {},
|
||||
"order": 8,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "hm_image_pipeline",
|
||||
"type": "HMIMAGEPIPELINE",
|
||||
"link": 129
|
||||
},
|
||||
{
|
||||
"name": "face_toolkits",
|
||||
"type": "FACE_TOOLKITS",
|
||||
"link": 119
|
||||
},
|
||||
{
|
||||
"name": "ref_image",
|
||||
"type": "IMAGE",
|
||||
"link": 118
|
||||
},
|
||||
{
|
||||
"name": "drive_pose",
|
||||
"type": "DRIVE_POSE",
|
||||
"link": 120
|
||||
},
|
||||
{
|
||||
"name": "drive_exp",
|
||||
"type": "DRIVE_EXPRESSION",
|
||||
"link": null,
|
||||
"shape": 7
|
||||
},
|
||||
{
|
||||
"name": "drive_exp2",
|
||||
"type": "DRIVE_EXPRESSION2",
|
||||
"link": 133,
|
||||
"shape": 7
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
122
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "HMPipelineImage"
|
||||
},
|
||||
"widgets_values": [
|
||||
0,
|
||||
"(best quality), highly detailed, ultra-detailed, headshot, person, well-placed five sense organs, looking at the viewer, centered composition, sharp focus, realistic skin texture",
|
||||
"",
|
||||
25,
|
||||
38454,
|
||||
"randomize",
|
||||
2
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 59,
|
||||
"type": "PreviewImage",
|
||||
"pos": {
|
||||
"0": 1688,
|
||||
"1": 584
|
||||
},
|
||||
"size": {
|
||||
"0": 210,
|
||||
"1": 246
|
||||
},
|
||||
"flags": {},
|
||||
"order": 9,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "images",
|
||||
"type": "IMAGE",
|
||||
"link": 122
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"properties": {
|
||||
"Node name for S&R": "PreviewImage"
|
||||
},
|
||||
"widgets_values": []
|
||||
},
|
||||
{
|
||||
"id": 62,
|
||||
"type": "LoadImage",
|
||||
"pos": {
|
||||
"0": 52,
|
||||
"1": 289
|
||||
},
|
||||
"size": [
|
||||
315,
|
||||
314
|
||||
],
|
||||
"flags": {},
|
||||
"order": 0,
|
||||
"mode": 0,
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
128
|
||||
],
|
||||
"slot_index": 0
|
||||
},
|
||||
{
|
||||
"name": "MASK",
|
||||
"type": "MASK",
|
||||
"links": null
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "LoadImage"
|
||||
},
|
||||
"widgets_values": [
|
||||
"majicmix2.jpg",
|
||||
"image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 63,
|
||||
"type": "HMImagePipelineLoader",
|
||||
"pos": {
|
||||
"0": 817,
|
||||
"1": 358
|
||||
},
|
||||
"size": {
|
||||
"0": 352.79998779296875,
|
||||
"1": 130
|
||||
},
|
||||
"flags": {},
|
||||
"order": 1,
|
||||
"mode": 0,
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "hm_image_pipeline",
|
||||
"type": "HMIMAGEPIPELINE",
|
||||
"links": [
|
||||
129
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "HMImagePipelineLoader"
|
||||
},
|
||||
"widgets_values": [
|
||||
"SD1.5",
|
||||
"None",
|
||||
"same as checkpoint",
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 43,
|
||||
"type": "GetFaceLandmarks",
|
||||
"pos": {
|
||||
"0": 465,
|
||||
"1": 771
|
||||
},
|
||||
"size": {
|
||||
"0": 292.20001220703125,
|
||||
"1": 46
|
||||
},
|
||||
"flags": {},
|
||||
"order": 5,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "face_toolkits",
|
||||
"type": "FACE_TOOLKITS",
|
||||
"link": 62
|
||||
},
|
||||
{
|
||||
"name": "images",
|
||||
"type": "IMAGE",
|
||||
"link": 115
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "landmarks",
|
||||
"type": "FACELANDMARKS222",
|
||||
"links": [
|
||||
64,
|
||||
130
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "GetFaceLandmarks"
|
||||
},
|
||||
"widgets_values": []
|
||||
},
|
||||
{
|
||||
"id": 57,
|
||||
"type": "LoadImage",
|
||||
"pos": {
|
||||
"0": 45,
|
||||
"1": 867
|
||||
},
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 314
|
||||
},
|
||||
"flags": {},
|
||||
"order": 2,
|
||||
"mode": 0,
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
115,
|
||||
116,
|
||||
131
|
||||
],
|
||||
"slot_index": 0
|
||||
},
|
||||
{
|
||||
"name": "MASK",
|
||||
"type": "MASK",
|
||||
"links": null
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "LoadImage"
|
||||
},
|
||||
"widgets_values": [
|
||||
"yao.jpg",
|
||||
"image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": "HMFaceToolkitsLoader",
|
||||
"pos": {
|
||||
"0": 43,
|
||||
"1": 699
|
||||
},
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 58
|
||||
},
|
||||
"flags": {},
|
||||
"order": 3,
|
||||
"mode": 0,
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "face_toolkits",
|
||||
"type": "FACE_TOOLKITS",
|
||||
"links": [
|
||||
57,
|
||||
62,
|
||||
65,
|
||||
119,
|
||||
132
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "HMFaceToolkitsLoader"
|
||||
},
|
||||
"widgets_values": [
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 64,
|
||||
"type": "GetDriveExpression2",
|
||||
"pos": {
|
||||
"0": 850,
|
||||
"1": 827
|
||||
},
|
||||
"size": {
|
||||
"0": 304.79998779296875,
|
||||
"1": 66
|
||||
},
|
||||
"flags": {},
|
||||
"order": 7,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "face_toolkits",
|
||||
"type": "FACE_TOOLKITS",
|
||||
"link": 132
|
||||
},
|
||||
{
|
||||
"name": "images",
|
||||
"type": "IMAGE",
|
||||
"link": 131
|
||||
},
|
||||
{
|
||||
"name": "landmarks",
|
||||
"type": "FACELANDMARKS222",
|
||||
"link": 130
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "drive_exp2",
|
||||
"type": "DRIVE_EXPRESSION2",
|
||||
"links": [
|
||||
133
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "GetDriveExpression2"
|
||||
}
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
[
|
||||
57,
|
||||
2,
|
||||
0,
|
||||
39,
|
||||
1,
|
||||
"FACE_TOOLKITS"
|
||||
],
|
||||
[
|
||||
62,
|
||||
2,
|
||||
0,
|
||||
43,
|
||||
0,
|
||||
"FACE_TOOLKITS"
|
||||
],
|
||||
[
|
||||
64,
|
||||
43,
|
||||
0,
|
||||
44,
|
||||
2,
|
||||
"FACELANDMARKS222"
|
||||
],
|
||||
[
|
||||
65,
|
||||
2,
|
||||
0,
|
||||
44,
|
||||
0,
|
||||
"FACE_TOOLKITS"
|
||||
],
|
||||
[
|
||||
115,
|
||||
57,
|
||||
0,
|
||||
43,
|
||||
1,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
116,
|
||||
57,
|
||||
0,
|
||||
44,
|
||||
1,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
118,
|
||||
39,
|
||||
0,
|
||||
58,
|
||||
2,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
119,
|
||||
2,
|
||||
0,
|
||||
58,
|
||||
1,
|
||||
"FACE_TOOLKITS"
|
||||
],
|
||||
[
|
||||
120,
|
||||
44,
|
||||
0,
|
||||
58,
|
||||
3,
|
||||
"DRIVE_POSE"
|
||||
],
|
||||
[
|
||||
122,
|
||||
58,
|
||||
0,
|
||||
59,
|
||||
0,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
128,
|
||||
62,
|
||||
0,
|
||||
39,
|
||||
0,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
129,
|
||||
63,
|
||||
0,
|
||||
58,
|
||||
0,
|
||||
"HMIMAGEPIPELINE"
|
||||
],
|
||||
[
|
||||
130,
|
||||
43,
|
||||
0,
|
||||
64,
|
||||
2,
|
||||
"FACELANDMARKS222"
|
||||
],
|
||||
[
|
||||
131,
|
||||
57,
|
||||
0,
|
||||
64,
|
||||
1,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
132,
|
||||
2,
|
||||
0,
|
||||
64,
|
||||
0,
|
||||
"FACE_TOOLKITS"
|
||||
],
|
||||
[
|
||||
133,
|
||||
64,
|
||||
0,
|
||||
58,
|
||||
5,
|
||||
"DRIVE_EXPRESSION2"
|
||||
]
|
||||
],
|
||||
"groups": [],
|
||||
"config": {},
|
||||
"extra": {
|
||||
"ds": {
|
||||
"scale": 0.8264462809917359,
|
||||
"offset": [
|
||||
161.88372916607042,
|
||||
-64.01845981558924
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 0.4
|
||||
}
|
||||
{"last_node_id":64,"last_link_id":133,"nodes":[{"id":2,"type":"HMFaceToolkitsLoader","pos":[43,699],"size":[315,58],"flags":{},"order":3,"mode":0,"inputs":[],"outputs":[{"name":"face_toolkits","type":"FACE_TOOLKITS","links":[57,62,65,119,132],"slot_index":0}],"properties":{"Node name for S&R":"HMFaceToolkitsLoader"},"widgets_values":[0]},{"id":39,"type":"CropPortrait","pos":[516,537],"size":[241.79998779296875,46],"flags":{},"order":4,"mode":0,"inputs":[{"name":"image","type":"IMAGE","link":128},{"name":"face_toolkits","type":"FACE_TOOLKITS","link":57}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[118],"slot_index":0}],"properties":{"Node name for S&R":"CropPortrait"},"widgets_values":[]},{"id":43,"type":"GetFaceLandmarks","pos":[465,771],"size":[292.20001220703125,46],"flags":{},"order":5,"mode":0,"inputs":[{"name":"face_toolkits","type":"FACE_TOOLKITS","link":62},{"name":"images","type":"IMAGE","link":115}],"outputs":[{"name":"landmarks","type":"FACELANDMARKS222","links":[64,130],"slot_index":0}],"properties":{"Node name for S&R":"GetFaceLandmarks"},"widgets_values":[]},{"id":44,"type":"GetDrivePose","pos":[852,661],"size":[304.79998779296875,66],"flags":{},"order":6,"mode":0,"inputs":[{"name":"face_toolkits","type":"FACE_TOOLKITS","link":65},{"name":"images","type":"IMAGE","link":116},{"name":"landmarks","type":"FACELANDMARKS222","link":64}],"outputs":[{"name":"drive_pose","type":"DRIVE_POSE","links":[120],"slot_index":0}],"properties":{"Node name for S&R":"GetDrivePose"},"widgets_values":[]},{"id":57,"type":"LoadImage","pos":[45,867],"size":[315,314],"flags":{},"order":2,"mode":0,"inputs":[],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[115,116,131],"slot_index":0},{"name":"MASK","type":"MASK","links":null}],"properties":{"Node name for S&R":"LoadImage"},"widgets_values":["yao.jpg","image"]},{"id":58,"type":"HMPipelineImage","pos":[1274,584],"size":[315,326],"flags":{},"order":8,"mode":0,"inputs":[{"name":"hm_image_pipeline","type":"HMIMAGEPIPELINE","link":129},{"name":"face_toolkits","type":"FACE_TOOLKITS","link":119},{"name":"ref_image","type":"IMAGE","link":118},{"name":"drive_pose","type":"DRIVE_POSE","link":120},{"name":"drive_exp","type":"DRIVE_EXPRESSION","link":null,"shape":7},{"name":"drive_exp2","type":"DRIVE_EXPRESSION2","link":133,"shape":7}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[122],"slot_index":0},{"name":"LATENT","type":"LATENT","links":null}],"properties":{"Node name for S&R":"HMPipelineImage"},"widgets_values":[0,"(best quality), highly detailed, ultra-detailed, headshot, person, well-placed five sense organs, looking at the viewer, centered composition, sharp focus, realistic skin texture","",25,38454,"randomize",2,0]},{"id":59,"type":"PreviewImage","pos":[1688,584],"size":[210,246],"flags":{},"order":9,"mode":0,"inputs":[{"name":"images","type":"IMAGE","link":122}],"outputs":[],"properties":{"Node name for S&R":"PreviewImage"},"widgets_values":[]},{"id":62,"type":"LoadImage","pos":[52,289],"size":[315,314],"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[128],"slot_index":0},{"name":"MASK","type":"MASK","links":null}],"properties":{"Node name for S&R":"LoadImage"},"widgets_values":["majicmix2.jpg","image"]},{"id":63,"type":"HMImagePipelineLoader","pos":[817,358],"size":[352.79998779296875,130],"flags":{},"order":1,"mode":0,"inputs":[],"outputs":[{"name":"hm_image_pipeline","type":"HMIMAGEPIPELINE","links":[129],"slot_index":0}],"properties":{"Node name for S&R":"HMImagePipelineLoader"},"widgets_values":["SD1.5","None","same as checkpoint","v2"]},{"id":64,"type":"GetDriveExpression2","pos":[850,827],"size":[304.79998779296875,66],"flags":{},"order":7,"mode":0,"inputs":[{"name":"face_toolkits","type":"FACE_TOOLKITS","link":132},{"name":"images","type":"IMAGE","link":131},{"name":"landmarks","type":"FACELANDMARKS222","link":130}],"outputs":[{"name":"drive_exp2","type":"DRIVE_EXPRESSION2","links":[133],"slot_index":0}],"properties":{"Node name for S&R":"GetDriveExpression2"},"widgets_values":[]}],"links":[[57,2,0,39,1,"FACE_TOOLKITS"],[62,2,0,43,0,"FACE_TOOLKITS"],[64,43,0,44,2,"FACELANDMARKS222"],[65,2,0,44,0,"FACE_TOOLKITS"],[115,57,0,43,1,"IMAGE"],[116,57,0,44,1,"IMAGE"],[118,39,0,58,2,"IMAGE"],[119,2,0,58,1,"FACE_TOOLKITS"],[120,44,0,58,3,"DRIVE_POSE"],[122,58,0,59,0,"IMAGE"],[128,62,0,39,0,"IMAGE"],[129,63,0,58,0,"HMIMAGEPIPELINE"],[130,43,0,64,2,"FACELANDMARKS222"],[131,57,0,64,1,"IMAGE"],[132,2,0,64,0,"FACE_TOOLKITS"],[133,64,0,58,5,"DRIVE_EXPRESSION2"]],"groups":[],"config":{},"extra":{"ds":{"scale":0.8264462809917354,"offset":[724.7202975099638,-227.63688958802453]}},"version":0.4}
|
||||
@@ -1,570 +1 @@
|
||||
{
|
||||
"last_node_id": 63,
|
||||
"last_link_id": 129,
|
||||
"nodes": [
|
||||
{
|
||||
"id": 39,
|
||||
"type": "CropPortrait",
|
||||
"pos": {
|
||||
"0": 516,
|
||||
"1": 537
|
||||
},
|
||||
"size": {
|
||||
"0": 241.79998779296875,
|
||||
"1": 46
|
||||
},
|
||||
"flags": {},
|
||||
"order": 5,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "image",
|
||||
"type": "IMAGE",
|
||||
"link": 128
|
||||
},
|
||||
{
|
||||
"name": "face_toolkits",
|
||||
"type": "FACE_TOOLKITS",
|
||||
"link": 57
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
118
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "CropPortrait"
|
||||
},
|
||||
"widgets_values": []
|
||||
},
|
||||
{
|
||||
"id": 44,
|
||||
"type": "GetDrivePose",
|
||||
"pos": {
|
||||
"0": 852,
|
||||
"1": 661
|
||||
},
|
||||
"size": {
|
||||
"0": 304.79998779296875,
|
||||
"1": 66
|
||||
},
|
||||
"flags": {},
|
||||
"order": 6,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "face_toolkits",
|
||||
"type": "FACE_TOOLKITS",
|
||||
"link": 65
|
||||
},
|
||||
{
|
||||
"name": "images",
|
||||
"type": "IMAGE",
|
||||
"link": 116
|
||||
},
|
||||
{
|
||||
"name": "landmarks",
|
||||
"type": "FACELANDMARKS222",
|
||||
"link": 64
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "drive_pose",
|
||||
"type": "DRIVE_POSE",
|
||||
"links": [
|
||||
120
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "GetDrivePose"
|
||||
},
|
||||
"widgets_values": []
|
||||
},
|
||||
{
|
||||
"id": 58,
|
||||
"type": "HMPipelineImage",
|
||||
"pos": {
|
||||
"0": 1274,
|
||||
"1": 584
|
||||
},
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 302
|
||||
},
|
||||
"flags": {},
|
||||
"order": 8,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "hm_image_pipeline",
|
||||
"type": "HMIMAGEPIPELINE",
|
||||
"link": 129
|
||||
},
|
||||
{
|
||||
"name": "face_toolkits",
|
||||
"type": "FACE_TOOLKITS",
|
||||
"link": 119
|
||||
},
|
||||
{
|
||||
"name": "ref_image",
|
||||
"type": "IMAGE",
|
||||
"link": 118
|
||||
},
|
||||
{
|
||||
"name": "drive_pose",
|
||||
"type": "DRIVE_POSE",
|
||||
"link": 120
|
||||
},
|
||||
{
|
||||
"name": "drive_exp",
|
||||
"type": "DRIVE_EXPRESSION",
|
||||
"link": 124,
|
||||
"shape": 7
|
||||
},
|
||||
{
|
||||
"name": "drive_exp2",
|
||||
"type": "DRIVE_EXPRESSION2",
|
||||
"link": null,
|
||||
"shape": 7
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
122
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "HMPipelineImage"
|
||||
},
|
||||
"widgets_values": [
|
||||
0,
|
||||
"(best quality), highly detailed, ultra-detailed, headshot, person, well-placed five sense organs, looking at the viewer, centered composition, sharp focus, realistic skin texture",
|
||||
"",
|
||||
25,
|
||||
15604,
|
||||
"randomize",
|
||||
2
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 59,
|
||||
"type": "PreviewImage",
|
||||
"pos": {
|
||||
"0": 1688,
|
||||
"1": 584
|
||||
},
|
||||
"size": {
|
||||
"0": 210,
|
||||
"1": 246
|
||||
},
|
||||
"flags": {},
|
||||
"order": 9,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "images",
|
||||
"type": "IMAGE",
|
||||
"link": 122
|
||||
}
|
||||
],
|
||||
"outputs": [],
|
||||
"properties": {
|
||||
"Node name for S&R": "PreviewImage"
|
||||
},
|
||||
"widgets_values": []
|
||||
},
|
||||
{
|
||||
"id": 57,
|
||||
"type": "LoadImage",
|
||||
"pos": {
|
||||
"0": 45,
|
||||
"1": 867
|
||||
},
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 314
|
||||
},
|
||||
"flags": {},
|
||||
"order": 0,
|
||||
"mode": 0,
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
115,
|
||||
116,
|
||||
125
|
||||
],
|
||||
"slot_index": 0
|
||||
},
|
||||
{
|
||||
"name": "MASK",
|
||||
"type": "MASK",
|
||||
"links": null
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "LoadImage"
|
||||
},
|
||||
"widgets_values": [
|
||||
"yao.jpg",
|
||||
"image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 43,
|
||||
"type": "GetFaceLandmarks",
|
||||
"pos": {
|
||||
"0": 465,
|
||||
"1": 771
|
||||
},
|
||||
"size": {
|
||||
"0": 292.20001220703125,
|
||||
"1": 46
|
||||
},
|
||||
"flags": {},
|
||||
"order": 4,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "face_toolkits",
|
||||
"type": "FACE_TOOLKITS",
|
||||
"link": 62
|
||||
},
|
||||
{
|
||||
"name": "images",
|
||||
"type": "IMAGE",
|
||||
"link": 115
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "landmarks",
|
||||
"type": "FACELANDMARKS222",
|
||||
"links": [
|
||||
64,
|
||||
126
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "GetFaceLandmarks"
|
||||
},
|
||||
"widgets_values": []
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"type": "HMFaceToolkitsLoader",
|
||||
"pos": {
|
||||
"0": 43,
|
||||
"1": 699
|
||||
},
|
||||
"size": {
|
||||
"0": 315,
|
||||
"1": 58
|
||||
},
|
||||
"flags": {},
|
||||
"order": 1,
|
||||
"mode": 0,
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "face_toolkits",
|
||||
"type": "FACE_TOOLKITS",
|
||||
"links": [
|
||||
57,
|
||||
62,
|
||||
65,
|
||||
119,
|
||||
127
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "HMFaceToolkitsLoader"
|
||||
},
|
||||
"widgets_values": [
|
||||
0
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 61,
|
||||
"type": "GetDriveExpression",
|
||||
"pos": {
|
||||
"0": 857,
|
||||
"1": 823
|
||||
},
|
||||
"size": {
|
||||
"0": 292.20001220703125,
|
||||
"1": 66
|
||||
},
|
||||
"flags": {},
|
||||
"order": 7,
|
||||
"mode": 0,
|
||||
"inputs": [
|
||||
{
|
||||
"name": "face_toolkits",
|
||||
"type": "FACE_TOOLKITS",
|
||||
"link": 127
|
||||
},
|
||||
{
|
||||
"name": "images",
|
||||
"type": "IMAGE",
|
||||
"link": 125
|
||||
},
|
||||
{
|
||||
"name": "landmarks",
|
||||
"type": "FACELANDMARKS222",
|
||||
"link": 126
|
||||
}
|
||||
],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "drive_exp",
|
||||
"type": "DRIVE_EXPRESSION",
|
||||
"links": [
|
||||
124
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "GetDriveExpression"
|
||||
},
|
||||
"widgets_values": []
|
||||
},
|
||||
{
|
||||
"id": 62,
|
||||
"type": "LoadImage",
|
||||
"pos": {
|
||||
"0": 52,
|
||||
"1": 289
|
||||
},
|
||||
"size": [
|
||||
315,
|
||||
314
|
||||
],
|
||||
"flags": {},
|
||||
"order": 2,
|
||||
"mode": 0,
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "IMAGE",
|
||||
"type": "IMAGE",
|
||||
"links": [
|
||||
128
|
||||
],
|
||||
"slot_index": 0
|
||||
},
|
||||
{
|
||||
"name": "MASK",
|
||||
"type": "MASK",
|
||||
"links": null
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "LoadImage"
|
||||
},
|
||||
"widgets_values": [
|
||||
"majicmix2.jpg",
|
||||
"image"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": 63,
|
||||
"type": "HMImagePipelineLoader",
|
||||
"pos": {
|
||||
"0": 817,
|
||||
"1": 358
|
||||
},
|
||||
"size": {
|
||||
"0": 352.79998779296875,
|
||||
"1": 130
|
||||
},
|
||||
"flags": {},
|
||||
"order": 3,
|
||||
"mode": 0,
|
||||
"inputs": [],
|
||||
"outputs": [
|
||||
{
|
||||
"name": "hm_image_pipeline",
|
||||
"type": "HMIMAGEPIPELINE",
|
||||
"links": [
|
||||
129
|
||||
],
|
||||
"slot_index": 0
|
||||
}
|
||||
],
|
||||
"properties": {
|
||||
"Node name for S&R": "HMImagePipelineLoader"
|
||||
},
|
||||
"widgets_values": [
|
||||
"SD1.5",
|
||||
"None",
|
||||
"same as checkpoint",
|
||||
0
|
||||
]
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
[
|
||||
57,
|
||||
2,
|
||||
0,
|
||||
39,
|
||||
1,
|
||||
"FACE_TOOLKITS"
|
||||
],
|
||||
[
|
||||
62,
|
||||
2,
|
||||
0,
|
||||
43,
|
||||
0,
|
||||
"FACE_TOOLKITS"
|
||||
],
|
||||
[
|
||||
64,
|
||||
43,
|
||||
0,
|
||||
44,
|
||||
2,
|
||||
"FACELANDMARKS222"
|
||||
],
|
||||
[
|
||||
65,
|
||||
2,
|
||||
0,
|
||||
44,
|
||||
0,
|
||||
"FACE_TOOLKITS"
|
||||
],
|
||||
[
|
||||
115,
|
||||
57,
|
||||
0,
|
||||
43,
|
||||
1,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
116,
|
||||
57,
|
||||
0,
|
||||
44,
|
||||
1,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
118,
|
||||
39,
|
||||
0,
|
||||
58,
|
||||
2,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
119,
|
||||
2,
|
||||
0,
|
||||
58,
|
||||
1,
|
||||
"FACE_TOOLKITS"
|
||||
],
|
||||
[
|
||||
120,
|
||||
44,
|
||||
0,
|
||||
58,
|
||||
3,
|
||||
"DRIVE_POSE"
|
||||
],
|
||||
[
|
||||
122,
|
||||
58,
|
||||
0,
|
||||
59,
|
||||
0,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
124,
|
||||
61,
|
||||
0,
|
||||
58,
|
||||
4,
|
||||
"DRIVE_EXPRESSION"
|
||||
],
|
||||
[
|
||||
125,
|
||||
57,
|
||||
0,
|
||||
61,
|
||||
1,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
126,
|
||||
43,
|
||||
0,
|
||||
61,
|
||||
2,
|
||||
"FACELANDMARKS222"
|
||||
],
|
||||
[
|
||||
127,
|
||||
2,
|
||||
0,
|
||||
61,
|
||||
0,
|
||||
"FACE_TOOLKITS"
|
||||
],
|
||||
[
|
||||
128,
|
||||
62,
|
||||
0,
|
||||
39,
|
||||
0,
|
||||
"IMAGE"
|
||||
],
|
||||
[
|
||||
129,
|
||||
63,
|
||||
0,
|
||||
58,
|
||||
0,
|
||||
"HMIMAGEPIPELINE"
|
||||
]
|
||||
],
|
||||
"groups": [],
|
||||
"config": {},
|
||||
"extra": {
|
||||
"ds": {
|
||||
"scale": 0.8264462809917359,
|
||||
"offset": [
|
||||
161.88372916607042,
|
||||
-64.01845981558924
|
||||
]
|
||||
}
|
||||
},
|
||||
"version": 0.4
|
||||
}
|
||||
{"last_node_id":63,"last_link_id":129,"nodes":[{"id":2,"type":"HMFaceToolkitsLoader","pos":[43,699],"size":[315,58],"flags":{},"order":1,"mode":0,"inputs":[],"outputs":[{"name":"face_toolkits","type":"FACE_TOOLKITS","links":[57,62,65,119,127],"slot_index":0}],"properties":{"Node name for S&R":"HMFaceToolkitsLoader"},"widgets_values":[0]},{"id":39,"type":"CropPortrait","pos":[516,537],"size":[241.79998779296875,46],"flags":{},"order":5,"mode":0,"inputs":[{"name":"image","type":"IMAGE","link":128},{"name":"face_toolkits","type":"FACE_TOOLKITS","link":57}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[118],"slot_index":0}],"properties":{"Node name for S&R":"CropPortrait"},"widgets_values":[]},{"id":43,"type":"GetFaceLandmarks","pos":[465,771],"size":[292.20001220703125,46],"flags":{},"order":4,"mode":0,"inputs":[{"name":"face_toolkits","type":"FACE_TOOLKITS","link":62},{"name":"images","type":"IMAGE","link":115}],"outputs":[{"name":"landmarks","type":"FACELANDMARKS222","links":[64,126],"slot_index":0}],"properties":{"Node name for S&R":"GetFaceLandmarks"},"widgets_values":[]},{"id":44,"type":"GetDrivePose","pos":[852,661],"size":[304.79998779296875,66],"flags":{},"order":6,"mode":0,"inputs":[{"name":"face_toolkits","type":"FACE_TOOLKITS","link":65},{"name":"images","type":"IMAGE","link":116},{"name":"landmarks","type":"FACELANDMARKS222","link":64}],"outputs":[{"name":"drive_pose","type":"DRIVE_POSE","links":[120],"slot_index":0}],"properties":{"Node name for S&R":"GetDrivePose"},"widgets_values":[]},{"id":57,"type":"LoadImage","pos":[45,867],"size":[315,314],"flags":{},"order":0,"mode":0,"inputs":[],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[115,116,125],"slot_index":0},{"name":"MASK","type":"MASK","links":null}],"properties":{"Node name for S&R":"LoadImage"},"widgets_values":["yao.jpg","image"]},{"id":58,"type":"HMPipelineImage","pos":[1274,584],"size":[315,326],"flags":{},"order":8,"mode":0,"inputs":[{"name":"hm_image_pipeline","type":"HMIMAGEPIPELINE","link":129},{"name":"face_toolkits","type":"FACE_TOOLKITS","link":119},{"name":"ref_image","type":"IMAGE","link":118},{"name":"drive_pose","type":"DRIVE_POSE","link":120},{"name":"drive_exp","type":"DRIVE_EXPRESSION","link":124,"shape":7},{"name":"drive_exp2","type":"DRIVE_EXPRESSION2","link":null,"shape":7}],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[122],"slot_index":0},{"name":"LATENT","type":"LATENT","links":null}],"properties":{"Node name for S&R":"HMPipelineImage"},"widgets_values":[0,"(best quality), highly detailed, ultra-detailed, headshot, person, well-placed five sense organs, looking at the viewer, centered composition, sharp focus, realistic skin texture","",25,15604,"randomize",2,0]},{"id":59,"type":"PreviewImage","pos":[1688,584],"size":[210,246],"flags":{},"order":9,"mode":0,"inputs":[{"name":"images","type":"IMAGE","link":122}],"outputs":[],"properties":{"Node name for S&R":"PreviewImage"},"widgets_values":[]},{"id":61,"type":"GetDriveExpression","pos":[857,823],"size":[292.20001220703125,66],"flags":{},"order":7,"mode":0,"inputs":[{"name":"face_toolkits","type":"FACE_TOOLKITS","link":127},{"name":"images","type":"IMAGE","link":125},{"name":"landmarks","type":"FACELANDMARKS222","link":126}],"outputs":[{"name":"drive_exp","type":"DRIVE_EXPRESSION","links":[124],"slot_index":0}],"properties":{"Node name for S&R":"GetDriveExpression"},"widgets_values":[]},{"id":62,"type":"LoadImage","pos":[52,289],"size":[315,314],"flags":{},"order":2,"mode":0,"inputs":[],"outputs":[{"name":"IMAGE","type":"IMAGE","links":[128],"slot_index":0},{"name":"MASK","type":"MASK","links":null}],"properties":{"Node name for S&R":"LoadImage"},"widgets_values":["majicmix2.jpg","image"]},{"id":63,"type":"HMImagePipelineLoader","pos":[817,358],"size":[352.79998779296875,130],"flags":{},"order":3,"mode":0,"inputs":[],"outputs":[{"name":"hm_image_pipeline","type":"HMIMAGEPIPELINE","links":[129],"slot_index":0}],"properties":{"Node name for S&R":"HMImagePipelineLoader"},"widgets_values":["SD1.5","None","same as checkpoint","v2"]}],"links":[[57,2,0,39,1,"FACE_TOOLKITS"],[62,2,0,43,0,"FACE_TOOLKITS"],[64,43,0,44,2,"FACELANDMARKS222"],[65,2,0,44,0,"FACE_TOOLKITS"],[115,57,0,43,1,"IMAGE"],[116,57,0,44,1,"IMAGE"],[118,39,0,58,2,"IMAGE"],[119,2,0,58,1,"FACE_TOOLKITS"],[120,44,0,58,3,"DRIVE_POSE"],[122,58,0,59,0,"IMAGE"],[124,61,0,58,4,"DRIVE_EXPRESSION"],[125,57,0,61,1,"IMAGE"],[126,43,0,61,2,"FACELANDMARKS222"],[127,2,0,61,0,"FACE_TOOLKITS"],[128,62,0,39,0,"IMAGE"],[129,63,0,58,0,"HMIMAGEPIPELINE"]],"groups":[],"config":{},"extra":{"ds":{"scale":0.8264462809917354,"offset":[724.7202975099638,-227.63688958802453]}},"version":0.4}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user