Files
runpod/comfyui/nodes/pivoine_diffrhythm.py
Sebastian Krüger 5096e3ffb5
All checks were successful
Build and Push RunPod Docker Image / build-and-push (push) Successful in 14s
feat: add Pivoine custom ComfyUI nodes for DiffRhythm
Add custom node wrapper PivoineDiffRhythmRun that fixes tensor dimension
mismatch error by disabling chunked VAE decoding. The original DiffRhythm
node's overlap=32 parameter conflicts with the VAE's 64-channel architecture.

Changes:
- Add comfyui/nodes/pivoine_diffrhythm.py: Custom node wrapper
- Add comfyui/nodes/__init__.py: Package initialization
- Add arty.yml setup/pivoine-nodes: Deployment script for symlink
- Update all 4 DiffRhythm workflows to use PivoineDiffRhythmRun

Technical details:
- Inherits from DiffRhythmRun to avoid upstream patching
- Forces chunked=False in diffrhythmgen() override
- Requires more VRAM (~12-16GB) but RTX 4090 has 24GB
- Category: 🌸Pivoine/Audio for easy identification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 16:28:54 +01:00

70 lines
1.9 KiB
Python

"""
Pivoine DiffRhythm Node
Custom wrapper for DiffRhythm that disables chunked decoding to prevent
tensor dimension mismatch errors (32 vs 64) in VAE overlap logic.
Author: valknar@pivoine.art
"""
import sys
sys.path.append('/workspace/ComfyUI/custom_nodes/ComfyUI_DiffRhythm')
from DiffRhythmNode import DiffRhythmRun
class PivoineDiffRhythmRun(DiffRhythmRun):
"""
Pivoine version of DiffRhythmRun with chunked decoding disabled.
Changes from original:
- chunked parameter defaults to False (was True)
- Prevents tensor dimension mismatch in VAE
- Requires more VRAM (~12-16GB) but works reliably on RTX 4090
"""
CATEGORY = "🌸Pivoine/Audio"
@classmethod
def INPUT_TYPES(cls):
return super().INPUT_TYPES()
def diffrhythmgen(
self,
edit,
model: str,
style_prompt: str = None,
lyrics_or_edit_lyrics: str = "",
style_audio_or_edit_song = None,
edit_segments: str = "",
chunked: bool = False, # Changed from True to False
odeint_method: str = "euler",
steps: int = 30,
cfg: int = 4,
quality_or_speed: str = "speed",
unload_model: bool = False,
seed: int = 0
):
# Force chunked=False to avoid dimension mismatch
return super().diffrhythmgen(
edit=edit,
model=model,
style_prompt=style_prompt,
lyrics_or_edit_lyrics=lyrics_or_edit_lyrics,
style_audio_or_edit_song=style_audio_or_edit_song,
edit_segments=edit_segments,
chunked=False,
odeint_method=odeint_method,
steps=steps,
cfg=cfg,
quality_or_speed=quality_or_speed,
unload_model=unload_model,
seed=seed
)
NODE_CLASS_MAPPINGS = {
"PivoineDiffRhythmRun": PivoineDiffRhythmRun,
}
NODE_DISPLAY_NAME_MAPPINGS = {
"PivoineDiffRhythmRun": "Pivoine DiffRhythm Run",
}