Skip to content

Conversation

@kabachuha
Copy link
Contributor

This pull request adds setting the last generation frame by substituting it and averaging the CLIP embeddings

Taken from lllyasviel/FramePack#167

Example of this workflow working:
https://github.com/user-attachments/assets/9fbf61e9-5a68-456c-9753-23d4dd8041bb

Workflow:
example-multi.json

@Qi-0072
Copy link

Qi-0072 commented Apr 21, 2025

This is fantastic, thank you very much! Can I ask where you should go to install the relevant nodes you are missing?
Uploading 20250421-165639.jpg…

@IntendedConsequence
Copy link

Maybe instead of averaging start/end frame clipvision embeddings and using the same result for all segments (latent_paddings) it would be better to have as many embeddings as there are latent_paddings and interpolate them?

@kabachuha
Copy link
Contributor Author

kabachuha commented Apr 21, 2025

@IntendedConsequence Yes, it's a great idea (and such interpolation is actually a unique advantage of next frame prediction models over full-context diffusion models).

One note is that the previous frames could need the last frame's context to "know" that happens there, if we want to have smooth transitions aware of both ends, and averaging the embeddings can be a good compromise.

I can add a binary switch for this first-last frame interpolation mode (0->1) and averaging (0.5).


@Qi-0072 I don't see your image file, personally

@IntendedConsequence
Copy link

@kabachuha did you see any difference with interpolation if I may ask?

@kabachuha
Copy link
Contributor Author

Yes, the transition of the example above became a bit smoother (in particular, regarding the end frame rabbit's behavior) and the weighted average with different parameter control how fast the background transforms and also affects the rabbit :)

Didn't test it with more complex environments yet. I'm not at home right now, so I suggest to try it yourself with various settings.

@berryyan
Copy link

FramePackSampler.process() got an unexpected keyword argument 'image_end_embeds'

@kabachuha
Copy link
Contributor Author

@berryyan Are you on my branch or only using the example workflow I provided?

@berryyan
Copy link

@berryyan您是否在我的分支上或仅使用我提供的示例工作流程?

是的 我再尝试一次切换分支

@berryyan
Copy link

(ComfyUI) E:\AI\ComfyUI\ComfyUI\custom_nodes\ComfyUI-FramePackWrapper>gh pr checkout 5
remote: Enumerating objects: 17, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 17 (delta 6), reused 6 (delta 6), pack-reused 4 (from 1)
Unpacking objects: 100% (17/17), 14.11 KiB | 225.00 KiB/s, done.
From https://github.com/kijai/ComfyUI-FramePackWrapper

  • [new ref] refs/pull/5/head -> init
    Switched to branch 'init'

还是失败...而且报错变了 我再查找一下原因,我是5090的显卡,可能有些环境和插件的确和别人不太一样。

@shaorax
Copy link

shaorax commented Apr 23, 2025

From kabachuha's branch, copy the files from here to the source directory and run it successfully. Great, thanks for your contribution!
微信图片_20250423121829

@kabachuha
Copy link
Contributor Author

@kijai Are you ready to review this PR?

@kijai kijai merged commit 4b959f4 into kijai:main Apr 23, 2025
@kabachuha kabachuha deleted the init branch April 23, 2025 12:37
@IntendedConsequence
Copy link

@kabachuha @kijai I've encountered a bug with division by zero I think for low duration (1 second) and interpolation type is set to linear. Can't try repro right now but saved the stack trace:

total_latent_sections:  1
start_latent torch.Size([1, 16, 1, 96, 64])
model_type FLOW
Warning: TAESD previews enabled, but could not find models/vae_approx/None
Moving DynamicSwap_HunyuanVideoTransformer3DModelPacked to cuda:0 with preserved memory: 4.0 GB
latent_padding: 0
!!! Exception during processing !!! division by zero
Traceback (most recent call last):
  File "d:\ml\ComfyUI_next\execution.py", line 347, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\ml\ComfyUI_next\execution.py", line 222, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "d:\ml\ComfyUI_next\execution.py", line 194, in _map_node_over_list
    process_inputs(input_dict, i)
  File "d:\ml\ComfyUI_next\execution.py", line 183, in process_inputs
    results.append(getattr(obj, func)(**inputs))
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\ml\ComfyUI_next\custom_nodes\ComfyUI-FramePackWrapper\nodes.py", line 393, in process
    frac = 1 - i / (total_latent_sections - 1) # going backwards
               ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ZeroDivisionError: division by zero

@odoucet
Copy link

odoucet commented Apr 26, 2025

@jeerychao stop hijacking threads, this is not a support forum. Please delete your messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants