fix: replace custom Pivoine node with direct DiffRhythm patch
All checks were successful
Build and Push RunPod Docker Image / build-and-push (push) Successful in 14s

- Remove custom PivoineDiffRhythmRun wrapper node
- Add git patch file for ComfyUI_DiffRhythm __init__.py
- Patch adds LlamaConfig fix at import time
- Add arty script 'fix/diffrhythm-patch' to apply patch
- Revert all workflows to use original DiffRhythmRun
- Remove startup_patch.py and revert start.sh

This approach is cleaner and more maintainable than wrapping the node.
The patch directly fixes the tensor dimension mismatch (32 vs 64) in
DiffRhythm's rotary position embeddings by ensuring num_attention_heads
and num_key_value_heads are properly set based on hidden_size.

References:
- https://github.com/billwuhao/ComfyUI_DiffRhythm/issues/44
- https://github.com/billwuhao/ComfyUI_DiffRhythm/issues/48
This commit is contained in:
2025-11-24 19:27:18 +01:00
parent f74457b049
commit d74a7cb7cb
8 changed files with 96 additions and 142 deletions

View File

@@ -396,37 +396,56 @@ scripts:
echo ""
echo "Category: 🌸Pivoine/Audio"
fix/diffrhythm-transformers: |
fix/diffrhythm-patch: |
echo "========================================="
echo " Fix DiffRhythm Transformers Version"
echo " Apply DiffRhythm LlamaConfig Patch"
echo "========================================="
echo ""
echo "Issue: Tensor dimension mismatch (32 vs 64) in rotary embeddings"
echo "Solution: Downgrade transformers to 4.49.0"
echo "Solution: Patch DiffRhythm __init__.py to fix LlamaConfig"
echo ""
echo "References:"
echo " - https://github.com/billwuhao/ComfyUI_DiffRhythm/issues/44"
echo " - https://github.com/billwuhao/ComfyUI_DiffRhythm/issues/48"
echo ""
cd /workspace/ComfyUI
source venv/bin/activate
DIFF_RHYTHM_DIR="/workspace/ComfyUI/custom_nodes/ComfyUI_DiffRhythm"
PATCH_FILE="/workspace/ai/comfyui/patches/diffrhythm-llamaconfig-fix.patch"
echo "Current transformers version:"
pip show transformers | grep Version
echo ""
if [ ! -d "$DIFF_RHYTHM_DIR" ]; then
echo "✗ Error: DiffRhythm not found at $DIFF_RHYTHM_DIR"
exit 1
fi
echo "Installing transformers==4.49.0..."
pip install transformers==4.49.0
if [ ! -f "$PATCH_FILE" ]; then
echo "✗ Error: Patch file not found at $PATCH_FILE"
exit 1
fi
echo ""
echo "✓ Transformers downgraded to 4.49.0"
echo ""
echo "Next steps:"
echo " 1. Restart ComfyUI: arty services/comfyui/restart"
echo " 2. Test DiffRhythm workflows"
cd "$DIFF_RHYTHM_DIR"
deactivate
echo "Checking if patch already applied..."
if grep -q "PatchedLlamaConfig" __init__.py; then
echo "✓ Patch already applied!"
exit 0
fi
echo "Applying patch..."
patch -p1 < "$PATCH_FILE"
if [ $? -eq 0 ]; then
echo ""
echo "✓ Patch applied successfully!"
echo ""
echo "Next steps:"
echo " 1. Restart ComfyUI: arty services/comfyui/restart"
echo " 2. Test DiffRhythm workflows"
else
echo ""
echo "✗ Failed to apply patch"
echo "You may need to manually apply the patch or check for conflicts"
exit 1
fi
setup/comfyui-extensions-deps: |
echo "========================================="