Files
olivv-cs-ComfyUI-FunPack/__init__.py
T
digital-garbageandClaude Sonnet 4.6 5d5b171c7f Add FunPack Distilled Flow Sampler for few-step distilled models
New sampler targeting LTX2.3 distilled LoRA and similar 4-8 step
flow-matching distilled video models. Three improvements over plain Euler:

Adams-Bashforth 2-step multistep (order=2, default):
Extrapolates the denoised direction from two consecutive steps using
variable-step-size AB2 coefficients: (1 + r/2) * d_curr - (r/2) * d_prev
where r = h_current / h_previous. Gives second-order accuracy across the
large sigma jumps typical of distilled schedules at zero extra model-call cost.

Heun predictor-corrector on final steps (final_correction_steps=1, default):
Replaces the last N steps with a Heun pass: Euler predictor to sigma_next,
second model call at sigma_next for the corrector direction, averaged update.
Costs one extra model call per corrected step and significantly improves
sharpness and detail in the steps that define the final output.
Multistep history is invalidated after each Heun step.

Optional s_noise (default 0.0 = deterministic):
Small ancestral-style noise injection (scaled by sigma_up) for diversity.
Distilled models are trained as pure ODE; any non-zero value is an
intentional deviation. Keep below 0.15 if used at all.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 18:42:58 +03:00

113 lines
4.5 KiB
Python

# ComfyUI-FunPack/__init__.py
if __package__:
from .conditioning import (
FunPackLorebookEnhancer,
FunPackPromptCombiner,
FunPackPromptEnhancer,
FunPackStoryWriter,
FunPackVideoRefinerV2,
)
from .image_processing import (
FunPackClipVisionOutputCombine,
FunPackContinueVideo,
FunPackStoryMemKeyframeExtractor,
FunPackStoryMemLastFrameExtractor,
FunPackVideoStitch,
)
from .model_management import FunPackApplyLoraWeights, FunPackLoraLoader
from .samplers import FunPackHybridEuler2SSampler, FunPackDistilledFlowSampler
from .context_transition import FunPackContextTransitionWindows
from .templates import FunPackRefinementKeyLoader, FunPackSceneBuilder
else:
# Standalone tests may not have the full ComfyUI/CUDA runtime loaded.
from conditioning import (
FunPackLorebookEnhancer,
FunPackPromptCombiner,
FunPackPromptEnhancer,
FunPackStoryWriter,
FunPackVideoRefinerV2,
)
try:
from image_processing import (
FunPackClipVisionOutputCombine,
FunPackContinueVideo,
FunPackStoryMemKeyframeExtractor,
FunPackStoryMemLastFrameExtractor,
FunPackVideoStitch,
)
except Exception:
FunPackClipVisionOutputCombine = None
FunPackContinueVideo = None
FunPackStoryMemKeyframeExtractor = None
FunPackStoryMemLastFrameExtractor = None
FunPackVideoStitch = None
try:
from model_management import FunPackApplyLoraWeights, FunPackLoraLoader
except Exception:
FunPackApplyLoraWeights = None
FunPackLoraLoader = None
try:
from samplers import FunPackHybridEuler2SSampler, FunPackDistilledFlowSampler
except Exception:
FunPackHybridEuler2SSampler = None
FunPackDistilledFlowSampler = None
try:
from context_transition import FunPackContextTransitionWindows
except Exception:
FunPackContextTransitionWindows = None
try:
from templates import FunPackRefinementKeyLoader, FunPackSceneBuilder
except Exception:
FunPackRefinementKeyLoader = None
FunPackSceneBuilder = None
WEB_DIRECTORY = "./web"
NODE_CLASS_MAPPINGS = {
"FunPackPromptCombiner": FunPackPromptCombiner,
"FunPackStoryMemKeyframeExtractor": FunPackStoryMemKeyframeExtractor,
"FunPackStoryMemLastFrameExtractor": FunPackStoryMemLastFrameExtractor,
"FunPackPromptEnhancer": FunPackPromptEnhancer,
"FunPackStoryWriter": FunPackStoryWriter,
"FunPackVideoStitch": FunPackVideoStitch,
"FunPackClipVisionOutputCombine": FunPackClipVisionOutputCombine,
"FunPackContinueVideo": FunPackContinueVideo,
"FunPackLorebookEnhancer": FunPackLorebookEnhancer,
"FunPackVideoRefinerV2": FunPackVideoRefinerV2,
"FunPackHybridEuler2SSampler": FunPackHybridEuler2SSampler,
"FunPackDistilledFlowSampler": FunPackDistilledFlowSampler,
"FunPackContextTransitionWindows": FunPackContextTransitionWindows,
"FunPackApplyLoraWeights": FunPackApplyLoraWeights,
"FunPackLoraLoader": FunPackLoraLoader,
"FunPackRefinementKeyLoader": FunPackRefinementKeyLoader,
"FunPackSceneBuilder": FunPackSceneBuilder,
}
NODE_CLASS_MAPPINGS = {name: cls for name, cls in NODE_CLASS_MAPPINGS.items() if cls is not None}
NODE_DISPLAY_NAME_MAPPINGS = {
"FunPackPromptCombiner": "FunPack Prompt Combiner",
"FunPackStoryMemKeyframeExtractor": "FunPack StoryMem Keyframe Extractor",
"FunPackStoryMemLastFrameExtractor": "FunPack StoryMem Last Frame Extractor",
"FunPackPromptEnhancer": "FunPack Prompt Enhancer (Standalone)",
"FunPackStoryWriter": "FunPack Story Writer",
"FunPackVideoStitch": "FunPack Video Stitch",
"FunPackClipVisionOutputCombine": "FunPack CLIP Vision Output Combine",
"FunPackContinueVideo": "FunPack Continue Video",
"FunPackLorebookEnhancer": "FunPack Lorebook Enhancer",
"FunPackVideoRefinerV2": "FunPack Video Refiner V2",
"FunPackHybridEuler2SSampler": "FunPack Hybrid Euler 2S Sampler",
"FunPackDistilledFlowSampler": "FunPack Distilled Flow Sampler",
"FunPackContextTransitionWindows": "FunPack Context Transition Windows",
"FunPackApplyLoraWeights": "FunPack Apply LoRA Weights",
"FunPackLoraLoader": "FunPack LoRA Loader",
"FunPackRefinementKeyLoader": "FunPack Refinement Key Loader",
"FunPackSceneBuilder": "FunPack Scene Builder",
}
__all__ = [
"NODE_CLASS_MAPPINGS",
"NODE_DISPLAY_NAME_MAPPINGS",
"WEB_DIRECTORY",
]