minimax redo video/audio shift

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-09-14 20:41:02 +02:00
parent 8691654bef
commit e4766f99dc
5 changed files with 29 additions and 10 deletions
+2
View File
@@ -49,6 +49,7 @@ Plus inevitable bug-fixes...
can significantly improve lora quality when using multiple loras at once
- per-block strength
- native support for **MiniMax**
see [MiniMax Turbo LoRA collection](https://huggingface.co/vladmandic/MiniMax-H3-Turbo-LoRA) for LoRAs and examples
- **DLSS**
- add DLSS support for: *NeuralRender, SuperSample and FrameGen*
dlls 5 caused quite a stir, but combined with generative ai it becomes a nice tool
@@ -107,6 +108,7 @@ Plus inevitable bug-fixes...
*note*: this may break compatibility with some legacy packages, so report any finidings
- **Other**
- video preview: TAESD support for **MiniMax**
- **minimax** video and audio shift are now dependent on steps instead of static
- support `xai grok` for prompt enhance workflows
*note*: requires grok api key
- remove `/redocs` as `/docs` are primary api docs
+2 -2
View File
@@ -29,8 +29,8 @@ def create_ui(prompt, _negative, styles, overrides, script_inputs, mp4_fps, mp4_
steps = gr.Slider(minimum=2, maximum=100, step=1, label="MiniMax steps", elem_id='minimax_steps', value=30)
frames = gr.Slider(label='MiniMax frames', minimum=22, maximum=362, step=17, value=124, elem_id='minimax_frames')
with gr.Row():
video_shift = gr.Slider(minimum=8.0, maximum=16.0, step=0.1, label="MiniMax video shift", elem_id='minimax_video_shift', value=12)
audio_shift = gr.Slider(minimum=1.5, maximum=6.0, step=0.1, label="MiniMax audio shift", elem_id='minimax_audio_shift', value=3)
video_shift = gr.Slider(minimum=0.05, maximum=0.95, step=0.05, value=0.40, label="MiniMax video shift", elem_id='minimax_video_shift')
audio_shift = gr.Slider(minimum=0.05, maximum=0.95, step=0.05, value=0.15, label="MiniMax audio shift", elem_id='minimax_audio_shift')
with gr.Row():
seed = gr.Number(label='Seed', value=-1, elem_id='minimax_seed', container=True)
random_seed = ToolButton(ui_symbols.random, elem_id='minimax_seed_random')
+2 -2
View File
@@ -145,8 +145,8 @@ def generate(task_id, _ui_state,
ops=['video'],
)
video_minimax.apply_overrides(p, shared.sd_model, still=False, audio=enable_audio, preview=enable_preview)
video_minimax.set_sampler_shift(shared.sd_model, video_shift=video_shift, audio_shift=audio_shift)
log.debug(f'Video: engine="{engine}" model="{model}" workflow={workflow} cls={shared.sd_model.__class__.__name__} audio={enable_audio} preview={enable_preview} shift={video_shift}:{audio_shift} kwargs={p.task_args}')
video_minimax.set_sampler_shift(shared.sd_model, steps=steps, video_shift=video_shift, audio_shift=audio_shift)
log.debug(f'Video: engine="{engine}" model="{model}" workflow={workflow} cls={shared.sd_model.__class__.__name__} audio={enable_audio} preview={enable_preview} kwargs={p.task_args}')
processing.fix_seed(p)
p.ops.append('video')
p.scripts = scripts_manager.scripts_video
+22 -5
View File
@@ -91,8 +91,25 @@ def set_audio(pipe, enabled: bool):
log.debug(f'Pipeline: cls={pipe.__class__.__name__} audio=disabled')
def set_sampler_shift(pipe, video_shift: float = 12.0, audio_shift: float = 3.0):
if getattr(pipe, 'scheduler', None) is not None and getattr(pipe.scheduler, 'config', None) is not None:
pipe.scheduler.config.shift = video_shift
if getattr(pipe, 'audio_scheduler', None) is not None and getattr(pipe.audio_scheduler, 'config', None) is not None:
pipe.audio_scheduler.config.shift = audio_shift
def calculate_video_shift(steps: int, value: float = 0.40, max_shift: float = 16.0) -> int:
value = max(0.05, min(0.95, value))
return min(max_shift, round((value * steps) + 0.5))
def calculate_audio_shift(steps: int, value: float = 0.15, max_shift: float = 6.0) -> int:
value = max(0.05, min(0.95, value))
return min(max_shift, round((value * steps) + 0.5))
def set_sampler_shift(pipe, steps: int, video_shift: float = 12.0, audio_shift: float = 3.0):
import diffusers
if getattr(pipe, 'scheduler', None) is None or getattr(pipe.scheduler, 'config', None) is None:
log.warning(f'Pipeline: cls={pipe.__class__.__name__} scheduler is missing')
return
video_calc_shift = calculate_video_shift(steps=steps, value=video_shift)
audio_calc_shift = calculate_audio_shift(steps=steps, value=audio_shift)
dct_video = { 'shift': video_shift, 'steps': video_calc_shift }
dct_audio = { 'shift': audio_shift, 'steps': audio_calc_shift }
pipe.scheduler = diffusers.MiniMaxH3Scheduler(shift=video_calc_shift)
pipe.audio_scheduler.config.shift = diffusers.MiniMaxH3Scheduler(shift=audio_calc_shift)
log.debug(f'Pipeline: scheduler={pipe.scheduler.__class__.__name__} video={dct_video} audio={dct_audio} ')
+1 -1
Submodule wiki updated: 5e3c670429...3e33a90f27