Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
ComfyUI-MimicMotionWrapper
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
王骏浩
ComfyUI-MimicMotionWrapper
Commits
4fe892a7
提交
4fe892a7
authored
7月 02, 2024
作者:
kijai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix quality
duh
上级
ffae2711
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
33 行增加
和
25 行删除
+33
-25
pipeline_mimicmotion.py
mimicmotion/pipelines/pipeline_mimicmotion.py
+24
-19
nodes.py
nodes.py
+9
-6
没有找到文件。
mimicmotion/pipelines/pipeline_mimicmotion.py
浏览文件 @
4fe892a7
...
...
@@ -21,6 +21,7 @@ from ..modules.pose_net import PoseNet
from
comfy.utils
import
ProgressBar
import
comfy.model_management
as
mm
from
comfy.clip_vision
import
clip_preprocess
offload_device
=
mm
.
unet_offload_device
()
logger
=
logging
.
get_logger
(
__name__
)
# pylint: disable=invalid-name
...
...
@@ -126,25 +127,28 @@ class MimicMotionPipeline(DiffusionPipeline):
do_classifier_free_guidance
:
bool
):
dtype
=
next
(
self
.
image_encoder
.
parameters
())
.
dtype
if
not
isinstance
(
image
,
torch
.
Tensor
):
image
=
self
.
image_processor
.
pil_to_numpy
(
image
)
image
=
self
.
image_processor
.
numpy_to_pt
(
image
)
# We normalize the image before resizing to match with the original implementation.
# Then we unnormalize it after resizing.
image
=
image
*
2.0
-
1.0
image
=
_resize_with_antialiasing
(
image
,
(
224
,
224
))
image
=
(
image
+
1.0
)
/
2.0
# Normalize the image with for CLIP input
image
=
self
.
feature_extractor
(
images
=
image
,
do_normalize
=
True
,
do_center_crop
=
False
,
do_resize
=
False
,
do_rescale
=
False
,
return_tensors
=
"pt"
,
)
.
pixel_values
# if not isinstance(image, torch.Tensor):
# image = self.image_processor.pil_to_numpy(image)
# image = self.image_processor.numpy_to_pt(image)
# # We normalize the image before resizing to match with the original implementation.
# # Then we unnormalize it after resizing.
# image = image * 2.0 - 1.0
# image = _resize_with_antialiasing(image, (224, 224))
# image = (image + 1.0) / 2.0
# # Normalize the image with for CLIP input
# image = self.feature_extractor(
# images=image,
# do_normalize=True,
# do_center_crop=False,
# do_resize=False,
# do_rescale=False,
# return_tensors="pt",
# ).pixel_values
image
=
image
.
permute
(
0
,
2
,
3
,
1
)
image
=
clip_preprocess
(
image
.
clone
(),
224
)
image
=
image
.
to
(
device
=
device
,
dtype
=
dtype
)
self
.
image_encoder
.
to
(
device
)
...
...
@@ -159,6 +163,7 @@ class MimicMotionPipeline(DiffusionPipeline):
if
do_classifier_free_guidance
:
negative_image_embeddings
=
torch
.
zeros_like
(
image_embeddings
)
#negative_image_embeddings = torch.randn_like(image_embeddings)
# For classifier free guidance, we need to do two forward passes.
# Here we concatenate the unconditional and text embeddings into a single batch
...
...
nodes.py
浏览文件 @
4fe892a7
...
...
@@ -7,6 +7,8 @@ import folder_paths
import
comfy.model_management
as
mm
import
comfy.utils
from
comfy.clip_vision
import
clip_preprocess
from
diffusers.models
import
AutoencoderKLTemporalDecoder
from
diffusers.schedulers
import
EulerDiscreteScheduler
from
transformers
import
CLIPImageProcessor
,
CLIPVisionModelWithProjection
...
...
@@ -183,21 +185,22 @@ class MimicMotionSampler:
ref_image
=
ref_image
.
permute
(
0
,
3
,
1
,
2
)
pose_images
=
pose_images
.
permute
(
0
,
3
,
1
,
2
)
if
ref_image
.
shape
[
1
:
3
]
!=
(
224
,
224
):
ref_img
=
comfy
.
utils
.
common_upscale
(
ref_image
,
224
,
224
,
"lanczos"
,
"disabled"
)
else
:
ref_img
=
ref_image
# if ref_image.shape[1:3] != (224, 224):
# #ref_img = comfy.utils.common_upscale(ref_image, 224, 224, "lanczos", "disabled")
# ref_img = clip_preprocess(ref_image, 224)
# else:
# ref_img = ref_image
pose_images
=
pose_images
*
2
-
1
ref_im
g
=
ref_img
.
to
(
device
)
.
to
(
dtype
)
ref_im
age
=
ref_image
.
to
(
device
)
.
to
(
dtype
)
pose_images
=
pose_images
.
to
(
device
)
.
to
(
dtype
)
generator
=
torch
.
Generator
(
device
=
device
)
generator
.
manual_seed
(
seed
)
frames
=
pipeline
(
ref_im
g
,
ref_im
age
,
image_pose
=
pose_images
,
num_frames
=
B
,
tile_size
=
context_size
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论