Skip to content

Declare dtype on the VideoPositionEmb.generate_embeddings stub - #15991

Open
Anai-Guo wants to merge 1 commit into
Comfy-Org:masterfrom
Anai-Guo:fix-cosmos-posemb-stub-dtype
Open

Declare dtype on the VideoPositionEmb.generate_embeddings stub#15991
Anai-Guo wants to merge 1 commit into
Comfy-Org:masterfrom
Anai-Guo:fix-cosmos-posemb-stub-dtype

Conversation

@Anai-Guo

Copy link
Copy Markdown

One line: add dtype=None to the VideoPositionEmb.generate_embeddings stub.

VideoPositionEmb.forward passes dtype to it:

# comfy/ldm/cosmos/position_embedding.py:49
embeddings = self.generate_embeddings(B_T_H_W_C, fps=fps, device=device, dtype=dtype)

# :53 — the stub in the same class
def generate_embeddings(self, B_T_H_W_C: torch.Size, fps=Optional[torch.Tensor], device=None):
    raise NotImplementedError

Both concrete subclasses in the file already declare dtype
(VideoRopePosition3DEmb at :100, LearnablePosEmbAxis at :192), so nothing
is broken at runtime today. The stub is the odd one out, and it is the thing a
new subclass gets written against — such an override raises
TypeError: generate_embeddings() got an unexpected keyword argument 'dtype'
on its first forward pass.

Checked by loading the module before and after, then generating an override that
copies whatever signature the stub advertises:

unpatched | stub: (self, B_T_H_W_C: torch.Size, fps=typing.Optional[torch.Tensor], device=None)
unpatched |   VideoRopePosition3DEmb: dtype declared = True
unpatched |   LearnablePosEmbAxis:   dtype declared = True
unpatched |   override copying the stub: (self, B_T_H_W_C, fps=None, device=None)
unpatched |   forward -> TypeError: NewEmb.generate_embeddings() got an unexpected keyword argument 'dtype'

patched   | stub: (self, B_T_H_W_C: torch.Size, fps=typing.Optional[torch.Tensor], device=None, dtype=None)
patched   |   override copying the stub: (self, B_T_H_W_C, fps=None, device=None, dtype=None)
patched   |   forward -> OK (1, 2, 3, 4, 5)

No behaviour change for either existing subclass.

🤖 Generated with Claude Code

VideoPositionEmb.forward calls self.generate_embeddings(..., dtype=dtype), but
the abstract stub it sits next to does not accept dtype. Both subclasses in the
file already do, so nothing breaks today; the stub is simply out of date, and an
override written to the signature it advertises raises TypeError on first
forward.
@github-actions

Copy link
Copy Markdown
Contributor

🎉 Thank you for your contribution, we really appreciate it! 🎉

Like many open source projects, we require contributors to sign our Contributor License Agreement (CLA). A CLA makes the ownership of contributions explicit, so contributors and the project share a clear understanding of how the code can be used. By signing, you:

  • Confirm that you own your contribution.
  • Keep the right to reuse your own code.
  • Grant us a copyright license to include and share it within our projects.

CLAs are standard practice across major open source projects including those under the Apache Software Foundation and the Linux Foundation. Ours is based on the Apache Software Foundation's CLA. Most importantly, it would enable us to relicense the project under a more permissive license in the future, giving the project and its community greater flexibility.

To sign, please post a new comment on this PR with exactly the following text:


I have read and agree to the Contributor License Agreement


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 68049db2-5995-4d63-8f9f-8fd0e7d88aed

📥 Commits

Reviewing files that changed from the base of the PR and between f938505 and 3a2cada.

📒 Files selected for processing (1)
  • comfy/ldm/cosmos/position_embedding.py

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📜 Recent review details
⚠️ CI failures not shown inline (2)

GitHub Actions: CLA Assistant / 0_cla-assistant.txt: Declare dtype on the VideoPositionEmb.generate_embeddings stub

Conclusion: failure

View job details

##[group]Run contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08
 with:
   path-to-document: https://github.com/Comfy-Org/comfy-cla/blob/main/comfyui_icla.md
   remote-organization-name: comfy-org
   remote-repository-name: comfy-cla
   path-to-signatures: signatures/cla.json
   branch: main
   allowlist: action@github.com,actions-user,ampagent,claude,comfy-pr-bot,GitHub Action,github-actions,github-actions[bot],Glary Bot,Glary-Bot,*[bot]
   custom-notsigned-prcomment: 🎉 Thank you for your contribution, we really appreciate it! 🎉
Like many open source projects, we require contributors to sign our [Contributor License Agreement (CLA)](https://github.com/Comfy-Org/comfy-cla/blob/main/comfyui_icla.md). A CLA makes the ownership of contributions explicit, so contributors and the project share a clear understanding of how the code can be used. By signing, you:
- Confirm that you own your contribution.
- Keep the right to reuse your own code.
- Grant us a copyright license to include and share it within our projects.
CLAs are standard practice across major open source projects including those under the Apache Software Foundation and the Linux Foundation. Ours is based on the Apache Software Foundation's CLA. Most importantly, it would enable us to relicense the project under a more permissive license in the future, giving the project and its community greater flexibility.
✍ **To sign, please post a new comment on this PR with exactly the following text:** ✍
   custom-pr-sign-comment: I have read and agree to the Contributor License Agreement
   custom-allsigned-prcomment: ✅ All contributors have signed the CLA. Thank you! This PR is ready to be merged.
   use-dco-flag: false
   lock-pullrequest-aftermerge: true
   suggest-recheck: true
 env:
   GITHUB_***REDACTED_SECRET_ASSIGNMENT***
   PERSONAL_ACCESS_***REDACTED_SECRET_ASSIGNMENT***
 ##[endgroup]
 CLA Assistant GitHub Action bot has started the process
 (node:2149) [DEP0040] DeprecationWarn...

GitHub Actions: CLA Assistant / cla-assistant: Declare dtype on the VideoPositionEmb.generate_embeddings stub

Conclusion: failure

View job details

##[group]Run contributor-assistant/github-action@ca4a40a7d1004f18d9960b404b97e5f30a505a08
 with:
   path-to-document: https://github.com/Comfy-Org/comfy-cla/blob/main/comfyui_icla.md
   remote-organization-name: comfy-org
   remote-repository-name: comfy-cla
   path-to-signatures: signatures/cla.json
   branch: main
   allowlist: action@github.com,actions-user,ampagent,claude,comfy-pr-bot,GitHub Action,github-actions,github-actions[bot],Glary Bot,Glary-Bot,*[bot]
   custom-notsigned-prcomment: 🎉 Thank you for your contribution, we really appreciate it! 🎉
Like many open source projects, we require contributors to sign our [Contributor License Agreement (CLA)](https://github.com/Comfy-Org/comfy-cla/blob/main/comfyui_icla.md). A CLA makes the ownership of contributions explicit, so contributors and the project share a clear understanding of how the code can be used. By signing, you:
- Confirm that you own your contribution.
- Keep the right to reuse your own code.
- Grant us a copyright license to include and share it within our projects.
CLAs are standard practice across major open source projects including those under the Apache Software Foundation and the Linux Foundation. Ours is based on the Apache Software Foundation's CLA. Most importantly, it would enable us to relicense the project under a more permissive license in the future, giving the project and its community greater flexibility.
✍ **To sign, please post a new comment on this PR with exactly the following text:** ✍
   custom-pr-sign-comment: I have read and agree to the Contributor License Agreement
   custom-allsigned-prcomment: ✅ All contributors have signed the CLA. Thank you! This PR is ready to be merged.
   use-dco-flag: false
   lock-pullrequest-aftermerge: true
   suggest-recheck: true
 env:
   GITHUB_***REDACTED_SECRET_ASSIGNMENT***
   PERSONAL_ACCESS_***REDACTED_SECRET_ASSIGNMENT***
 ##[endgroup]
 CLA Assistant GitHub Action bot has started the process
 (node:2149) [DEP0040] DeprecationWarn...
🧰 Additional context used
📓 Path-based instructions (6)
Core ML/diffusion engine. Focus on:

⚙️ CodeRabbit configuration file

Files:

  • comfy/ldm/cosmos/position_embedding.py
IMPORTANT: Only comment on issues directly introduced by this PR's code changes.

⚙️ CodeRabbit configuration file

Files:

  • comfy/ldm/cosmos/position_embedding.py
Treat legacy combo, `io.Combo`, and `io.DynamicCombo` values affecting filesystem access as untrusted; revalidate them at load/save boundaries with `folder_paths`, containment checks, or fixed allowlists.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • comfy/ldm/cosmos/position_embedding.py
Keep state and capability flags on the object that owns the behavior. Prefer explicit parent-owned attributes over probing child objects with `getattr`; use child checks only when the child owns the delegated behavior.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • comfy/ldm/cosmos/position_embedding.py
Keep changes small, direct, and limited to the narrowest necessary code path and smallest number of files.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • comfy/ldm/cosmos/position_embedding.py
Keep warning and info messages short and actionable, remove noisy or misleading logging, and make documentation edits concise, factual, and tied to changed behavior.

📄 CodeRabbit inference engine (AGENTS.md)

Files:

  • comfy/ldm/cosmos/position_embedding.py
🔇 Additional comments (1)
comfy/ldm/cosmos/position_embedding.py (1)

53-53: LGTM!


📝 Walkthrough

Walkthrough

VideoPositionEmb.generate_embeddings now accepts an optional dtype argument. The existing arguments and default behavior remain unchanged.

Merge Risk: ⚪ Minimal · up to 3a2ca

This localized signature fix enables compatible subclasses to receive the dtype argument without changing existing behavior. No actionable merge-blocking risk remains after normal checks and review.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding the dtype parameter to the VideoPositionEmb.generate_embeddings stub.
Description check ✅ Passed The description accurately explains the signature mismatch, the caller and subclass context, the potential error for new overrides, and the validation performed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch

Comment @coderabbitai help to get the list of available commands.

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.

1 participant