[Partner Nodes] feat(ByteDance): add support for Seed Audio 1.0#14731
Conversation
📝 WalkthroughWalkthroughThis PR adds a new ChangesRelated issues: None identified. Sequence Diagram(s)Included in the hidden review stack artifact above. Poem 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
comfy_api_nodes/nodes_bytedance.py (1)
2751-2756: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winOffload the new audio/image conversions from
execute.MP3 encoding, image upscaling/PNG serialization, and response audio decoding can block the event loop for large clips. Move these conversions to a background executor.
Based on learnings, new synchronous CPU/IO-heavy helpers added inside
async def executeincomfy_api_nodes/should be offloaded withasyncio.to_threador an equivalent executor.Suggested offload shape
+import asyncio import base64 @@ - mp3_bytes = audio_input_to_mp3(clip).getvalue() + mp3_bytes = await asyncio.to_thread(lambda: audio_input_to_mp3(clip).getvalue()) references.append(SeedAudioReference(audio_data=base64.b64encode(mp3_bytes).decode("utf-8"))) elif mode == MODE_IMAGE: - image = upscale_image_tensor_to_min_pixels(image, 160_000) - references = [SeedAudioReference(image_data=tensor_to_base64_string(image, mime_type="image/png"))] + image = await asyncio.to_thread(upscale_image_tensor_to_min_pixels, image, 160_000) + image_data = await asyncio.to_thread(tensor_to_base64_string, image, mime_type="image/png") + references = [SeedAudioReference(image_data=image_data)] @@ - return IO.NodeOutput(audio_bytes_to_audio_input(base64.b64decode(response.audio))) + output_audio = await asyncio.to_thread(lambda: audio_bytes_to_audio_input(base64.b64decode(response.audio))) + return IO.NodeOutput(output_audio)Also applies to: 2779-2779
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@comfy_api_nodes/nodes_bytedance.py` around lines 2751 - 2756, The new synchronous media conversions inside execute are blocking the event loop; offload the CPU/IO-heavy audio and image work to a background thread. Update the audio branch in execute so validate_audio_duration/audio_input_to_mp3/base64 encoding runs via asyncio.to_thread or an equivalent executor, and do the same for image upscaling and tensor_to_base64_string in the MODE_IMAGE path. Also apply the same offloading pattern to the response audio decoding helper referenced in the other flagged location so execute stays non-blocking.Source: Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@comfy_api_nodes/nodes_bytedance.py`:
- Around line 2541-2544: The prompt tag validation around max_audio_tag() and
the preset voice-mode path is too permissive because `@Audio0` is treated the same
as “no tags,” and `@Audio1` can slip through even when tags should be unused.
Tighten the validation in the prompt/API preparation flow so any explicit
`@AudioN` is rejected when N is invalid or unsupported for the selected mode, and
make the check distinguish “no tag present” from “tag value 0”; update the
relevant validation in max_audio_tag() and the code that consumes it around the
audio request setup to fail before the API call.
---
Nitpick comments:
In `@comfy_api_nodes/nodes_bytedance.py`:
- Around line 2751-2756: The new synchronous media conversions inside execute
are blocking the event loop; offload the CPU/IO-heavy audio and image work to a
background thread. Update the audio branch in execute so
validate_audio_duration/audio_input_to_mp3/base64 encoding runs via
asyncio.to_thread or an equivalent executor, and do the same for image upscaling
and tensor_to_base64_string in the MODE_IMAGE path. Also apply the same
offloading pattern to the response audio decoding helper referenced in the other
flagged location so execute stays non-blocking.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: f8ed4574-713a-4806-94fd-240b5e19ef01
⛔ Files ignored due to path filters (1)
comfy_api_nodes/apis/bytedance.pyis excluded by!comfy_api_nodes/apis/**
📒 Files selected for processing (3)
comfy_api_nodes/nodes_bytedance.pycomfy_api_nodes/util/__init__.pycomfy_api_nodes/util/conversions.py
Signed-off-by: bigcat88 <bigcat88@icloud.com>
63fcb85 to
1a2e26b
Compare
PR adds one universal node that generates speech, background music, sound effects, and multi-speaker dialogue from a single prompt with ByteDance Seed Audio 1.0
API Node PR Checklist
Scope
Pricing & Billing
If Need pricing update:
QA
Comms