Merge branch 'comfyanonymous:master' into master

This commit is contained in:
patientx 2024-12-18 12:33:32 +03:00 committed by GitHub
commit 947aba46c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 25 additions and 2 deletions

View File

@ -91,7 +91,7 @@ class Upsample(nn.Module):
def forward(self, x):
scale_factor = self.scale_factor
if not isinstance(scale_factor, tuple):
if isinstance(scale_factor, (int, float)):
scale_factor = (scale_factor,) * (x.ndim - 2)
if x.ndim == 5 and scale_factor[0] > 1.0:
@ -109,7 +109,7 @@ class Upsample(nn.Module):
else:
x = a
else:
x = interpolate_up(x, self.scale_factor)
x = interpolate_up(x, scale_factor)
if self.with_conv:
x = self.conv(x)
return x

View File

@ -8,6 +8,7 @@ import json
import struct
import random
import hashlib
import node_helpers
from comfy.cli_args import args
class EmptyLatentAudio:
@ -29,6 +30,27 @@ class EmptyLatentAudio:
latent = torch.zeros([batch_size, 64, length], device=self.device)
return ({"samples":latent, "type": "audio"}, )
class ConditioningStableAudio:
@classmethod
def INPUT_TYPES(s):
return {"required": {"positive": ("CONDITIONING", ),
"negative": ("CONDITIONING", ),
"seconds_start": ("FLOAT", {"default": 0.0, "min": 0.0, "max": 1000.0, "step": 0.1}),
"seconds_total": ("FLOAT", {"default": 47.0, "min": 0.0, "max": 1000.0, "step": 0.1}),
}}
RETURN_TYPES = ("CONDITIONING","CONDITIONING")
RETURN_NAMES = ("positive", "negative")
FUNCTION = "append"
CATEGORY = "conditioning"
def append(self, positive, negative, seconds_start, seconds_total):
positive = node_helpers.conditioning_set_values(positive, {"seconds_start": seconds_start, "seconds_total": seconds_total})
negative = node_helpers.conditioning_set_values(negative, {"seconds_start": seconds_start, "seconds_total": seconds_total})
return (positive, negative)
class VAEEncodeAudio:
@classmethod
def INPUT_TYPES(s):
@ -225,4 +247,5 @@ NODE_CLASS_MAPPINGS = {
"SaveAudio": SaveAudio,
"LoadAudio": LoadAudio,
"PreviewAudio": PreviewAudio,
"ConditioningStableAudio": ConditioningStableAudio,
}