-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如何处理16:9视频以及长视频 #22
Comments
如果帧数过多,建议在外部分段。算法内部每次迭代都需要所有帧的信息,如果压到硬盘上,读写速度太慢,会导致数倍的计算时间。 |
关于分辨率,只支持 64 的倍数。 |
我做了一些尝试,将裁剪后的图片,以及controlnet.process_image的结果全部压到硬盘了,使用部分改为从硬盘读取 我对python代码不熟,也是借助AI帮改的逻辑 |
我改完了,代码在fork出来的仓库里:DiffSynth-Studio-Disk-Cache |
|
我修正了这个错误,你更新一下代码 |
速度方面确实不快,3090大概也是这个速度,我正在尝试处理一个1600x896的5441帧的,大概要35小时完成sd步骤,smoother还不知道要多少个小时 |
感觉上稍加修改可以将步骤进行多卡并行处理,甚至CPU协助部分计算,比如smoother的左右参考是独立的两次计算,sd步骤里也是分批次取多帧处理的 |
|
错误来自我疏忽了单组contronelet_frame的处理,已经提交了修正代码,更新一下试试,但还没验证(我电脑正在跑一个处理),如果有问题继续提出。
|
贴一个我跑的: from diffsynth import SDVideoPipelineRunner
# Download models
# `models/stable_diffusion/aingdiffusion_v12.safetensors`: [link](https://civitai.com/api/download/models/229575)
# `models/AnimateDiff/mm_sd_v15_v2.ckpt`: [link](https://huggingface.co/guoyww/animatediff/resolve/main/mm_sd_v15_v2.ckpt)
# `models/ControlNet/control_v11p_sd15_lineart.pth`: [link](https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart.pth)
# `models/ControlNet/control_v11f1e_sd15_tile.pth`: [link](https://huggingface.co/lllyasviel/ControlNet-v1-1/resolve/main/control_v11f1e_sd15_tile.pth)
# `models/Annotators/sk_model.pth`: [link](https://huggingface.co/lllyasviel/Annotators/resolve/main/sk_model.pth)
# `models/Annotators/sk_model2.pth`: [link](https://huggingface.co/lllyasviel/Annotators/resolve/main/sk_model2.pth)
# `models/textual_inversion/verybadimagenegative_v1.3.pt`: [link](https://civitai.com/api/download/models/25820?type=Model&format=PickleTensor&size=full&fp=fp16)
# The original video in the example is https://www.bilibili.com/video/BV1iG411a7sQ/.
startFrame = 0
endFrame = 5440
width = 1600
height = 896
config = {
"models": {
"model_list": [
"models/stable_diffusion/aingdiffusion_v12.safetensors",
"models/AnimateDiff/mm_sd_v15_v2.ckpt",
"models/ControlNet/control_v11f1e_sd15_tile.pth",
"models/ControlNet/control_v11p_sd15_lineart.pth"
],
"textual_inversion_folder": "models/textual_inversion",
"device": "cuda",
"lora_alphas": [],
"controlnet_units": [
{
"processor_id": "tile",
"model_path": "models/ControlNet/control_v11f1e_sd15_tile.pth",
"scale": 0.5
},
{
"processor_id": "lineart",
"model_path": "models/ControlNet/control_v11p_sd15_lineart.pth",
"scale": 0.5
}
]
},
"data": {
"input_frames": {
"video_file": "F:/大喜.mp4",
"image_folder": None,
"height": height,
"width": width,
"start_frame_id": startFrame,
"end_frame_id": endFrame
},
"controlnet_frames": [
{
"video_file": "data/examples/diffutoon/input_video.mp4",
"image_folder": None,
"height": height,
"width": width,
"start_frame_id": startFrame,
"end_frame_id": endFrame
},
{
"video_file": "data/examples/diffutoon/input_video.mp4",
"image_folder": None,
"height": height,
"width": width,
"start_frame_id": startFrame,
"end_frame_id": endFrame
}
],
"clear_output_folder": False,
"output_folder": "F:/output-%d-%d" % (startFrame, endFrame),
"fps": 30
},
"smoother_configs": [
{
"processor_type": "FastBlend",
"config": {}
}
],
"pipeline": {
"seed": 0,
"pipeline_inputs": {
"prompt": "best quality, perfect anime illustration, a girl standing in front of a display of plates and lamps , a girl wear a pink dress,yousa,fullbody,kitsch movement,dance,china dress,black_hair,1girl",
"negative_prompt": "verybadimagenegative_v1.3",
"cfg_scale": 7.0,
"clip_skip": 2,
"denoising_strength": 1.0,
"num_inference_steps": 10,
"animatediff_batch_size": 16,
"animatediff_stride": 8,
"unet_batch_size": 1,
"controlnet_batch_size": 1,
"cross_frame_attention": True,
"smoother_progress_ids": [-1],
# The following parameters will be overwritten. You don't need to modify them.
"input_frames": [],
"num_frames": endFrame+1,
"width": 1920,
"height": 1080,
"controlnet_frames": []
}
}
}
print("start:%d end:%d\n" % (startFrame, endFrame))
runner = SDVideoPipelineRunner()
runner.run(config)
print("done at data/examples/diffutoon/output-%d-%d\n" % (startFrame, endFrame))
print("all finish\n") |
我测试了你给出的 diffutoon_toon_shading.py 的demo,是没有问题的,我测试的 sd_toon_shading.py 是有 问题的 |
|
我之后仔细调一下吧,写死p0是因为只有一组,后面却又取了p1,是controlnet_processor_count取值计算错误,你可以试试把这个参数固定为1 我取那个分辨率是因为它是宽高比最接近16:9且宽高都能被64整除的。 |
如果设置的比例为16:9,则会发生异常
如果帧数大于1000,经测试好像会把所有帧解码为图像存在内存中,128GB内存也顶不住,能否改为按需解码或者全部处理为图片储存到磁盘上,使用时载入
The text was updated successfully, but these errors were encountered: