Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion comfy/model_prefetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def cleanup_prefetch_queues():
GRAPH_CAPTURE_STREAMS = {}

def prefetch_queue_pop(queue, device, module, dtype=None, core=None, enable_graph=False, generator=None):
enable_graph = enable_graph and not args.disable_cuda_graphs and comfy.model_management.is_device_cuda(device)
enable_graph = enable_graph and not args.disable_cuda_graphs and comfy.model_management.is_device_cuda(device) and getattr(module, "_v_block", None) is not None
if queue is None:
if core is not None:
core()
Expand Down
31 changes: 2 additions & 29 deletions comfy_api_nodes/apis/bytedance.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class Seedance2TaskCreationRequest(BaseModel):
seed: int | None = Field(None, ge=0, le=2147483647)
watermark: bool | None = Field(None)
output_format: str | None = Field(None)
omni_reference_task_type: str | None = Field(None, description="One of: auto, reference, edit, extend.")


class TaskCreationResponse(BaseModel):
Expand Down Expand Up @@ -186,35 +187,6 @@ class SeedanceVirtualLibraryCreateAssetRequest(BaseModel):
asset_type: str | None = Field(None, description="BytePlus asset type. Defaults to Image server-side when omitted.")


# Dollars per 1K tokens, keyed by (model_id, has_video_input, resolution).
SEEDANCE2_PRICE_PER_1K_TOKENS = {
("dreamina-seedance-2-0-260128", False, "480p"): 0.007,
("dreamina-seedance-2-0-260128", True, "480p"): 0.0043,
("dreamina-seedance-2-0-260128", False, "720p"): 0.007,
("dreamina-seedance-2-0-260128", True, "720p"): 0.0043,
("dreamina-seedance-2-0-260128", False, "1080p"): 0.0077,
("dreamina-seedance-2-0-260128", True, "1080p"): 0.0047,
("dreamina-seedance-2-0-260128", False, "4k"): 0.004,
("dreamina-seedance-2-0-260128", True, "4k"): 0.0024,
("dreamina-seedance-2-0-fast-260128", False, "480p"): 0.0056,
("dreamina-seedance-2-0-fast-260128", True, "480p"): 0.0033,
("dreamina-seedance-2-0-fast-260128", False, "720p"): 0.0056,
("dreamina-seedance-2-0-fast-260128", True, "720p"): 0.0033,
("dreamina-seedance-2-0-mini", False, "480p"): 0.0035,
("dreamina-seedance-2-0-mini", True, "480p"): 0.0021,
("dreamina-seedance-2-0-mini", False, "720p"): 0.0035,
("dreamina-seedance-2-0-mini", True, "720p"): 0.0021,
("dreamina-seedance-2-5-260628", False, "480p"): 0.0107,
("dreamina-seedance-2-5-260628", True, "480p"): 0.0064,
("dreamina-seedance-2-5-260628", False, "720p"): 0.0107,
("dreamina-seedance-2-5-260628", True, "720p"): 0.0064,
}


def seedance2_price_per_1k_tokens(model_id: str, has_video_input: bool, resolution: str) -> float | None:
return SEEDANCE2_PRICE_PER_1K_TOKENS.get((model_id, has_video_input, resolution))


RECOMMENDED_PRESETS = [
("1024x1024 (1:1)", 1024, 1024),
("864x1152 (3:4)", 864, 1152),
Expand Down Expand Up @@ -329,6 +301,7 @@ def seedance2_price_per_1k_tokens(model_id: str, has_video_input: bool, resoluti
"dreamina-seedance-2-5-260628": {
"480p": {"min": 409_600, "max": 8_295_044},
"720p": {"min": 409_600, "max": 8_295_044},
"1080p": {"min": 409_600, "max": 8_295_044},
},
}

Expand Down
49 changes: 49 additions & 0 deletions comfy_api_nodes/apis/fishaudio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from pydantic import BaseModel, Field


class FishAudioProsody(BaseModel):
speed: float = Field(1.0, description="Speaking rate multiplier, 0.5-2.0")
volume: float = Field(0.0, description="Volume adjustment in decibels")


class FishAudioTTSRequest(BaseModel):
text: str = Field(..., description="Text to synthesize")
reference_id: str | list[str] | None = Field(None, description="Voice model ID or list of IDs")
temperature: float = Field(0.7, description="Expressiveness, 0-1")
top_p: float = Field(0.7, description="Nucleus sampling diversity, (0, 1]")
prosody: FishAudioProsody = Field(..., description="Speed and volume adjustments")
normalize: bool = Field(True, description="Normalize numbers and text for English and Chinese")
format: str = Field("wav", description="Output audio format")


class FishAudioASRRequest(BaseModel):
language: str | None = Field(None, description="Optional ISO 639-1 language hint")
ignore_timestamps: bool = Field(True, description="Skip precise timestamp computation")


class FishAudioASRSegment(BaseModel):
text: str | None = Field(None, description="Segment text")
start: float | None = Field(None, description="Segment start time in seconds")
end: float | None = Field(None, description="Segment end time in seconds")


class FishAudioASRResponse(BaseModel):
text: str | None = Field(None, description="Transcribed text")
duration: float | None = Field(None, description="Audio duration in seconds")
segments: list[FishAudioASRSegment] | None = Field(None, description="Timestamped transcript segments")
language_code: str | None = Field(None, description="Detected language as ISO 639-1 code")
language: str | None = Field(None, description="Detected language display name")


class FishAudioCreateModelRequest(BaseModel):
type: str = Field("tts", description="Model type")
title: str = Field(..., description="Voice model name")
train_mode: str = Field("fast", description="Training mode; fast is instantly available")
visibility: str = Field("private", description="Model visibility")
enhance_audio_quality: bool = Field(..., description="Enhance reference audio quality")


class FishAudioCreateModelResponse(BaseModel):
id: str = Field(..., alias="_id", description="Voice model ID for use as reference_id")
state: str | None = Field(None, description="Training state")
visibility: str | None = Field(None, description="Model visibility")
22 changes: 0 additions & 22 deletions comfy_api_nodes/nodes_bfl.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import math

import torch
from pydantic import BaseModel
from typing_extensions import override

from comfy_api.latest import IO, ComfyExtension, Input
Expand Down Expand Up @@ -588,16 +587,12 @@ async def execute(
),
)

def price_extractor(_r: BaseModel) -> float | None:
return None if initial_response.cost is None else initial_response.cost / 100

response = await poll_op(
cls,
ApiEndpoint(initial_response.polling_url),
response_model=BFLFluxStatusResponse,
status_extractor=lambda r: r.status,
progress_extractor=lambda r: r.progress,
price_extractor=price_extractor,
completed_statuses=[BFLStatus.ready],
failed_statuses=[
BFLStatus.request_moderated,
Expand Down Expand Up @@ -669,16 +664,12 @@ async def execute(
),
)

def price_extractor(_r: BaseModel) -> float | None:
return None if initial_response.cost is None else initial_response.cost / 100

response = await poll_op(
cls,
ApiEndpoint(initial_response.polling_url),
response_model=BFLFluxStatusResponse,
status_extractor=lambda r: r.status,
progress_extractor=lambda r: r.progress,
price_extractor=price_extractor,
completed_statuses=[BFLStatus.ready],
failed_statuses=[
BFLStatus.request_moderated,
Expand Down Expand Up @@ -802,16 +793,12 @@ async def execute(
),
)

def price_extractor(_r: BaseModel) -> float | None:
return None if initial_response.cost is None else initial_response.cost / 100

response = await poll_op(
cls,
ApiEndpoint(initial_response.polling_url),
response_model=BFLFluxStatusResponse,
status_extractor=lambda r: r.status,
progress_extractor=lambda r: r.progress,
price_extractor=price_extractor,
completed_statuses=[BFLStatus.ready],
failed_statuses=[
BFLStatus.request_moderated,
Expand Down Expand Up @@ -994,16 +981,12 @@ async def execute(
),
)

def price_extractor(_r: BaseModel) -> float | None:
return None if initial_response.cost is None else initial_response.cost / 100

response = await poll_op(
cls,
ApiEndpoint(initial_response.polling_url),
response_model=BFLFluxStatusResponse,
status_extractor=lambda r: r.status,
progress_extractor=lambda r: r.progress,
price_extractor=price_extractor,
completed_statuses=[BFLStatus.ready],
failed_statuses=[
BFLStatus.request_moderated,
Expand Down Expand Up @@ -1171,17 +1154,12 @@ async def _flux3_execute(cls: type[IO.ComfyNode], request: Flux3VideoRequest) ->
response_model=BFLFluxProGenerateResponse,
data=request,
)

def price_extractor(_r: BaseModel) -> float | None:
return None if initial_response.cost is None else initial_response.cost / 100

response = await poll_op(
cls,
ApiEndpoint(initial_response.polling_url),
response_model=BFLFluxStatusResponse,
status_extractor=lambda r: r.status,
progress_extractor=lambda r: r.progress,
price_extractor=price_extractor,
completed_statuses=[BFLStatus.ready],
failed_statuses=[
BFLStatus.request_moderated,
Expand Down
Loading
Loading