An empty negative prompt now selects the release's structured negative caption with its time ranges set to the clip's duration, as the reference sampler does; a single space still gives the empty unconditional prompt. The serving config and cookbook now say guidance 2.5, matching the presets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
50 lines
1.5 KiB
Python
50 lines
1.5 KiB
Python
# SPDX-License-Identifier: Apache-2.0
|
|
"""Inference presets for PAN2 text-to-video and image-to-video."""
|
|
|
|
from fastvideo.api.presets import InferencePreset, PresetStageSpec
|
|
|
|
_DENOISE_STAGE = PresetStageSpec(
|
|
name="denoise",
|
|
kind="denoising",
|
|
description="PAN2 flow-matching denoising",
|
|
allowed_overrides=frozenset({"num_inference_steps", "guidance_scale"}),
|
|
)
|
|
|
|
# 704x1248, 313 frames (13 s at 24 fps), 50 steps, CFG 2.5 (the release launcher's default since ifm-ai/PAN2
|
|
# 86d5023, 2026-10-23; 3 before). The empty negative prompt selects the release's structured negative caption,
|
|
# rendered for the clip's duration by ``PAN2TextEncodingStage`` as in the reference sampler.
|
|
_SHARED_DEFAULTS = {
|
|
"height": 704,
|
|
"width": 1248,
|
|
"num_frames": 313,
|
|
"fps": 24,
|
|
"num_inference_steps": 50,
|
|
"guidance_scale": 2.5,
|
|
"negative_prompt": "",
|
|
}
|
|
|
|
PAN2_T2V = InferencePreset(
|
|
name="pan2_t2v",
|
|
version=1,
|
|
model_family="pan2",
|
|
description="PAN2 text-to-video",
|
|
workload_type="t2v",
|
|
stage_schemas=(_DENOISE_STAGE, ),
|
|
defaults=dict(_SHARED_DEFAULTS),
|
|
)
|
|
|
|
# The same pipeline runs image-to-video when the request carries a first frame (image_path).
|
|
PAN2_I2V = InferencePreset(
|
|
name="pan2_i2v",
|
|
version=1,
|
|
model_family="pan2",
|
|
description="PAN2 image-to-video from a first frame",
|
|
workload_type="i2v",
|
|
stage_schemas=(_DENOISE_STAGE, ),
|
|
defaults=dict(_SHARED_DEFAULTS),
|
|
)
|
|
|
|
ALL_PRESETS = (PAN2_T2V, PAN2_I2V)
|
|
|
|
__all__ = ["ALL_PRESETS", "PAN2_I2V", "PAN2_T2V"]
|