Skip to content

Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.

chore: merge origin/main into feat/tweaks-fixes-compendium-04

Josh Corbette24c4d47bb28
diff --cc invokeai/frontend/webv2/src/features/video/core/types.ts
index 964b1b6ffa,2c522a8714..cf0347bf59
--- a/invokeai/frontend/webv2/src/features/video/core/types.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/types.ts
@@@ -119,22 -172,42 +119,29 @@@ export interface VideoSettings
/** Guidance for the low-noise half of a Wan A14B schedule; null reuses `cfgScale`. */
cfgScaleLowNoise: number | null;
/**
- * LTX-2 guides its audio stream separately from its video, and far harder
- * (the release uses 7 against video's 3). Null on a family with one guidance
- * scale, the way `cfgScaleLowNoise` is null outside Wan A14B.
+ * LTX-2 guides audio separately from video and far harder (7 against 3). Null on a family with one guidance
+ * scale, like `cfgScaleLowNoise` outside Wan A14B.
*/
audioCfgScale: number | null;
- /**
- * LTX-2 spatio-temporal guidance: steers away from a pass whose self-attention
- * is skipped in one transformer block, which sharpens motion. 0 turns it off
- * and saves a forward per step. Null on families without it.
- */
+ /** LTX-2 spatio-temporal guidance; 0 turns it off and saves a forward per step. Null on families without it. */
stgScale: number | null;
- /**
- * LTX-2 modality-isolation guidance: steers away from a pass with the
- * audio/video cross-attention disabled, tightening the two streams'
- * agreement. 1 turns it off. Null on families without it.
- */
+ /** LTX-2 modality-isolation guidance; 1 turns it off. Null on families without it. */
modalityScale: number | null;
/**
- * The family's distillation fast path: the Lightning LoRA pair at 4 steps /
- * CFG 1 for Wan A14B, the Turbo LoRA at 6 steps for MiniMax H3. Toggling it
- * patches steps/CFG and the `loras` list — see `getAcceleratorToggleResult`
- * — so the flag records intent, not hidden state.
+ * Acceleration patches visible sampling settings and LoRAs; this flag records intent rather than hidden graph
+ * state.
*/
+ /**
+ * Frames of the source an LTX-2 continuation opens with, held clean so the model reads the clip's
+ * motion rather than just its last still. On the VAE's 8k + 1 grid, and it is spent twice over:
+ * the generation reproduces these frames, and the join then crossfades exactly them out of both
+ * halves — so raising it costs new material one frame for one against a fixed Frames budget.
+ */
+ ltx2ExtendContextFrames: number;
acceleratorEnabled: boolean;
/**
- * The keys of the LoRA entries the accelerator toggle added. Turning the
- * fast path off (or switching families) removes exactly these — never a
- * user's own LoRA that happens to be named like one — and the enabled flag
- * cannot outlive them.
+ * Track exactly the toggle-added LoRA keys for removal; never remove matching user-owned entries, and clear
+ * enabled intent if they disappear.
*/
acceleratorLoraKeys: string[];
seed: number;
diff --cc invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
index de4cd0f314,666ea652d0..4384ce6489
--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts
@@@ -372,9 -380,353 +379,352 @@@ describe('Lightning', () =>
});
});
+ describe('LTX-2 extend context control', () => {
+ const model = ltx2('ltx2_dev');
+ const extendSettings = (overrides: Partial<VideoSettings> = {}) => ({
+ ...getDefaultVideoSettings(model, []),
+ sourceVideo: {
+ endFrame: 200,
+ fps: 24,
+ height: 704,
+ numFrames: 201,
+ startFrame: 0,
+ video_name: 's.mp4',
+ width: 1248,
+ },
+ ...overrides,
+ });
+
+ it('offers the control only in extend mode, with a source to size it against', () => {
+ // The ceiling is a property of the SOURCE's pixels -- the join blends at the clip's own
+ // resolution, not the generation canvas -- so without a clip there is nothing to bound.
+ expect(getVideoModelPolicy(model, extendSettings()).ui.extendContext).not.toBeNull();
+ expect(getVideoModelPolicy(model, getDefaultVideoSettings(model, [])).ui.extendContext).toBeNull();
+ expect(getVideoModelPolicy(wanModel('i2v_a14b'), extendSettings()).ui.extendContext).toBeNull();
+ });
+
+ it('bounds the control by what the join can afford for THIS source', () => {
+ // video_concat buffers the crossfade at the source's native resolution and refuses over
+ // 512 MiB, so a larger clip affords a shorter context. Without a live bound the user could set
+ // a value refused only at enqueue -- after both encodes and the transformer have run.
+ const hd = getVideoModelPolicy(model, extendSettings()).ui.extendContext;
+ const uhd = getVideoModelPolicy(
+ model,
+ extendSettings({
+ sourceVideo: {
+ endFrame: 200,
+ fps: 24,
+ height: 2160,
+ numFrames: 201,
+ startFrame: 0,
+ video_name: 's.mp4',
+ width: 3840,
+ },
+ })
+ ).ui.extendContext;
+
+ expect(hd?.max ?? 0).toBeGreaterThan(LTX2_EXTEND_CONTEXT_FRAMES);
+ // 4K cannot blend even the smallest usable context; 0 is the panel's "not extendable" signal.
+ expect(uhd).toMatchObject({ max: 0 });
+ });
+
+ it('reports the new material left after the join consumes the context', () => {
+ // output = source + numFrames - context, so every held frame costs a frame of new video. That
+ // trade is invisible in Frames alone, which is why the control states it.
+ const at17 = getVideoModelPolicy(model, extendSettings({ numFrames: 121 })).ui.extendContext;
+ const at49 = getVideoModelPolicy(model, extendSettings({ ltx2ExtendContextFrames: 49, numFrames: 121 })).ui
+ .extendContext;
+
+ expect(at17).toMatchObject({ newFrames: 104 });
+ expect(at49).toMatchObject({ newFrames: 72 });
+ });
+
+ it('refuses a context the source cannot afford, naming what would fit', () => {
+ // Not reachable by dragging (the control is bounded), but a recalled or stored value can carry
+ // a context made for a smaller source.
+ const reasons = getVideoValidationReasons(
+ model,
+ extendSettings({
+ ltx2ExtendContextFrames: 97,
+ sourceVideo: {
+ endFrame: 200,
+ fps: 24,
+ height: 1440,
+ numFrames: 201,
+ startFrame: 0,
+ video_name: 's.mp4',
+ width: 2560,
+ },
+ })
+ );
+
+ expect(reasons.join(' ')).toMatch(/Context Frames is 97/);
+ });
+
+ it('refuses a trim that keeps fewer frames than the join will blend', () => {
+ const reasons = getVideoValidationReasons(
+ model,
+ extendSettings({
+ ltx2ExtendContextFrames: 49,
+ sourceVideo: {
+ endFrame: 20,
+ fps: 24,
+ height: 704,
+ numFrames: 201,
+ startFrame: 0,
+ video_name: 's.mp4',
+ width: 1248,
+ },
+ })
+ );
+
+ expect(reasons.join(' ')).toMatch(/keeps only 21/);
+ });
+
+ it('snaps a stored off-grid value onto the VAE grid', () => {
+ // The node snaps a ragged request DOWN silently, so an unsnapped setting would leave the panel
+ // showing a count the run did not use.
+ expect(normalizeVideoSettings({ ...extendSettings(), ltx2ExtendContextFrames: 24 })).toMatchObject({
+ ltx2ExtendContextFrames: 17,
+ });
+ expect(normalizeVideoSettings({ ...extendSettings(), ltx2ExtendContextFrames: 3 })).toMatchObject({
+ ltx2ExtendContextFrames: 9,
+ });
+ });
+ });
+
+ describe('LTX-2 distilled accelerator', () => {
+ const DISTILLED = { base: 'ltx-2', key: 'ltx2-distilled', name: 'LTX-2.5 Distilled LoRA', type: 'lora' as const };
+ const STYLE = { base: 'ltx-2', key: 'ltx2-style', name: 'LTX-2 Painterly', type: 'lora' as const };
+
+ it('finds the distilled LoRA and ignores other families and other LTX-2 LoRAs', () => {
+ expect(findLtx2DistilledLora([STYLE, DISTILLED])).toMatchObject({ key: 'ltx2-distilled' });
+ expect(findLtx2DistilledLora([STYLE])).toBeNull();
+ // A distillation LoRA for a different architecture must not satisfy the LTX-2 slot.
+ expect(findLtx2DistilledLora([{ base: 'wan', key: 'w', name: 'Wan Distilled', type: 'lora' as const }])).toBeNull();
+ });
+
+ it('turns the whole guided recipe off, not just the step count', () => {
+ // The distillation retrains the model to predict the clean sample directly. Cutting steps to 8
+ // while still paying for CFG, STG and modality guidance samples off the distribution it was
+ // fitted to -- the failure looks like a broken model, not like a slow one.
+ const model = ltx2('ltx2_dev');
+ const settings = getDefaultVideoSettings(model, []);
+ const result = getAcceleratorToggleResult(settings, model, [DISTILLED], true);
+
+ expect(result.missingLoras).toBe(false);
+ expect(result.settings).toMatchObject({
+ acceleratorEnabled: true,
+ acceleratorLoraKeys: ['ltx2-distilled'],
+ audioCfgScale: 1,
+ cfgScale: 1,
+ modalityScale: 1,
+ steps: 8,
+ stgScale: 0,
+ });
+ });
+
+ it('puts the guided recipe back when switched off', () => {
+ const model = ltx2('ltx2_dev');
+ const on = getAcceleratorToggleResult(getDefaultVideoSettings(model, []), model, [DISTILLED], true).settings;
+ const off = getAcceleratorToggleResult(on, model, [DISTILLED], false).settings;
+
+ expect(off).toMatchObject({
+ acceleratorEnabled: false,
+ acceleratorLoraKeys: [],
+ audioCfgScale: 7,
+ cfgScale: 3,
+ modalityScale: 3,
+ steps: 30,
+ stgScale: 1,
+ });
+ expect(off.loras).toEqual([]);
+ });
+
+ it('hides the negative prompt once guidance is gone, like the distilled checkpoint', () => {
+ // The accelerator drives every scale to identity, so the negative prompt stops being used --
+ // but LTX-2 is the only family that pre-fills it, so leaving it on screen shows a populated box
+ // full of terms that silently do nothing, under a CFG of 1 the user never typed.
+ const model = ltx2('ltx2_dev');
+ const guided = getVideoPromptPolicy(model, {
+ acceleratorEnabled: false,
+ audioCfgScale: 7,
+ cfgScale: 3,
+ cfgScaleLowNoise: null,
+ negativePromptEnabled: true,
+ wanLowNoiseModel: null,
+ });
+ const accelerated = getVideoPromptPolicy(model, {
+ acceleratorEnabled: true,
+ audioCfgScale: 1,
+ cfgScale: 1,
+ cfgScaleLowNoise: null,
+ negativePromptEnabled: true,
+ wanLowNoiseModel: null,
+ });
+
+ expect(guided).toMatchObject({ negativeUsedInGraph: true, negativeVisible: true });
+ expect(accelerated).toMatchObject({ negativeUsedInGraph: false, negativeVisible: false });
+ // The same shape the distilled checkpoint presents, which is the model an accelerated Dev is.
+ expect(accelerated.negativeVisible).toBe(
+ getVideoPromptPolicy(ltx2('ltx2_distilled'), {
+ acceleratorEnabled: false,
+ audioCfgScale: null,
+ cfgScale: 1,
+ cfgScaleLowNoise: null,
+ negativePromptEnabled: true,
+ wanLowNoiseModel: null,
+ }).negativeVisible
+ );
+ });
+
+ it('stops offering every control the distilled path would ignore', () => {
+ // The graph sends `schedule: 'distilled'` whenever the accelerator is on, and the backend then
+ // DISCARDS the guidance scales and the step count (`_resolve_guidance` and the step clamp both
+ // log that they are ignoring what was asked). Leaving those scrubbers editable would let a user
+ // set a value, see it accepted, and get a run that silently used something else.
+ const model = ltx2('ltx2_dev');
+ const guided = getVideoModelPolicy(model, getDefaultVideoSettings(model, []));
+ const accelerated = getVideoModelPolicy(model, {
+ ...getDefaultVideoSettings(model, []),
+ acceleratorEnabled: true,
+ });
+
+ expect(guided.ui).toMatchObject({
+ audioCfgVisible: true,
+ cfgVisible: true,
+ modalityVisible: true,
+ stepsEditable: true,
+ stgVisible: true,
+ });
+ expect(accelerated.ui).toMatchObject({
+ audioCfgVisible: false,
+ cfgVisible: false,
+ modalityVisible: false,
+ stepsEditable: false,
+ stgVisible: false,
+ });
+ // Same presentation the distilled checkpoint gives, which is the model this now is.
+ const checkpoint = getVideoModelPolicy(ltx2('ltx2_distilled'), getDefaultVideoSettings(ltx2('ltx2_distilled')));
+
+ expect(accelerated.ui.stepsEditable).toBe(checkpoint.ui.stepsEditable);
+ expect(accelerated.ui.cfgVisible).toBe(checkpoint.ui.cfgVisible);
+ expect(accelerated.prompt.negativeVisible).toBe(checkpoint.prompt.negativeVisible);
+ });
+
+ it('restores the whole recipe when the accelerator LoRA is disabled, not just steps and CFG', () => {
+ // Turning the accelerator off by unticking its LoRA in Concepts goes through a different path
+ // than the toggle. If that path restores only steps and CFG, the run is the undistilled Dev
+ // model with audio CFG, modality and STG still pinned at the accelerator's identity values --
+ // guided sampling with three quarters of its guidance off, and nothing says so.
+ const model = ltx2('ltx2_dev');
+ const on = getAcceleratorToggleResult(getDefaultVideoSettings(model, []), model, [DISTILLED], true).settings;
+ const disabled = on.loras.map((entry) => ({ ...entry, isEnabled: false }));
+ const result = getAcceleratorLoraChangeResult({ ...on, loras: disabled }, model, [DISTILLED], disabled);
+
+ expect(result.outcome).toBe('disabled');
+ expect(result.settings).toMatchObject({
+ acceleratorEnabled: false,
+ audioCfgScale: 7,
+ cfgScale: 3,
+ modalityScale: 3,
+ steps: 30,
+ stgScale: 1,
+ });
+ });
+
+ it('treats the negative prompt as unused even if a stale scale says otherwise', () => {
+ // The panel cannot produce this, but recall can: metadata carrying a guided CFG alongside the
+ // accelerator's LoRA set. The graph still sends `schedule: 'distilled'` whenever the toggle is
+ // on, and the backend discards the scale -- so the answer must follow the accelerator, not the
+ // stale number, or the panel claims a prompt is in use that the run throws away.
+ const policy = getVideoPromptPolicy(ltx2('ltx2_dev'), {
+ acceleratorEnabled: true,
+ audioCfgScale: 7,
+ cfgScale: 3,
+ cfgScaleLowNoise: null,
+ negativePromptEnabled: true,
+ wanLowNoiseModel: null,
+ });
+
+ expect(policy).toMatchObject({ negativeUsedInGraph: false, negativeVisible: false });
+ });
+
+ it('writes the guidance recipe when the accelerator LoRA is swapped for another', () => {
+ // The recorded LoRA is gone and a replacement is found, so the accelerator stays on under a
+ // different file. That path has to write the same recipe the toggle does, or the swap silently
+ // leaves guidance wherever it happened to be.
+ const model = ltx2('ltx2_dev');
+ const settings = {
+ ...getDefaultVideoSettings(model, []),
+ acceleratorEnabled: true,
+ acceleratorLoraKeys: ['a-release-that-is-gone'],
+ audioCfgScale: 7,
+ cfgScale: 3,
+ modalityScale: 3,
+ stgScale: 1,
+ };
+ // The distilled LoRA is present and on; the key the toggle recorded is not.
+ const present = [{ isEnabled: true, model: DISTILLED, weight: 1 }];
+ const result = getAcceleratorLoraChangeResult({ ...settings, loras: present }, model, [DISTILLED], present);
+
+ expect(result.outcome).toBe('switched');
+ expect(result.settings).toMatchObject({
+ acceleratorEnabled: true,
+ audioCfgScale: 1,
+ cfgScale: 1,
+ modalityScale: 1,
+ steps: 8,
+ stgScale: 0,
+ });
+ });
+
+ it('restores the whole recipe when the accelerator LoRA leaves the catalog entirely', () => {
+ // A different route than unticking it in Concepts: this one runs when the LoRA is deleted in
+ // Model Manager. It goes through `syncVideoWidgetValues`, which copies named fields out of the
+ // change result -- so a field the result restores but the copy does not name is silently lost,
+ // leaving a guided Dev run with its audio, STG and modality guidance pinned at identity.
+ const model = ltx2('ltx2_dev');
+ const on = getAcceleratorToggleResult(getDefaultVideoSettings(model, []), model, [DISTILLED], true).settings;
+ // The LoRA is gone from the catalog: only the main model remains.
+ const synced = syncVideoWidgetValuesWithModels({ ...on, loras: [], model }, [model]);
+
+ expect(synced).toMatchObject({
+ acceleratorEnabled: false,
+ audioCfgScale: 7,
+ cfgScale: 3,
+ modalityScale: 3,
+ steps: 30,
+ stgScale: 1,
+ });
+ });
+
+ it('leaves families whose accelerator keeps guidance alone', () => {
+ // Wan and H3 declare no guidance triple, so their accelerator drops CFG but does not make the
+ // run guidance-free -- their negative prompt stays visible, exactly as before.
+ const wan = getVideoPromptPolicy(wanModel('t2v_a14b'), {
+ acceleratorEnabled: true,
+ audioCfgScale: null,
+ cfgScale: 1,
+ cfgScaleLowNoise: null,
+ negativePromptEnabled: true,
+ wanLowNoiseModel: null,
+ });
+
+ expect(wan.negativeVisible).toBe(true);
+ });
+
+ it('is not offered on the distilled checkpoint, which already is the fast path', () => {
+ // Patching a distillation LoRA onto a model the distillation was not fitted to.
+ const policy = getVideoModelPolicy(ltx2('ltx2_distilled'), getDefaultVideoSettings(ltx2('ltx2_distilled')));
+
+ expect(policy.ui.accelerator).toBeNull();
+ });
+ });
+
describe('MiniMax H3 Turbo', () => {
const TURBO = { base: 'minimax-h3', key: 'turbo', name: 'MiniMax H3 Turbo LoRA', type: 'lora' as const };
- // The second installed Turbo LoRA: same family, a different step schedule,
- // and nothing but the org name in it to say so.
+ // Identify the alternative Turbo schedule from its organization naming.
const LIGHTX2V = {
base: 'minimax-h3',
key: 'lightx2v',
diff --cc invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
index 2fc5b99819,087d50fde0..fd69b806d5
--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts
@@@ -110,11 -117,16 +113,11 @@@ export interface VideoFpsPolicy
}
/**
- * The family's distillation fast path: which LoRA(s) it runs on and the
- * sampling parameters they were trained for. Wan A14B uses the Lightning
- * high/low pair; MiniMax H3 uses a single Turbo LoRA.
- *
- * `steps` is the count the family's reference LoRA was distilled for (the
- * bundled H3 templates assume the 6-step repack). Releases trained for a
- * different schedule are resolved per-LoRA by `getAcceleratorSteps`.
+ * Family accelerator LoRAs and sampling defaults. steps describes the reference release; getAcceleratorSteps
+ * resolves release-specific schedules.
*/
export interface VideoAcceleratorConfig {
- label: 'Lightning' | 'Turbo';
+ label: 'Lightning' | 'Turbo' | 'Distilled';
steps: number;
/**
* Step counts for releases whose names carry no "N-step" token. First match
@@@ -186,7 -208,30 +197,19 @@@ export const MINIMAX_H3_TURBO_ACCELERAT
stepOverrides: [{ pattern: LIGHTX2V_PATTERN, steps: 8 }],
};
+ /**
- * The LTX-2.5 step-distillation LoRA: 8 steps with no guidance, against the Dev transformer's ~30
- * guided ones. Rank 450 over all 1660 projections, so it is a heavy patch (~8.9 GB) rather than a
- * light touch, and it retrains the model to predict the clean sample directly — which is why every
- * guidance scale goes to its identity here rather than merely lower.
- *
- * `steps: 8` is stated rather than read from the file name: the release is called
- * `ltx-2.5-22b-distilled-lora-450`, where the only number is the rank.
++ * The LTX-2.5 step-distillation LoRA: 8 guidance-free steps against Dev's ~30 guided ones, so every guidance
++ * scale goes to its identity. `steps: 8` is stated because the release name only carries the rank (450).
+ */
+ export const LTX2_DISTILLED_ACCELERATOR: VideoAcceleratorConfig = {
+ cfgScale: 1,
+ cfgScaleLowNoise: null,
+ guidance: { audioCfgScale: 1, modalityScale: 1, stgScale: 0 },
+ label: 'Distilled',
+ steps: 8,
+ };
+
-/**
- * The Ref2VA-trained Turbo distillations. The reference count is the 4-step v0.1
- * repack's (Comfy-Org's ref2v turbo); the LightX2V 8-step v1.0 release that
- * superseded it — the starter model since 2026-09-07 — states its schedule via the
- * override, like its FL2VA sibling. v0.1 pans the camera rightward whenever a video
- * reference is conditioned on; v1.0 does not.
- */
+/** Ref2VA Turbo uses a four-step reference count; LightX2V releases override it to eight. */
export const MINIMAX_H3_REF2V_TURBO_ACCELERATOR: VideoAcceleratorConfig = {
cfgScale: 1,
cfgScaleLowNoise: null,
@@@ -695,7 -819,24 +764,22 @@@ export interface VideoModelPolicy
}
export const getVideoModelPolicy = (model: MainModelConfig | undefined, settings: VideoSettings): VideoModelPolicy => {
- // The H3 task (fl2va vs ref2va) lives on the selected model itself: a
- // single-file transformer checkpoint carries its own variant.
const config = getVideoConfig(model);
+ // With an accelerator that removes guidance, the backend ignores the scales and the step count
+ // outright, so the panel stops offering the controls it would ignore.
+ const guidanceDistilled = isGuidanceDistilled(config, settings);
+ // Offered only where it means something: LTX-2's extend mode, with a source picked. The ceiling
+ // is the source's, so it cannot be computed without one.
+ const extendContext =
+ model?.base === 'ltx-2' && resolveVideoMode(settings) === 'extend' && settings.sourceVideo
+ ? {
+ value: settings.ltx2ExtendContextFrames,
+ min: 1 + LTX2_NUM_FRAMES_STEP,
+ max: ltx2MaxExtendContextFrames(settings.sourceVideo.width, settings.sourceVideo.height),
+ step: LTX2_NUM_FRAMES_STEP,
+ newFrames: ltx2NewFramesForExtend(settings.numFrames, settings.ltx2ExtendContextFrames),
+ }
+ : null;
return {
aspectRatioOptions: getVideoAspectRatioOptions(model),
@@@ -712,8 -853,12 +796,8 @@@
targetResolutions: config.targetResolutions,
ui: {
accelerator: config.accelerator,
- audioCfgVisible: config.guidance.audioVisible,
+ audioCfgVisible: config.guidance.audioVisible && !guidanceDistilled,
- // The step count the help text quotes is the one the *running*
- // accelerator LoRA was distilled for — with the 8-step LightX2V Turbo
- // LoRA on, "6 steps" would be a lie. It is deliberately NOT folded into
- // `accelerator`: that stays the family config, so callers can keep using
- // it as the reference other counts are resolved against.
+ // Show the active LoRA's schedule while retaining accelerator as the family reference config.
acceleratorSteps: config.accelerator
? getAcceleratorSteps(config.accelerator, getRecordedAcceleratorLoras(settings))
: null,
@@@ -824,9 -1007,48 +911,45 @@@ export const findMiniMaxH3TurboLora =
};
/**
- * The complete accelerator LoRA set contained in `candidates`, or null when it
- * is not all there. The candidates are the installed catalog when asking what
- * the toggle *would* run, and the user's own Concepts list when asking what is
- * actually running. `model` must be the EFFECTIVE model: for MiniMax H3 the
- * task variant (fl2va vs ref2va) decides which Turbo distillation qualifies.
+ * Return a complete candidate accelerator set or null. Pass the effective model: its H3 task variant determines
+ * compatible Turbo releases.
*/
+ /**
+ * The LTX-2.5 step-distillation LoRA in a catalog, or null.
+ *
+ * Unlike the H3 and Wan families there is one release, and its name states its rank rather than its
+ * schedule (`ltx-2.5-22b-distilled-lora-450`), so matching keys on the word that names what it does.
+ * `requireFamilyName` exists for the same reason it does elsewhere: on a model switch the panel
+ * re-verifies a recorded accelerator, and a bare "distilled" in some other family's LoRA should not
+ * satisfy that check.
+ */
+ const LTX2_DISTILLED_PATTERN = /(?:^|[^a-z0-9])distill(?:ed|ation)?(?:[^a-z0-9]|$)/i;
+ const LTX2_NAME_PATTERN = /(?:^|[^a-z0-9])ltx[ _-]?2(?:\.\d)?(?:[^a-z0-9]|$)/i;
+
+ export const findLtx2DistilledLora = (
+ models: readonly ModelConfig[],
+ { requireFamilyName = false }: FindAcceleratorLoraOptions = {}
+ ): LoraModelConfig | null => {
+ const matches = models.filter(
+ (model): model is LoraModelConfig =>
+ isLoraModelConfig(model) &&
+ model.base === 'ltx-2' &&
+ LTX2_DISTILLED_PATTERN.test(model.name) &&
+ (!requireFamilyName || LTX2_NAME_PATTERN.test(model.name))
+ );
+
+ return (
+ matches
+ .slice()
+ // Family-named first, then a deterministic tie-break — there is no step count to rank on.
+ .sort(
+ (a, b) =>
+ Number(LTX2_NAME_PATTERN.test(b.name)) - Number(LTX2_NAME_PATTERN.test(a.name)) ||
+ a.name.localeCompare(b.name)
+ )[0] ?? null
+ );
+ };
+
export const findAcceleratorLorasIn = (
model: MainModelConfig,
candidates: readonly ModelConfig[],
@@@ -839,14 -1083,17 +984,15 @@@ const ACCELERATOR_FINDERS: Record
});
return turbo ? [turbo] : null;
- }
-
- const pair = findWanLightningLoraPair(candidates, model.variant, options);
+ },
+ wan: (candidates, model, options) => {
+ const pair = findWanLightningLoraPair(candidates, model.variant, options);
- return pair ? [pair.high, pair.low] : null;
+ return pair ? [pair.high, pair.low] : null;
+ },
};
-// "4-step", "8 steps", "6step" — how a distillation release states the schedule
-// it was trained for. Two digits at most, so a checkpoint tag ("step600") or a
-// rank cannot be read as a step count.
+// Limit schedule tokens to two digits so checkpoint tags such as step600 cannot become step counts.
const STEP_COUNT_PATTERN = /(?:^|[^a-z0-9])(\d{1,2})[ _-]?steps?(?:[^a-z0-9]|$)/i;
/** The schedule a distillation LoRA's name states, or 0 when it states none. */