feat: release V3.5.0
This commit is contained in:
+170
-1
@@ -6,12 +6,26 @@ import torch
|
||||
|
||||
from ..constants import FPS
|
||||
from ..driving_audio import prepare_driving_audio_source
|
||||
from ..hardening import diagnostics_is_full
|
||||
from ..reference_video import (
|
||||
REFERENCE_VIDEO_SIZE_EFFICIENT,
|
||||
REFERENCE_VIDEO_SIZE_OPTIONS,
|
||||
)
|
||||
from ..v2.decoder import enforce_total_frames
|
||||
from .assembly import H3ContinuumAssembleSeamExperimental
|
||||
from .assembly import (
|
||||
H3ContinuumAssembleSeamExperimental,
|
||||
_chunk_list,
|
||||
_singleton,
|
||||
)
|
||||
from .assembly_v35 import (
|
||||
BUFFER_BACKEND_AUTO,
|
||||
BUFFER_BACKEND_OPTIONS,
|
||||
assemble_decoded_chunks_v35,
|
||||
)
|
||||
from .memory_attribution import (
|
||||
format_assembly_projection,
|
||||
project_assembly_buffers,
|
||||
)
|
||||
from .nodes import CATEGORY as CONTINUUM_CATEGORY, H3ContinuumSamplerProduction
|
||||
|
||||
|
||||
@@ -136,6 +150,7 @@ class H3ContinuumSamplerV34(H3ContinuumSamplerProduction):
|
||||
audio_vae=None,
|
||||
reference_video_1=None,
|
||||
video_reference_size=REFERENCE_VIDEO_SIZE_EFFICIENT,
|
||||
capture_refine_context=False,
|
||||
**kwargs,
|
||||
):
|
||||
from ..reference_video import prepare_reference_video_source
|
||||
@@ -165,6 +180,7 @@ class H3ContinuumSamplerV34(H3ContinuumSamplerProduction):
|
||||
driving_audio_source=source,
|
||||
driving_audio_vae=audio_vae,
|
||||
reference_video_source=reference_video_source,
|
||||
capture_refine_context=bool(capture_refine_context),
|
||||
**kwargs,
|
||||
)
|
||||
selected_audio = _copy_audio(source.source_audio) if source is not None else None
|
||||
@@ -172,9 +188,46 @@ class H3ContinuumSamplerV34(H3ContinuumSamplerProduction):
|
||||
assembly_plan = dict(outputs[2])
|
||||
assembly_plan[_DRIVING_AUDIO_PLAN_KEY] = _copy_audio(selected_audio)
|
||||
outputs = (*outputs[:2], assembly_plan, *outputs[3:])
|
||||
if bool(capture_refine_context):
|
||||
return (*outputs[:4], selected_audio, outputs[4])
|
||||
return (*outputs, selected_audio)
|
||||
|
||||
|
||||
class H3ContinuumSamplerV35(H3ContinuumSamplerV34):
|
||||
"""V3.5 sampler with a physical-group First Pass refine context output."""
|
||||
|
||||
DEPRECATED = False
|
||||
CATEGORY = CONTINUUM_CATEGORY
|
||||
DESCRIPTION = (
|
||||
"H3 Continuum V3.5 sampler. It preserves the V3.4 outputs and adds one "
|
||||
"physical-group refine context for context-aware Hi-Res Fix or an "
|
||||
"external latent Second Pass."
|
||||
)
|
||||
SEARCH_ALIASES = [
|
||||
"H3 Continuum Sampler V3.5",
|
||||
"MiniMax H3 context-aware Hi-Res Fix",
|
||||
]
|
||||
RETURN_TYPES = (
|
||||
*H3ContinuumSamplerV34.RETURN_TYPES,
|
||||
"H3_CONTINUUM_REFINE_CONTEXT",
|
||||
)
|
||||
RETURN_NAMES = (
|
||||
*H3ContinuumSamplerV34.RETURN_NAMES,
|
||||
"refine_context",
|
||||
)
|
||||
OUTPUT_IS_LIST = (*H3ContinuumSamplerV34.OUTPUT_IS_LIST, False)
|
||||
|
||||
def run(self, *args, **kwargs):
|
||||
kwargs.pop("capture_refine_context", None)
|
||||
kwargs.pop("memory_attribution", None)
|
||||
return super().run(
|
||||
*args,
|
||||
capture_refine_context=True,
|
||||
memory_attribution=True,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
||||
class H3ContinuumAssembleSeamV34(H3ContinuumAssembleSeamExperimental):
|
||||
"""Assemble decoded chunks and select original Driving Audio when connected."""
|
||||
|
||||
@@ -239,12 +292,128 @@ class H3ContinuumAssembleSeamV34(H3ContinuumAssembleSeamExperimental):
|
||||
return images, selected, report
|
||||
|
||||
|
||||
def _assembly_argument(args, kwargs, name, index):
|
||||
if name in kwargs:
|
||||
return kwargs[name]
|
||||
if len(args) > index:
|
||||
return args[index]
|
||||
return None
|
||||
|
||||
|
||||
def _insert_projection_report(report, line):
|
||||
lines = str(report).splitlines()
|
||||
for index, value in enumerate(lines):
|
||||
if value.startswith("Memory [assemble preflight]"):
|
||||
lines.insert(index + 1, line)
|
||||
return "\n".join(lines)
|
||||
lines.append(line)
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
class H3ContinuumAssembleSeamV35(H3ContinuumAssembleSeamV34):
|
||||
"""Independent V3.5 direct-write assembly with selectable IMAGE storage."""
|
||||
|
||||
DEPRECATED = False
|
||||
CATEGORY = CONTINUUM_CATEGORY
|
||||
DESCRIPTION = (
|
||||
"V3.5 decoded-chunk assembler with Auto, RAM, or Disk-backed IMAGE "
|
||||
"storage, direct Exact Duration writes, and small-patch Video Seam."
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def INPUT_TYPES(cls):
|
||||
schema = super().INPUT_TYPES()
|
||||
required = dict(schema["required"])
|
||||
diagnostics = required.pop("diagnostics")
|
||||
required["buffer_backend"] = (
|
||||
BUFFER_BACKEND_OPTIONS,
|
||||
{
|
||||
"default": BUFFER_BACKEND_AUTO,
|
||||
"display_name": "Buffer Backend",
|
||||
"tooltip": (
|
||||
"Auto keeps outputs up to 4 GiB in RAM only when physical "
|
||||
"memory has a safety reserve; otherwise it maps the final "
|
||||
"IMAGE to disk. Manual RAM and Disk-backed remain available."
|
||||
),
|
||||
},
|
||||
)
|
||||
required["diagnostics"] = diagnostics
|
||||
schema["required"] = required
|
||||
return schema
|
||||
|
||||
def assemble(
|
||||
self,
|
||||
images,
|
||||
audio,
|
||||
assembly_plan,
|
||||
exact_total_duration,
|
||||
audio_seam,
|
||||
video_seam,
|
||||
buffer_backend,
|
||||
diagnostics,
|
||||
driving_audio=None,
|
||||
):
|
||||
image_chunks = _chunk_list(images)
|
||||
audio_chunks = _chunk_list(audio)
|
||||
plan = _singleton(assembly_plan, "assembly_plan")
|
||||
exact = bool(_singleton(exact_total_duration, "exact_total_duration"))
|
||||
audio_seam_mode = str(_singleton(audio_seam, "audio_seam"))
|
||||
video_seam_mode = str(_singleton(video_seam, "video_seam"))
|
||||
backend = str(_singleton(buffer_backend, "buffer_backend"))
|
||||
diagnostics_mode = str(_singleton(diagnostics, "diagnostics"))
|
||||
preserved_audio = _copy_audio(plan.get(_DRIVING_AUDIO_PLAN_KEY))
|
||||
selected_audio = preserved_audio or _copy_audio(driving_audio)
|
||||
selected_audio_source = None
|
||||
if selected_audio is not None:
|
||||
selected_audio_source = (
|
||||
"assembly plan" if preserved_audio is not None else "direct input"
|
||||
)
|
||||
projection_line = None
|
||||
if diagnostics_is_full(diagnostics_mode):
|
||||
try:
|
||||
projection = project_assembly_buffers(
|
||||
images=image_chunks,
|
||||
audio=audio_chunks,
|
||||
assembly_plan=plan,
|
||||
exact_total_duration=exact,
|
||||
)
|
||||
projection_line = format_assembly_projection(projection) + (
|
||||
"; V3.5 Exact Duration IMAGE write=direct; "
|
||||
"additional final IMAGE copy=no"
|
||||
)
|
||||
except Exception as exc:
|
||||
projection_line = (
|
||||
"Projected assembly buffers [V3.5]: unavailable "
|
||||
f"({type(exc).__name__}: {exc})"
|
||||
)
|
||||
|
||||
result_images, result_audio, report = assemble_decoded_chunks_v35(
|
||||
images=image_chunks,
|
||||
audio=audio_chunks,
|
||||
assembly_plan=plan,
|
||||
exact_total_duration=exact,
|
||||
audio_seam=audio_seam_mode,
|
||||
video_seam=video_seam_mode,
|
||||
diagnostics=diagnostics_mode,
|
||||
buffer_backend=backend,
|
||||
final_audio_override=selected_audio,
|
||||
final_audio_source=selected_audio_source,
|
||||
)
|
||||
if projection_line is not None:
|
||||
report = _insert_projection_report(report, projection_line)
|
||||
return result_images, result_audio, report
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"H3ContinuumSamplerV34": H3ContinuumSamplerV34,
|
||||
"H3ContinuumSamplerV35": H3ContinuumSamplerV35,
|
||||
"H3ContinuumAssembleSeamV34": H3ContinuumAssembleSeamV34,
|
||||
"H3ContinuumAssembleSeamV35": H3ContinuumAssembleSeamV35,
|
||||
}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {
|
||||
"H3ContinuumSamplerV34": "H3 Continuum Sampler V3.4",
|
||||
"H3ContinuumSamplerV35": "H3 Continuum Sampler V3.5",
|
||||
"H3ContinuumAssembleSeamV34": "H3 Continuum Assemble + Seam V3.4",
|
||||
"H3ContinuumAssembleSeamV35": "H3 Continuum Assemble + Seam V3.5",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user