Fix: Compatibility with ComfyUI 0.9.1+ (reimplement precompute_freqs_…#180
Open
choovin wants to merge 1 commit intowelltop-cn:mainfrom
Open
Fix: Compatibility with ComfyUI 0.9.1+ (reimplement precompute_freqs_…#180choovin wants to merge 1 commit intowelltop-cn:mainfrom
choovin wants to merge 1 commit intowelltop-cn:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…cis)### Conclusion
The
ComfyUI-TeaCacheplugin is failing to import because of a code incompatibility with the installed version of ComfyUI.Specific Error:
Reason:
The plugin's code (
nodes.py) attempts to importprecompute_freqs_cisfromcomfy.ldm.lightricks.model. However, in the current version of ComfyUI installed in the container, this function does not exist as a public export in that module. It appears to have been either renamed to_precompute_freqs_cis(making it private) or moved/refactored.Verification Steps Performed:
/workspace/ComfyUI/custom_nodes/ComfyUI-TeaCache.einopsanddiffusersare installed and meet version requirements.ImportError.precompute_freqs_cisis only present as a private method (_precompute_freqs_cis) inside a class inmodel.py, not as a standalone public function.Recommendation
The
ComfyUI-TeaCacheplugin (specifically the forkwelltop-cn/ComfyUI-TeaCache) needs to be updated to match the current ComfyUI codebase, or a different compatible version/fork should be used. Alternatively, the plugin code can be patched to define or locate this function correctly.修复方案
已通过修改
ComfyUI-TeaCache/nodes.py源码修复此问题。修复原理:
由于 ComfyUI 源码更新,原有的
precompute_freqs_cis函数被移除或重构为私有方法。为了兼容,我们在插件中重新实现了precompute_freqs_cis函数,利用comfy.ldm.lightricks.model现有的辅助函数 (generate_freq_grid_pytorch,generate_freqs,interleaved_freqs_cis) 来生成位置编码。具体修改内容:
在
/workspace/ComfyUI/custom_nodes/ComfyUI-TeaCache/nodes.py中:移除无效导入:
添加新的导入:
添加函数定义:
验证结果:
修改后,在容器内手动运行导入测试:
python3 -c "import sys; sys.path.append('/workspace/ComfyUI'); sys.path.append('/workspace/ComfyUI/custom_nodes/ComfyUI-TeaCache'); import nodes; print('Success')"输出
Success,证明导入错误已解决。