INNER CODE UNIT · Python
lmks
Tencent-Hunyuan/HunyuanPortrait · gradio_app.py:245
lmks = lmk_list[idx:idx+batch]
num_frames = motion_pose_image.shape[0]
motion_bucket_id_head, motion_bucket_id_exp = get_head_exp_motion_bucketid(lmks)
motion_feature = motion_expression_model(motion_face_image)
motion_bucket_id_head_t = torch.IntTensor([motion_bucket_id_head]).to('cuda')
motion_bucket_id_exp_t = torch.IntTensor([motion_bucket_id_exp]).to('cuda')
motion_feature_embed = motion_proj(motion_feature, motion_bucket_id_head_t, motion_bucket_id_exp_t)
driven_pose_feat = motion_headpose_model(motion_pose_image * 2 + 1)
driven_pose_feat_embed = torch.cat([driven_pose_feat['rotation'], driven_pose_feat['translation'] * 0], dim=-1)
driven_feat = torch.cat([motion_feature_embed, driven_pose_feat_embed.unsqueeze(1).repeat(1, motion_feature_embed.shape[1], 1)], dim=-1)
driven_feat = driven_feat.unsqueeze(0)
uncond_driven_feat = torch.zeros_like(driven_feat)
pose_cond_tensor = pose_cond_tensor.unsqueeze(0)