diff --git "a/app.py" "b/app.py" --- "a/app.py" +++ "b/app.py" @@ -1,1919 +1,1812 @@ -"""MiniMax-H3 `t2va` / `fl2va`, split deployment — the denoising half.""" - -from __future__ import annotations - -import os -import tempfile -import time -import traceback -from functools import cache - -# Before anything that could initialize CUDA: `import spaces` patches `torch.cuda` so the 72 GiB load can happen at -# startup rather than on GPU time. -import spaces -import gradio as gr - -MODEL_REPO = os.environ.get("H3_MODEL_REPO", "MiniMaxAI/MiniMax-H3") -CONDITIONER_SPACE = os.environ.get("H3_CONDITIONER", "multimodalart/qwen3vl-conditioner") -# `pack` places the transformer at startup, `lazy` moves everything on the first GPU call, `offload` hands placement to -# `ComponentsManager.enable_auto_cpu_offload`. -PLACEMENT = os.environ.get("H3_PLACEMENT", "pack").lower() -# cuDNN's fused attention is 10-20% faster than the SDPA default on this pool and needs nothing installed. -ATTENTION = os.environ.get("H3_ATTENTION", "_native_cudnn").lower() -GPU_SIZE = os.environ.get("H3_GPU_SIZE", "xlarge") - -# larryvrh distillation LoRA (diffusers conversion): A/B factors stored on CPU, merged on-demand inside @spaces.GPU. -TURBO_LORA_REPO = os.environ.get("H3_TURBO_LORA", "InstantX/MiniMax-H3-Turbo-Lora-Diffusers") -TURBO_LORA_FILE = "minimax_h3_turbo_4step_ckpt500_diffusers.safetensors" -TURBO_LORA_SCALE = 1.0 # alpha == rank - -# NSFW / anatomy LoRAs (ComfyUI format, converted at load). Lazy: downloaded + converted on CPU in generate(), -# merged on GPU inside @spaces.GPU only when selected. Standard LoRA only — LoKR (.lokr_w1/.lokr_w2) is unsupported. -NSFW_LORA_CONFIGS = { - "nsfw_innie": { - "repo": "Hearmeman/minimax-h3-loras", - "file": "HMInnie_v1_e50.safetensors", - "scale": 1.0, - "label": "NSFW Innie Pussy (HMInnie V1)", - "trigger": "inniepussy", - "desc": "Renders the vulva as a neat 'innie' — labia tucked in with no protruding inner lips. Use for close-up genital shots where you want a clean, compact vulva look. Not for scenes needing prominent outer labia or detailed pussy anatomy — pair with HMPussy for that.", - }, - "nsfw_penis": { - "repo": "observantdistressed/plora-h3", # CivitAI "Penis Lora - H3" v1.1, mirrored to HF - "file": "PLORA_H3_V2-step00006300.safetensors", - "scale": 0.7, - "label": "NSFW Penis (Penis Lora - H3 v1.1)", - "trigger": "PENISLORA", - "format": "kohya", - "desc": "Adds a detailed, erect penis to male subjects — the core anatomy LoRA for any scene with a visible penis. Use whenever a penis is in frame. Not for solo female scenes, and don't stack it with HMPenis v2.0 (same purpose, conflicting weights).", - }, - "nsfw_dildo": { - "repo": "EllaPriest45/MinimaxH3_Actions", # CivitAI "Dildoing" model 2903074, backup repo - "file": "Dildoing - MinimaxH3 - pumping a dildo insider her vagina.safetensors", - "scale": 0.7, - "label": "NSFW Dildoing (Dildo Insertion)", - "trigger": "pumping a dildo insider her vagina", - "desc": "Makes dildo insertion read naturally — the toy slides into the vagina with proper depth and motion instead of clipping or floating. Use for any dildo penetration scene. Not for scenes without a dildo, and don't combine it with other insertion LoRAs at full strength.", - }, - # Motion/action adapter — auto-loaded (not user-selectable) whenever any anatomy LoRA is on, so the - # anatomy renders sharply AND the act moves naturally. The Hearmeman README says to stack anatomy - # adapters underneath this action adapter. - "nsfw_aio": { - "repo": "Hearmeman/minimax-h3-loras", - "file": "HMNSFW-AIO-V2.5.safetensors", - "scale": 0.7, - "label": "HMNSFW AIO V2.5 (motion)", - "trigger": "hmmotion", - "desc": "Motion/action adapter that makes anatomy LoRAs move naturally during sex acts — auto-loaded whenever any NSFW LoRA is selected. Use stacked underneath anatomy LoRAs for sharp rendering plus natural motion. Not for standalone use; it's a motion enhancer, not an anatomy fix.", - }, - # ── EllaPriest45/MinimaxH3_Actions catalog (t2va-compatible, standard LoRA only) ── - # 93 LoRAs, classified by header inspection: 80 ComfyUI + 13 kohya. LoKR, I2V, REF2V, R2V, FL2VA excluded. - # Triggers/scales extracted from the CivitAI filenames (best effort — refine per-LoRA as needed). - 'nsfw_ahegao_face': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Ahegao Face - MinimaxH3 - She is making the ahegao face - eyes rolled back and tongue hanging out.safetensors', - "scale": 0.7, - "label": 'Ahegao Face', - "trigger": 'ahegao face', - "desc": "Makes the subject's face contort into the ahegao expression — eyes rolled back, tongue hanging out — for intense reaction shots. Use during orgasm or overstimulation scenes. Not for normal expressions or dialogue scenes; it overrides the face.", - }, - 'nsfw_all_tied_up': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'All Tied Up - MinimaxH3 - 0.8str.safetensors', - "scale": 0.8, - "label": 'All Tied Up', - "trigger": 'all tied up', - "desc": "Renders the subject bound and restrained, with rope or ties visible and functional. Use for bondage and restraint scenes. Not for scenes where the subject needs to move freely; it locks them into restraint poses.", - }, - 'nsfw_astro_nsfw': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Astro NSFW - MinimaxH3 - improves human movement and anatomy.safetensors', - "scale": 0.7, - "label": 'Astro NSFW', - "trigger": 'astro nsfw', - "format": "kohya", - "desc": "General NSFW quality enhancer that improves human movement and anatomy in explicit scenes. Use as a base layer on top of specific anatomy or act LoRAs. Not a specific act LoRA — don't expect it to produce a particular act on its own.", - }, - 'nsfw_auto_cunnilingus': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Auto-Cunnilingus - MinimaxH3 - She performs oral sex on herself.She licks her vulva.safetensors', - "scale": 0.7, - "label": 'Auto-Cunnilingus', - "trigger": 'She performs oral sex on herself.She licks her vulva', - "desc": "Makes the subject perform oral sex on herself — licking her own vulva. Use for self-cunnilingus scenes. Not for partnered cunnilingus; that's a different act with its own LoRAs.", - }, - 'nsfw_beanflk_masturbation_finger_insertion_au': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'BEANFLK - Masturbation & Finger Insertion + Audio - MinimaxH3 - BEANFLK,0.4str.safetensors', - "scale": 0.4, - "label": 'BEANFLK - Masturbation & Finger Insertion + Audio', - "trigger": 'BEANFLK', - "desc": "Masturbation with finger insertion, plus audio cues for the act. Use for solo fingering scenes. Not for scenes without finger penetration; the audio may not fit non-masturbation content.", - }, - 'nsfw_bunny_general_motion_continuity_repair': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'BUNNY General Motion Continuity Repair - MinimaxH3 - for dynamic scenes,bunny_crisp_motion,resmultistep+simple,euler+beta,0.9str,stage1,0.6str,stage2,0.25str.safetensors', - "scale": 0.9, - "label": 'BUNNY General Motion Continuity Repair', - "trigger": 'bunny_crisp_motion', - "desc": "Repairs motion continuity in dynamic scenes — reduces warping and keeps movement coherent across frames. Use for fast-action or high-motion shots. Not for slow, static scenes where it adds little.", - }, - 'nsfw_better_motion': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Better Motion - MinimaxH3 - 720x1280,15-30steps,0.2-0.4str.safetensors', - "scale": 0.3, - "label": 'Better Motion', - "trigger": 'better motion', - "desc": "General motion-quality LoRA that makes movement smoother and more natural. Use as a base enhancer for any scene. Not for specific acts; it's a motion polish, not an action generator.", - }, - 'nsfw_better_titfuck_v0_95': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Better Titfuck v0.95 - MinimaxH3 - res_multistep+simple,titjob,titfuck.safetensors', - "scale": 0.7, - "label": 'Better Titfuck v0.95', - "trigger": 'titjob,titfuck', - "desc": "Makes titfuck scenes read properly — breasts wrap around the penis with realistic motion. Use for titjob/titfuck scenes. Not for other sex acts; it specializes in breast-on-penis action.", - }, - 'nsfw_blowjob_v3_0': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Blowjob v3.0 - MinimaxH3 - bl0w_j0b.safetensors', - "scale": 0.7, - "label": 'Blowjob v3.0', - "trigger": 'bl0w_j0b', - "desc": "Core blowjob LoRA — makes oral sex on a penis read naturally with proper head motion. Use for blowjob scenes. Not for scenes without a visible penis; it won't do anything useful.", - }, - 'nsfw_blowjob_wearing_thong': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Blowjob wearing Thong - MinimaxH3 - blowjob_wearing_thong.safetensors', - "scale": 0.7, - "label": 'Blowjob wearing Thong', - "trigger": 'blowjob_wearing_thong', - "desc": "Blowjob variant where the performer keeps a thong on. Use for thong-clad blowjob scenes. Not for nude blowjobs — the thong is part of the concept.", - }, - 'nsfw_bluebella_nova_lingerie': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Bluebella Nova Lingerie - MinimaxH3 - She is wearing COLOR Bluebella Nova Lingerie.safetensors', - "scale": 0.7, - "label": 'Bluebella Nova Lingerie', - "trigger": 'She is wearing COLOR Bluebella Nova Lingerie', - "format": "kohya", - "desc": "Renders the subject wearing the Bluebella Nova lingerie set — a specific lace-and-straps design. Use for scenes featuring this exact lingerie. Not for other outfits; it's tied to this one garment.", - }, - 'nsfw_boob_physics': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Boob Physics - MinimaxH3 - jiggle,grab,massage,bounce.safetensors', - "scale": 0.7, - "label": 'Boob Physics', - "trigger": 'jiggle,grab,massage,bounce', - "desc": "Adds natural breast motion — jiggle, bounce, and sway during movement. Use for any scene with breast movement. Not for static shots; it only shows when there's motion.", - }, - 'nsfw_bustywomen': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'BustyWomen - MinimaxH3 - 0.75-1str.safetensors', - "scale": 0.88, - "label": 'BustyWomen', - "trigger": 'busty women', - "desc": "Makes female subjects busty — fuller, larger breasts. Use when you want a well-endowed figure. Not for flat-chested or petite figures; it conflicts with tiny-breast LoRAs.", - }, - 'nsfw_button_pop': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Button pop - MinimaxH3 - 0.2-0.5str,butt0n_p0p.safetensors', - "scale": 0.35, - "label": 'Button pop', - "trigger": 'butt0n_p0p', - "desc": "Makes buttons pop off clothing under strain — a clothing-failure effect. Use for scenes where a tight top bursts open. Not for general scenes; it's a specific gag/effect.", - }, - 'nsfw_cameltoe_v2_0': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Cameltoe v2.0 - MinimaxH3 - cameltoe.safetensors', - "scale": 0.7, - "label": 'Cameltoe v2.0', - "trigger": 'cameltoe', - "desc": "Renders a visible cameltoe through tight clothing. Use for scenes with tight bottoms. Not for nude scenes; it needs clothing to show through.", - }, - 'nsfw_can_t_stop_shaking': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": "Can't Stop Shaking! - MinimaxH3 - endface1,endbody1.safetensors", - "scale": 0.7, - "label": "Can't Stop Shaking!", - "trigger": 'endface1,endbody1', - "desc": "Makes the subject shake uncontrollably — body and face tremors, often during intense stimulation. Use for overstimulation and orgasm scenes. Not for calm scenes; it adds constant shaking.", - }, - 'nsfw_chasing_blowjob_v1_2': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Chasing blowjob v1.2 - MinimaxH3 - The girl performs a blowjob.safetensors', - "scale": 0.7, - "label": 'Chasing blowjob v1.2', - "trigger": 'The girl performs a blowjob', - "desc": "Blowjob where the performer chases the penis — active, eager head movement. Use for enthusiastic blowjob scenes. Not for slow or gentle oral; it's an energetic variant.", - }, - 'nsfw_combat_base_v2_0': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Combat BASE v2.0 - MinimaxH3 - prfight2,prfin1,res_multistep+simple,euler+beta.safetensors', - "scale": 0.7, - "label": 'Combat BASE v2.0', - "trigger": 'prfight2,prfin1', - "desc": "Base LoRA for fight and combat scenes — wrestling, grappling, and physical struggle. Use for combat or struggle scenes. Not for sex acts; it's a fight-motion base.", - }, - 'nsfw_cum_swallow': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Cum Swallow - MinimaxH3 - TADAA,0.4str.safetensors', - "scale": 0.4, - "label": 'Cum Swallow', - "trigger": 'TADAA', - "desc": "Makes the subject swallow cum after a facial or oral scene — the swallowing action reads clearly. Use for cum-swallow endings. Not for scenes without a cumshot; it needs the setup.", - }, - 'nsfw_cumshot': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Cumshot - MinimaxH3 - 20steps,euler+beta,0.85str.safetensors', - "scale": 0.85, - "label": 'Cumshot', - "trigger": 'cumshot', - "desc": "Renders a visible cumshot — ejaculation with realistic volume and motion. Use for cumshot scenes. Not for non-ejaculation scenes; it forces the act.", - }, - 'nsfw_deeper_hold_it': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Deeper... Hold It. - MinimaxH3 - oralmove1,oraldetail1,0.8str.safetensors', - "scale": 0.8, - "label": 'Deeper... Hold It.', - "trigger": 'oralmove1,oraldetail1', - "desc": "Oral-sex detail LoRA — deep-throat motion and oral detail. Use for deep oral scenes. Not for shallow kissing or foreplay; it's oral-specific.", - }, - 'nsfw_dildo_masturbation_v2_0': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Dildo Masturbation v2.0 - MinimaxH3 - She slide a dildo in and out of her pussy.safetensors', - "scale": 0.7, - "label": 'Dildo Masturbation v2.0', - "trigger": 'She slide a dildo in and out of her pussy', - "desc": "Makes solo dildo masturbation read naturally — the subject slides a dildo in and out of her pussy. Use for solo dildo scenes. Not for partnered penetration; it's solo-focused.", - }, - 'nsfw_disney_style_renaissance_era': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Disney Style - Renaissance Era - MinimaxH3 - In the style of Disney animation.safetensors', - "scale": 0.7, - "label": 'Disney Style - Renaissance Era', - "trigger": 'In the style of Disney animation', - "format": "kohya", - "desc": "Applies a Disney Renaissance-era animation style — the classic 90s hand-drawn look. Use for stylized or animated scenes. Not for photorealistic content; it fights realism.", - }, - 'nsfw_drone_shot': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Drone Shot - MinimaxH3 - dr0nesh0t.safetensors', - "scale": 0.7, - "label": 'Drone Shot', - "trigger": 'dr0nesh0t', - "desc": "Adds a drone-style aerial camera shot — high-angle and sweeping. Use for establishing or overhead shots. Not for close-up intimate scenes; it pulls the camera away.", - }, - 'nsfw_facial_cumshot_v0_1': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Facial CumShot v0.1 - MinimaxH3 - cmst.safetensors', - "scale": 0.7, - "label": 'Facial CumShot v0.1', - "trigger": 'cmst', - "desc": "Renders a facial cumshot — cum landing on the face. Use for facial scenes. Not for internal or swallow endings; it's face-specific.", - }, - 'nsfw_faster_harder_shake_harder_v0_2': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Faster! Harder! Shake Harder! v0.2 - MinimaxH3 - dynv2.safetensors', - "scale": 0.7, - "label": 'Faster! Harder! Shake Harder! v0.2', - "trigger": 'dynv2', - "desc": "Makes the subject move faster and harder — intense, vigorous motion. Use for rough or fast scenes. Not for gentle or slow scenes; it escalates intensity.", - }, - 'nsfw_fetish_submission_chain_teddy': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Fetish Submission Chain Teddy - MinimaxH3 - She is wearing a red latex fetish submission chain teddy.Her hands are bound in front of her.safetensors', - "scale": 0.7, - "label": 'Fetish Submission Chain Teddy', - "trigger": 'She is wearing a red latex fetish submission chain teddy', - "desc": "Renders the subject in a red latex fetish submission chain teddy, with her hands bound in front. Use for latex or bondage outfit scenes. Not for casual outfits; it's a specific fetish garment.", - }, - 'nsfw_fingering': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Fingering - MinimaxH3 - 0.8-1str.safetensors', - "scale": 0.9, - "label": 'Fingering', - "trigger": 'fingering', - "desc": "Makes fingering scenes read naturally — fingers inside the vagina with realistic motion. Use for manual stimulation scenes. Not for scenes without hand-on-genital contact.", - }, - 'nsfw_framerush': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'FrameRush - MinimaxH3 - lights.safetensors', - "scale": 0.7, - "label": 'FrameRush', - "trigger": 'lights', - "desc": "Camera and lighting effect LoRA — adds a rushed, dynamic frame feel. Use for energetic camera work. Not for stable, slow shots.", - }, - 'nsfw_furry_enhancer_video_v1_5': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Furry Enhancer Video v1.5 - MinimaxH3 - 0.6-0.7str.safetensors', - "scale": 0.65, - "label": 'Furry Enhancer Video v1.5', - "trigger": 'furry enhancer', - "desc": "Enhances furry and anthro characters in video — fur texture and anthro anatomy. Use for furry content. Not for human subjects; it will fur-ify them.", - }, - 'nsfw_futanari_transformation_futanarization_v': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Futanari transformation (Futanarization) v5.1 - MinimaxH3 - futanaei transformation,futanaei transformation.safetensors', - "scale": 0.7, - "label": 'Futanari transformation (Futanarization) v5.1', - "trigger": 'futanaei transformation', - "desc": "Renders futanari transformation — a female subject gaining a penis. Use for futanari or transformation scenes. Not for standard male-female scenes; it changes anatomy.", - }, - 'nsfw_grindtime': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Grindtime - MinimaxH3 - grindtime,a woman performing continuous rhythmic gyrating hip motion while having sex,front-rear-side view.safetensors', - "scale": 0.7, - "label": 'Grindtime', - "trigger": 'grindtime', - "desc": "Makes the subject perform continuous rhythmic hip grinding during sex — front, rear, and side views. Use for grinding or riding scenes. Not for static poses; it's a motion LoRA.", - }, - 'nsfw_h3_footjob_v0': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": "H3 Footjob v0 - MinimaxH3 - a photoealistic video depicting a woman sitting in front of the viewer.the camera angle is a male pov.the viewer's penis is exposed.the woman is performing a footjob.h3fj.safetensors", - "scale": 0.7, - "label": 'H3 Footjob v0', - "trigger": 'h3fj', - "desc": "POV footjob LoRA — the subject strokes a penis with her feet from a male POV. Use for footjob scenes. Not for scenes without a visible penis and feet; it's a specific POV setup.", - }, - 'nsfw_hmbreasts_v2_0': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'HMBreasts v2.0 - MinimaxH3 - tits,seeds2+ddim_uniform,8stepsturbolora.safetensors', - "scale": 0.7, - "label": 'HMBreasts v2.0', - "trigger": 'tits', - "desc": "Hearmeman breast LoRA — renders attractive, natural breasts. Use for breast-focused scenes. Not for flat-chested figures; it conflicts with tiny-breast LoRAs.", - }, - 'nsfw_hmmasturbation_squirting_and_female_mast': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'HMMasturbation - Squirting and Female Masturbation - MinimaxH3 - hmmasturbation,euler+simple,12steps,shift6,turbo lora 0.5str,use hmpussy at 0.4-0.8str.safetensors', - "scale": 0.6, - "label": 'HMMasturbation - Squirting and Female Masturbation', - "trigger": 'hmmasturbation', - "desc": "Hearmeman masturbation LoRA — solo masturbation with squirting. Use for solo scenes with squirting. Not for partnered sex; it's solo-focused.", - }, - 'nsfw_hmpenis_v2_0': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'HMPenis v2.0 - MinimaxH3 - penis,0.9str.safetensors', - "scale": 0.9, - "label": 'HMPenis v2.0', - "trigger": 'penis', - "desc": "Hearmeman penis LoRA — detailed erect penis anatomy. Use for any scene with a visible penis. Not for solo female scenes, and don't stack it with the dedicated penis LoRA (same purpose).", - }, - 'nsfw_hmpussy_v1_0': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'HMPussy v1.0 - MinimaxH3 - pussy,0.9str.safetensors', - "scale": 0.9, - "label": 'HMPussy v1.0', - "trigger": 'pussy', - "desc": "Hearmeman pussy LoRA — detailed vulva anatomy. Use for close-up genital shots. Not for scenes where the vulva isn't visible; it only affects what's in frame.", - }, - 'nsfw_hmsquirt_squirting_v0_1': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'HMSquirt - Squirting v0.1 - MinimaxH3 - euler+simple,hmsquirt,12steps,6shift,turbolora 0.5str.safetensors', - "scale": 0.5, - "label": 'HMSquirt - Squirting v0.1', - "trigger": 'hmsquirt', - "desc": "Hearmeman squirting LoRA — makes squirting read clearly during stimulation. Use for squirting scenes. Not for dry scenes; it forces the effect.", - }, - 'nsfw_hand_in_panties_masturbation': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Hand in Panties Masturbation - MinimaxH3 - 0.7str,She has her hand in her panties,She slides her hand in her panties.She rubs her vagina.safetensors', - "scale": 0.7, - "label": 'Hand in Panties Masturbation', - "trigger": 'She has her hand in her panties,She slides her hand in her panties.She rubs her vagina', - "desc": "Makes the subject slide her hand into her panties and rub herself. Use for clothed masturbation scenes. Not for nude masturbation; the panties are part of the concept.", - }, - 'nsfw_hip_gyration': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Hip Gyration - MinimaxH3 - gyrating her hips,0.8str.safetensors', - "scale": 0.8, - "label": 'Hip Gyration', - "trigger": 'gyrating her hips', - "desc": "Makes the subject gyrate her hips rhythmically — circular hip motion. Use for grinding or dancing scenes. Not for static poses; it's a motion LoRA.", - }, - 'nsfw_hip_sway_dance': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Hip Sway Dance - MinimaxH3 - dancing with arms in front.safetensors', - "scale": 0.7, - "label": 'Hip Sway Dance', - "trigger": 'dancing with arms in front', - "desc": "Dance LoRA — the subject dances with arms in front, swaying her hips. Use for dance scenes. Not for sex acts; it's a dance-motion LoRA.", - }, - 'nsfw_hitachi_magic_wand_vibrator': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Hitachi Magic Wand Vibrator - MinimaxH3 - using a Hitachi Magic Wand vibrator.safetensors', - "scale": 0.7, - "label": 'Hitachi Magic Wand Vibrator', - "trigger": 'using a Hitachi Magic Wand vibrator', - "desc": "Renders the subject using a Hitachi Magic Wand vibrator — the toy and its use read clearly. Use for vibrator scenes. Not for scenes without the toy; it won't add anything.", - }, - 'nsfw_holi_festival_of_colors': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Holi Festival of Colors - MinimaxH3 - Festival_of_Colors,multicolored smoke,multicolored paint,multicolored powder.safetensors', - "scale": 0.7, - "label": 'Holi Festival of Colors', - "trigger": 'Festival_of_Colors', - "desc": "Holi festival effect — multicolored smoke, paint, and powder. Use for colorful festival scenes. Not for NSFW acts; it's a visual-effects LoRA.", - }, - 'nsfw_huge_breasts_large_breasts': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Huge Breasts - Large Breasts - MinimaxH3 - bigsloppytits,huge-massive-enormous saggy breasts-bust,nip_protruding-flat-soft,areola_large-wide-medium-small.safetensors', - "scale": 0.7, - "label": 'Huge Breasts - Large Breasts', - "trigger": 'bigsloppytits', - "desc": "Renders huge, saggy breasts — massive with large areolas. Use for extreme-breast scenes. Not for natural or petite figures; it goes big.", - }, - 'nsfw_icy_ass_smacking': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Icy Ass Smacking - MinimaxH3 - icyslap.safetensors', - "scale": 0.7, - "label": 'Icy Ass Smacking', - "trigger": 'icyslap', - "desc": "Makes ass-smacking read naturally — the slap and the resulting jiggle. Use for spanking scenes. Not for non-spanking scenes; it forces the action.", - }, - 'nsfw_icy_twerk_pro_max_v2_0': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Icy Twerk Pro MAX v2.0 - MinimaxH3 - icytwerk.safetensors', - "scale": 0.7, - "label": 'Icy Twerk Pro MAX v2.0', - "trigger": 'icytwerk', - "desc": "Twerk LoRA — vigorous twerking with strong ass motion. Use for twerk scenes. Not for slow or gentle movement; it's high-energy.", - }, - 'nsfw_innie_pussy': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Innie Pussy - MinimaxH3.safetensors', - "scale": 0.7, - "label": 'Innie Pussy', - "trigger": 'inniepussy', - "format": "kohya", - "desc": "Innie pussy variant (kohya format) — a clean, tucked vulva look. Use for close-up genital shots wanting a neat innie. Not for scenes needing prominent labia; same caveat as the dedicated innie LoRA.", - }, - 'nsfw_jav_moans_audio_only': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'JAV moans audio only - MinimaxH3 - jpnMoans.safetensors', - "scale": 0.7, - "label": 'JAV moans audio only', - "trigger": 'jpnMoans', - "format": "kohya", - "desc": "Audio LoRA — adds JAV-style moans to the soundtrack. Use for scenes where you want Japanese AV-style vocalizations. Not for scenes with dialogue; it's audio-only.", - }, - 'nsfw_jiggle_walk': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'JIGGLE WALK - MinimaxH3 - JGLWLK.safetensors', - "scale": 0.7, - "label": 'JIGGLE WALK', - "trigger": 'JGLWLK', - "desc": "Makes the subject walk with a pronounced jiggle — breast and body bounce while walking. Use for walking scenes. Not for static or lying-down scenes; it needs locomotion.", - }, - 'nsfw_kaku_table_humping': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'KAKU - Table Humping - MinimaxH3 - 0.4-0.5str,KAKU,euler+simple.safetensors', - "scale": 0.45, - "label": 'KAKU - Table Humping', - "trigger": 'KAKU', - "desc": "Makes the subject hump a table or surface — grinding against furniture. Use for table-humping scenes. Not for partnered sex; it's a solo furniture act.", - }, - 'nsfw_lesbian_cunnilingus_v2_0': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Lesbian Cunnilingus v2.0 - MinimaxH3.safetensors', - "scale": 0.7, - "label": 'Lesbian Cunnilingus v2.0', - "trigger": 'lesbian cunnilingus', - "desc": "Lesbian cunnilingus — one woman performs oral sex on another. Use for lesbian oral scenes. Not for solo or hetero scenes; it's a partnered female act.", - }, - 'nsfw_licking_penis_and_testicles_nsfw_v1_2': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Licking Penis and Testicles (NSFW) v1.2 - MinimaxH3 - licking penis,licking testicles,licking penis tip,Only works if penis and testicles are in view.safetensors', - "scale": 0.7, - "label": 'Licking Penis and Testicles (NSFW) v1.2', - "trigger": 'licking penis,licking testicles,licking penis tip', - "desc": "Makes the subject lick a penis and testicles — detailed oral attention. Use for oral scenes focused on the penis and testicles. Only works if the penis and testicles are in view.", - }, - 'nsfw_mini_dick_fix_penis_helper': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Mini Dick Fix - Penis Helper - MinimaxH3 - 3r3kt (but not really needed).safetensors', - "scale": 0.7, - "label": 'Mini Dick Fix - Penis Helper', - "trigger": '3r3kt', - "desc": "Fixes the 'mini dick' problem — makes the penis render at a realistic size instead of shrinking. Use alongside any penis LoRA. Not a standalone anatomy LoRA; it's a helper.", - }, - 'nsfw_missionary_sex_pov': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Missionary Sex - POV - MinimaxH3 - having missionary sex.safetensors', - "scale": 0.7, - "label": 'Missionary Sex - POV', - "trigger": 'having missionary sex', - "desc": "Missionary sex from the male POV — the act reads naturally from above. Use for missionary scenes. Not for other positions; it's position-specific.", - }, - 'nsfw_moawxx_female_pleasure_moans_body_writhi': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Moawxx - Female Pleasure Moans + Body Writhing v0.1 2000e - MinimaxH3 - moawxx,0.6-0.85str.safetensors', - "scale": 0.72, - "label": 'Moawxx - Female Pleasure Moans + Body Writhing v0.1 2000e', - "trigger": 'moawxx', - "desc": "Moawxx pleasure LoRA — female moans plus body writhing during stimulation. Use for pleasure and orgasm scenes. Not for calm scenes; it adds audible and visible arousal.", - }, - 'nsfw_moawxx_female_pleasure_moans_body_writhi_2': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Moawxx - Female Pleasure Moans + Body Writhing v0.1 2500e - MinimaxH3 - moawxx,0.6-0.85str.safetensors', - "scale": 0.72, - "label": 'Moawxx - Female Pleasure Moans + Body Writhing v0.1 2500e', - "trigger": 'moawxx', - "desc": "Moawxx pleasure LoRA — female moans plus body writhing during stimulation (2500e training variant). Use for pleasure and orgasm scenes. Not for calm scenes; it adds audible and visible arousal.", - }, - 'nsfw_moawxx_female_pleasure_moans_body_writhi_3': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Moawxx - Female Pleasure Moans + Body Writhing v0.1 2750e - MinimaxH3 - moawxx,0.6-0.85str.safetensors', - "scale": 0.72, - "label": 'Moawxx - Female Pleasure Moans + Body Writhing v0.1 2750e', - "trigger": 'moawxx', - "desc": "Moawxx pleasure LoRA — female moans plus body writhing during stimulation (2750e training variant). Use for pleasure and orgasm scenes. Not for calm scenes; it adds audible and visible arousal.", - }, - 'nsfw_mystic_xxx_v2_0': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Mystic XXX v2.0 - MinimaxH3 - 0.7str.safetensors', - "scale": 0.7, - "label": 'Mystic XXX v2.0', - "trigger": 'mystic xxx', - "desc": "General NSFW enhancer — improves overall explicitness and scene quality. Use as a base on top of specific act LoRAs. Not a specific act; it's a general boost.", - }, - 'nsfw_natural_sagging_breasts': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Natural Sagging Breasts - MinimaxH3 - She has naturally sagging breasts.safetensors', - "scale": 0.7, - "label": 'Natural Sagging Breasts', - "trigger": 'She has naturally sagging breasts', - "desc": "Renders naturally sagging breasts — realistic gravity and shape. Use for mature or natural figures. Not for perky or enhanced breasts; it adds sag.", - }, - 'nsfw_natural_saggy_boobs': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Natural Saggy Boobs - MinimaxH3 - hugesaggytits,shirt-lift titty drop,bra unhook from behind,then drop.safetensors', - "scale": 0.7, - "label": 'Natural Saggy Boobs', - "trigger": 'hugesaggytits', - "desc": "Saggy boobs with specific reveal actions — shirt-lift titty drop and bra unhook from behind. Use for breast-reveal scenes. Not for clothed scenes; it's about the reveal.", - }, - 'nsfw_nipple_play': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Nipple Play - MinimaxH3 - flicks her own nipples,gently pinch and slowly roll her own beautifully formed,fully erect,firm and symmetrical nipples.safetensors', - "scale": 0.7, - "label": 'Nipple Play', - "trigger": 'nipple play', - "desc": "Makes the subject play with her nipples — flicking, pinching, and rolling them. Use for nipple-play scenes. Not for scenes without breast focus; it centers on the nipples.", - }, - 'nsfw_pjslide_pussyjob': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'PJSLIDE - Pussyjob - MinimaxH3 - 0.5str,PJSLIDE,add HMPenis lora at 0.5str.safetensors', - "scale": 0.5, - "label": 'PJSLIDE - Pussyjob', - "trigger": 'PJSLIDE', - "desc": "Pussyjob LoRA — the penis slides along the vulva. Use for pussyjob scenes; the author recommends adding the penis LoRA at 0.5 strength alongside it. Not for penetration scenes; it's a sliding act.", - }, - 'nsfw_pk_parasyte_turbo_clean_up_the_models_vi': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'PK Parasyte Turbo (clean up the models visuals and audio) - MinimaxH3 - 3.5-5str,6-8steps,8-3 shift,euler+simple.safetensors', - "scale": 4.25, - "label": 'PK Parasyte Turbo (clean up the models visuals and audio)', - "trigger": 'PK Parasyte Turbo', - "desc": "Turbo LoRA that cleans up model visuals and audio — improves overall quality at low step counts. Use with turbo mode (6-8 steps, high strength 3.5-5). Not for standard 25-step generation; it's tuned for turbo.", - }, - 'nsfw_pov_missionary_insertion_v0_7': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'POV Missionary Insertion v0.7 - MinimaxH3.safetensors', - "scale": 0.7, - "label": 'POV Missionary Insertion v0.7', - "trigger": 'missionary insertion', - "format": "kohya", - "desc": "POV missionary insertion — the insertion moment reads clearly from the male POV. Use for missionary insertion scenes. Not for other positions; it's position-specific.", - }, - 'nsfw_passionate_kissing': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Passionate Kissing - MinimaxH3 - They kiss passionately,1str.safetensors', - "scale": 1.0, - "label": 'Passionate Kissing', - "trigger": 'They kiss passionately', - "desc": "Makes passionate kissing read naturally — lip contact and head motion. Use for kissing scenes. Not for oral or sex acts; it's kissing-specific.", - }, - 'nsfw_photorealistic_image_generator': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Photorealistic Image Generator - MinimaxH3 - ph0t0r34l.safetensors', - "scale": 0.7, - "label": 'Photorealistic Image Generator', - "trigger": 'ph0t0r34l', - "format": "kohya", - "desc": "Pushes output toward photorealism — more realistic textures and lighting. Use for photorealistic scenes. Not for stylized or animated content; it fights the style.", - }, - 'nsfw_pillow_humping': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Pillow Humping - MinimaxH3 - She is straddling a pillow.She is humping the pillow.safetensors', - "scale": 0.7, - "label": 'Pillow Humping', - "trigger": 'She is straddling a pillow.She is humping the pillow', - "desc": "Makes the subject straddle and hump a pillow — solo grinding on a pillow. Use for pillow-humping scenes. Not for partnered sex; it's a solo act.", - }, - 'nsfw_pokies': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Pokies - MinimaxH3 - covered nipples,pokies.safetensors', - "scale": 0.7, - "label": 'Pokies', - "trigger": 'covered nipples,pokies', - "format": "kohya", - "desc": "Renders visible nipple outlines through clothing — pokies. Use for clothed scenes with tight tops. Not for nude scenes; it needs clothing.", - }, - 'nsfw_polyhedron_perfect_eyes_perfect_skin_per': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Polyhedron Perfect Eyes - Perfect Skin - Perfect Hands T2VA - MinimaxH3 - perfe8ct,perfect hands,perfect skin,perfect eyes.safetensors', - "scale": 0.7, - "label": 'Polyhedron Perfect Eyes - Perfect Skin - Perfect Hands T2VA', - "trigger": 'perfe8ct', - "desc": "Quality enhancer for eyes, skin, and hands — fixes common rendering flaws. Use as a general quality boost for any scene. Not for specific acts; it's a detail fixer.", - }, - 'nsfw_realism_people': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Realism People - MinimaxH3 - r34l1sm,0.6-1str.safetensors', - "scale": 0.8, - "label": 'Realism People', - "trigger": 'r34l1sm', - "desc": "Makes people look more realistic — natural proportions and skin. Use for photorealistic human scenes. Not for stylized content; it fights the style.", - }, - 'nsfw_sexgod_after_midnight_sexytime_r64': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'SexGod After Midnight Sexytime R64 - MinimaxH3 - euler+beta.safetensors', - "scale": 0.7, - "label": 'SexGod After Midnight Sexytime R64', - "trigger": 'sexgod', - "format": "kohya", - "desc": "SexGod base LoRA — general NSFW scene quality. Use as a base enhancer on top of specific act LoRAs. Not a specific act; it's a general boost.", - }, - 'nsfw_sexgod_s_naughtytimes_v2_0_pruned_rank25': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": "SexGod's NaughtyTimes v2.0 pruned rank256 - MinimaxH3.safetensors", - "scale": 0.7, - "label": "SexGod's NaughtyTimes v2.0 pruned rank256", - "trigger": 'naughtytimes', - "format": "kohya", - "desc": "SexGod's NaughtyTimes — general NSFW scene enhancer (rank-256 pruned). Use as a base enhancer. Not act-specific; pair it with act LoRAs.", - }, - 'nsfw_sexgod_s_naughtytimes_v2_0_pruned_rank51': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": "SexGod's NaughtyTimes v2.0 pruned rank512 - MinimaxH3.safetensors", - "scale": 0.7, - "label": "SexGod's NaughtyTimes v2.0 pruned rank512", - "trigger": 'naughtytimes', - "format": "kohya", - "desc": "SexGod's NaughtyTimes — general NSFW scene enhancer (rank-512 pruned, slightly higher capacity). Use as a base enhancer. Pick one of the two NaughtyTimes variants; don't stack both.", - }, - 'nsfw_she_struts': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'She Struts - MinimaxH3 - she struts.safetensors', - "scale": 0.7, - "label": 'She Struts', - "trigger": 'she struts', - "desc": "Makes the subject strut — confident walking with attitude. Use for walk or entrance scenes. Not for static scenes; it needs locomotion.", - }, - 'nsfw_sideview_deepthroat_gag_audio': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'SideView Deepthroat Gag Audio - MinimaxH3.safetensors', - "scale": 0.7, - "label": 'SideView Deepthroat Gag Audio', - "trigger": 'deepthroat', - "format": "kohya", - "desc": "Side-view deepthroat with gag audio — the gag reflex reads and sounds. Use for deepthroat scenes. Not for gentle oral; it's intense.", - }, - 'nsfw_skin_tight_bottoms_cameltoe': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Skin Tight Bottoms (Cameltoe) - MinimaxH3 - cameltoe,0.9str.safetensors', - "scale": 0.9, - "label": 'Skin Tight Bottoms (Cameltoe)', - "trigger": 'cameltoe', - "desc": "Skin-tight bottoms with a visible cameltoe. Use for tight-clothing scenes. Not for nude scenes; it needs the clothing.", - }, - 'nsfw_slop_twerk_v0_2_epoch6': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": "Slop Twerk v0.2 Epoch6 - MinimaxH3 - twerks causing her ass to jiggle and shake,0.5-1str,0.5 STR if you don't want Asians in T2V.safetensors", - "scale": 0.75, - "label": 'Slop Twerk v0.2 Epoch6', - "trigger": 'twerk', - "desc": "Twerk LoRA with strong ass jiggle and shake. Use for twerk scenes. Note: use 0.5 strength if you don't want Asian subjects in text-to-video.", - }, - 'nsfw_slop_bounce': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Slop bounce - MinimaxH3 - breasts bounce,shake,jiggle,sway.safetensors', - "scale": 0.7, - "label": 'Slop bounce', - "trigger": 'breasts bounce', - "desc": "Breast bounce, shake, jiggle, and sway during movement. Use for any scene with breast motion. Not for static shots; it only shows with movement.", - }, - 'nsfw_snow_white_lingerie': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Snow White Lingerie - MinimaxH3 - She is wearing slutty snow white lingerie.safetensors', - "scale": 0.7, - "label": 'Snow White Lingerie', - "trigger": 'She is wearing slutty snow white lingerie', - "desc": "Renders the subject in slutty Snow White lingerie. Use for scenes featuring this specific outfit. Not for other outfits; it's tied to this garment.", - }, - 'nsfw_strapon_dildo_v0_1': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Strapon Dildo v0.1 - MinimaxH3 - She is wearing a strapon dildo.safetensors', - "scale": 0.7, - "label": 'Strapon Dildo v0.1', - "trigger": 'She is wearing a strapon dildo', - "desc": "Makes the subject wear and use a strapon dildo. Use for strapon scenes. Not for scenes without the toy; it won't add anything.", - }, - 'nsfw_synth_pussy_v0_5': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Synth Pussy v0.5 - MinimaxH3.safetensors', - "scale": 0.7, - "label": 'Synth Pussy v0.5', - "trigger": 'synth pussy', - "format": "kohya", - "desc": "Synth pussy — a stylized or synthetic vulva rendering. Use for stylized genital shots. Not for photorealistic anatomy; it's a stylized look.", - }, - 'nsfw_the_orgasm_button': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'The Orgasm button - MinimaxH3 - Remoteorgasm.safetensors', - "scale": 0.7, - "label": 'The Orgasm button', - "trigger": 'Remoteorgasm', - "desc": "Remote-control orgasm — the subject reacts to a remote trigger. Use for orgasm-control scenes. Not for natural orgasms; it's the remote-control concept.", - }, - 'nsfw_thumb_finger_puppets': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Thumb-Finger puppets - MinimaxH3 - A thumb person.safetensors', - "scale": 0.7, - "label": 'Thumb-Finger puppets', - "trigger": 'A thumb person', - "desc": "Thumb-finger puppets — a 'thumb person' novelty effect. Use for puppet or novelty scenes. Not for realistic content; it's a gag.", - }, - 'nsfw_thumbinbutt': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'ThumbInButt - MinimaxH3 - thum1n8utt,the man inserts his right thumb in her anus causing the woman to moan with pleasure.safetensors', - "scale": 0.7, - "label": 'ThumbInButt', - "trigger": 'thum1n8utt', - "desc": "Makes the man insert his thumb into the woman's anus, causing a pleasure moan. Use for anal-fingering scenes. Not for non-anal scenes; it forces the action.", - }, - 'nsfw_tiddies_and_realism_slider_vbeta': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Tiddies and Realism Slider vBeta - MinimaxH3 - 0.4-2str.safetensors', - "scale": 1.2, - "label": 'Tiddies and Realism Slider vBeta', - "trigger": 'tiddies and realism', - "desc": "Slider LoRA — adjust breast size and realism on a scale (0.4-2 strength; 1.2 is a good default). Use to fine-tune breast size. Not a fixed anatomy LoRA; it's a continuous slider.", - }, - 'nsfw_tiny_breasts_flat_chest': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Tiny Breasts - Flat Chest - MinimaxH3 - She is flat chested,she has a flat chest.safetensors', - "scale": 0.7, - "label": 'Tiny Breasts - Flat Chest', - "trigger": 'She is flat chested,she has a flat chest', - "desc": "Renders a flat chest or tiny breasts. Use for petite figures. Not for busty figures; it conflicts with breast-size LoRAs.", - }, - 'nsfw_tiny_panties': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Tiny Panties - MinimaxH3 - She is wearing tiny panties.safetensors', - "scale": 0.7, - "label": 'Tiny Panties', - "trigger": 'She is wearing tiny panties', - "desc": "Renders the subject in tiny panties — minimal coverage. Use for lingerie scenes. Not for nude scenes; the panties are the point.", - }, - 'nsfw_torpedo_tits_t2v': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Torpedo Tits T2V - MinimaxH3 - torpedo tits,a 20 year old woman,wearing nothing shows off her medium sized torpedo tit breasts.safetensors', - "scale": 0.7, - "label": 'Torpedo Tits T2V', - "trigger": 'torpedo tits', - "desc": "Torpedo-shaped breasts — a specific conical breast shape. Use for torpedo-tit scenes. Not for natural shapes; it imposes the torpedo look.", - }, - 'nsfw_transition_boomsplitro': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Transition BoomSplitRo - MinimaxH3 - ysp_spliroa12 a woman. hard cut with no smooth transition, jumps straight into spitroast.safetensors', - "scale": 0.7, - "label": 'Transition BoomSplitRo', - "trigger": 'ysp_spliroa12', - "format": "kohya", - "desc": "Hard-cut transition straight into a spitroast scene — no smooth transition. Use for abrupt scene changes. Not for continuous scenes; it's a cut effect.", - }, - 'nsfw_transition_f2v_instant_cut_to_things': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Transition F2V - Instant Cut to Things - MinimaxH3 - ysp_smshcut.safetensors', - "scale": 0.7, - "label": 'Transition F2V - Instant Cut to Things', - "trigger": 'ysp_smshcut', - "format": "kohya", - "desc": "Instant cut transition to a new scene. Use for abrupt scene changes. Not for continuous scenes; it's a cut effect.", - }, - 'nsfw_tribtime': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Tribtime - MinimaxH3 - tribtime.safetensors', - "scale": 0.7, - "label": 'Tribtime', - "trigger": 'tribtime', - "desc": "Tribbing — scissoring or grinding between two women. Use for tribadism scenes. Not for solo scenes; it needs two partners.", - }, - 'nsfw_upskirt_helper_v0_1': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Upskirt Helper v0.1 - MinimaxH3 - upsk1rt_panties,upsk1rt_no_panties.safetensors', - "scale": 0.7, - "label": 'Upskirt Helper v0.1', - "trigger": 'upsk1rt_panties,upsk1rt_no_panties', - "format": "kohya", - "desc": "Upskirt view — with or without panties. Use for upskirt shots. Not for nude scenes; it needs a skirt.", - }, - 'nsfw_whispering': { - "repo": "EllaPriest45/MinimaxH3_Actions", - "file": 'Whispering - MinimaxH3 - 0.7str,she whisper XYZ.safetensors', - "scale": 0.7, - "label": 'Whispering', - "trigger": 'she whisper XYZ', - "desc": "Makes the subject whisper — replace XYZ in the trigger with what she whispers. Use for whispering scenes. Not for loud or vocal scenes; it's a quiet effect.", - }, -} - -# LoRAs that overlap in purpose and fight each other when stacked. The description box warns whenever 2+ from a -# group are selected. Groups may overlap (e.g. a deepthroat LoRA is both a blowjob act and an audio LoRA). -LORA_CONFLICT_GROUPS = { - "penis anatomy": ["nsfw_penis", "nsfw_hmpenis_v2_0"], - "innie pussy": ["nsfw_innie", "nsfw_innie_pussy"], - "breast size/shape": ["nsfw_bustywomen", "nsfw_tiny_breasts_flat_chest", "nsfw_huge_breasts_large_breasts", - "nsfw_torpedo_tits_t2v", "nsfw_tiddies_and_realism_slider_vbeta", - "nsfw_natural_sagging_breasts", "nsfw_natural_saggy_boobs"], - "breast motion": ["nsfw_boob_physics", "nsfw_slop_bounce", "nsfw_jiggle_walk"], - "cameltoe": ["nsfw_cameltoe_v2_0", "nsfw_skin_tight_bottoms_cameltoe"], - "twerk": ["nsfw_icy_twerk_pro_max_v2_0", "nsfw_slop_twerk_v0_2_epoch6"], - "squirting": ["nsfw_hmmasturbation_squirting_and_female_mast", "nsfw_hmsquirt_squirting_v0_1"], - "blowjob act": ["nsfw_blowjob_v3_0", "nsfw_blowjob_wearing_thong", "nsfw_chasing_blowjob_v1_2", - "nsfw_sideview_deepthroat_gag_audio", "nsfw_deeper_hold_it", - "nsfw_licking_penis_and_testicles_nsfw_v1_2"], - "cumshot": ["nsfw_cumshot", "nsfw_facial_cumshot_v0_1"], - "scene transition": ["nsfw_transition_boomsplitro", "nsfw_transition_f2v_instant_cut_to_things"], - "moans (same LoRA, different training epochs)": ["nsfw_moawxx_female_pleasure_moans_body_writhi", - "nsfw_moawxx_female_pleasure_moans_body_writhi_2", - "nsfw_moawxx_female_pleasure_moans_body_writhi_3"], - "SexGod NaughtyTimes (same LoRA, different ranks)": ["nsfw_sexgod_s_naughtytimes_v2_0_pruned_rank25", - "nsfw_sexgod_s_naughtytimes_v2_0_pruned_rank51"], - "general NSFW enhancer": ["nsfw_astro_nsfw", "nsfw_mystic_xxx_v2_0", - "nsfw_sexgod_after_midnight_sexytime_r64", - "nsfw_sexgod_s_naughtytimes_v2_0_pruned_rank25", - "nsfw_sexgod_s_naughtytimes_v2_0_pruned_rank51"], - "visual style": ["nsfw_disney_style_renaissance_era", "nsfw_photorealistic_image_generator", - "nsfw_realism_people"], - "missionary POV": ["nsfw_missionary_sex_pov", "nsfw_pov_missionary_insertion_v0_7"], - "dildo": ["nsfw_dildo", "nsfw_dildo_masturbation_v2_0", "nsfw_strapon_dildo_v0_1"], - "audio": ["nsfw_jav_moans_audio_only", "nsfw_whispering", "nsfw_sideview_deepthroat_gag_audio"], - "hip motion": ["nsfw_grindtime", "nsfw_hip_gyration"], -} - -# Prompt → LoRA suggestion keywords (lowercase substrings). General quality enhancers are deliberately absent: -# they are not prompt-driven and would crowd out act-specific suggestions. -LORA_KEYWORDS = { - "nsfw_innie": ["innie", "tucked", "vulva", "pussy close"], - "nsfw_penis": ["penis", "erect", "cock", "dick", "male anatomy"], - "nsfw_dildo": ["dildo", "toy insertion", "penetrat"], - "nsfw_ahegao_face": ["ahegao", "eyes rolled", "tongue out", "orgasm face"], - "nsfw_all_tied_up": ["tied", "bondage", "bound", "rope", "restrained"], - "nsfw_auto_cunnilingus": ["self cunnilingus", "licking herself", "self oral"], - "nsfw_beanflk_masturbation_finger_insertion_au": ["masturbat", "fingering", "finger inside"], - "nsfw_better_titfuck_v0_95": ["titfuck", "tit fuck", "boobjob", "breasts around"], - "nsfw_blowjob_v3_0": ["blowjob", "oral", "sucking", "giving head"], - "nsfw_blowjob_wearing_thong": ["blowjob", "thong"], - "nsfw_bluebella_nova_lingerie": ["bluebella", "nova lingerie", "lace lingerie"], - "nsfw_boob_physics": ["boob", "breast", "jiggle", "bounce"], - "nsfw_bustywomen": ["busty", "big breasts", "large breasts", "curvy"], - "nsfw_button_pop": ["button pop", "buttons pop", "burst open", "tight top"], - "nsfw_cameltoe_v2_0": ["cameltoe", "tight bottoms"], - "nsfw_can_t_stop_shaking": ["shaking", "trembling", "overstimulat", "uncontrollable"], - "nsfw_chasing_blowjob_v1_2": ["blowjob", "eager", "chasing", "enthusiastic oral"], - "nsfw_combat_base_v2_0": ["fight", "combat", "wrestling", "grappling", "struggle"], - "nsfw_cum_swallow": ["swallow", "cum swallow", "swallowing"], - "nsfw_cumshot": ["cumshot", "cum shot", "ejaculat", "cum"], - "nsfw_deeper_hold_it": ["deepthroat", "deep throat", "deep oral"], - "nsfw_dildo_masturbation_v2_0": ["dildo", "masturbat", "solo"], - "nsfw_disney_style_renaissance_era": ["disney", "renaissance", "animated", "cartoon", "hand drawn"], - "nsfw_drone_shot": ["drone", "aerial", "overhead", "bird eye"], - "nsfw_facial_cumshot_v0_1": ["facial", "cum on face", "facial cumshot"], - "nsfw_faster_harder_shake_harder_v0_2": ["rough sex", "hard", "fast", "vigorous", "intense"], - "nsfw_fetish_submission_chain_teddy": ["latex", "submission", "chain teddy", "fetish outfit"], - "nsfw_fingering": ["fingering", "fingers inside", "manual stimulation"], - "nsfw_framerush": ["camera", "rush", "dynamic shot"], - "nsfw_furry_enhancer_video_v1_5": ["furry", "anthro", "animal"], - "nsfw_futanari_transformation_futanarization_v": ["futanari", "futa", "transformation", "grows a penis"], - "nsfw_grindtime": ["grinding", "grind", "riding", "hip"], - "nsfw_h3_footjob_v0": ["footjob", "feet", "foot"], - "nsfw_hmbreasts_v2_0": ["breasts", "tits", "boobs"], - "nsfw_hmmasturbation_squirting_and_female_mast": ["masturbat", "squirting", "solo"], - "nsfw_hmpenis_v2_0": ["penis", "cock", "dick"], - "nsfw_hmpussy_v1_0": ["pussy", "vulva", "vagina close"], - "nsfw_hmsquirt_squirting_v0_1": ["squirting", "squirt"], - "nsfw_hand_in_panties_masturbation": ["hand in panties", "masturbat", "panties"], - "nsfw_hip_gyration": ["hip", "gyrat", "grind"], - "nsfw_hip_sway_dance": ["dance", "dancing", "sway"], - "nsfw_hitachi_magic_wand_vibrator": ["hitachi", "magic wand", "vibrator"], - "nsfw_holi_festival_of_colors": ["holi", "festival", "colors", "powder", "paint"], - "nsfw_huge_breasts_large_breasts": ["huge breasts", "massive breasts", "large areolas"], - "nsfw_icy_ass_smacking": ["spank", "ass smack", "slap"], - "nsfw_icy_twerk_pro_max_v2_0": ["twerk", "twerking"], - "nsfw_innie_pussy": ["innie", "tucked", "vulva"], - "nsfw_jav_moans_audio_only": ["moan", "jav", "audio", "sound"], - "nsfw_jiggle_walk": ["walk", "jiggle", "bounce"], - "nsfw_kaku_table_humping": ["table", "humping", "furniture"], - "nsfw_lesbian_cunnilingus_v2_0": ["lesbian", "cunnilingus", "eating pussy", "oral on woman"], - "nsfw_licking_penis_and_testicles_nsfw_v1_2": ["licking", "testicles", "balls", "oral"], - "nsfw_mini_dick_fix_penis_helper": ["penis", "dick", "mini"], - "nsfw_missionary_sex_pov": ["missionary", "sex scene", "have sex", "pov"], - "nsfw_moawxx_female_pleasure_moans_body_writhi": ["moan", "pleasure", "writhing", "orgasm"], - "nsfw_moawxx_female_pleasure_moans_body_writhi_2": ["moan", "pleasure", "writhing", "orgasm"], - "nsfw_moawxx_female_pleasure_moans_body_writhi_3": ["moan", "pleasure", "writhing", "orgasm"], - "nsfw_natural_sagging_breasts": ["sagging", "saggy", "natural breasts", "mature"], - "nsfw_natural_saggy_boobs": ["saggy", "sagging", "titty drop", "bra"], - "nsfw_nipple_play": ["nipple", "pinch", "flick"], - "nsfw_pjslide_pussyjob": ["pussyjob", "pussy job", "sliding"], - "nsfw_pov_missionary_insertion_v0_7": ["missionary", "insertion", "pov", "sex scene"], - "nsfw_passionate_kissing": ["kiss", "kissing", "making out"], - "nsfw_photorealistic_image_generator": ["photorealistic", "photoreal"], - "nsfw_pillow_humping": ["pillow", "humping", "hump"], - "nsfw_pokies": ["pokies", "nipples", "tight top"], - "nsfw_polyhedron_perfect_eyes_perfect_skin_per": ["detailed eyes", "detailed skin", "perfect skin"], - "nsfw_realism_people": ["realistic", "realism", "natural"], - "nsfw_she_struts": ["strut", "walk", "confident"], - "nsfw_sideview_deepthroat_gag_audio": ["deepthroat", "gag", "deep throat"], - "nsfw_skin_tight_bottoms_cameltoe": ["cameltoe", "skin tight", "tight bottoms"], - "nsfw_slop_twerk_v0_2_epoch6": ["twerk", "twerking"], - "nsfw_slop_bounce": ["bounce", "jiggle", "shake", "breast"], - "nsfw_snow_white_lingerie": ["snow white", "lingerie"], - "nsfw_strapon_dildo_v0_1": ["strapon", "strap on", "dildo"], - "nsfw_synth_pussy_v0_5": ["synth", "stylized pussy", "synthetic"], - "nsfw_the_orgasm_button": ["orgasm", "remote", "button", "control"], - "nsfw_thumb_finger_puppets": ["puppet", "thumb", "finger puppet"], - "nsfw_thumbinbutt": ["anal", "thumb", "butt"], - "nsfw_tiddies_and_realism_slider_vbeta": ["tiddies", "breast size", "slider"], - "nsfw_tiny_breasts_flat_chest": ["flat chest", "tiny breasts", "small breasts", "petite"], - "nsfw_tiny_panties": ["tiny panties", "panties", "lingerie"], - "nsfw_torpedo_tits_t2v": ["torpedo", "pointy breasts"], - "nsfw_transition_boomsplitro": ["transition", "cut to", "scene cut", "spitroast"], - "nsfw_transition_f2v_instant_cut_to_things": ["transition", "cut to", "scene cut", "instant"], - "nsfw_tribtime": ["tribbing", "scissoring", "grinding"], - "nsfw_upskirt_helper_v0_1": ["upskirt", "skirt"], - "nsfw_whispering": ["whisper", "whispering"], -} - -# Must stay identical to the conditioner's table: the *label* goes over the wire, so a canvas that half does not know -# is rejected there and surfaces as a failure here. -CANVASES = { - # 16:9 - "960x544 · 16:9 fast": (544, 960), - "1024x576 · 16:9 fast": (576, 1024), - "1152x640 · 16:9": (640, 1152), - "1280x704 · 16:9": (704, 1280), - "1344x768 · 16:9 full": (768, 1344), - # 9:16 - "544x960 · 9:16 fast": (960, 544), - "640x1152 · 9:16": (1152, 640), - "768x1344 · 9:16 full": (1344, 768), - # 1:1 - "544x544 · 1:1 fast": (544, 544), - "768x768 · 1:1 full": (768, 768), - # 4:3 / 3:4 - "768x576 · 4:3 fast": (576, 768), - "1024x768 · 4:3 full": (768, 1024), - "576x768 · 3:4 fast": (768, 576), - "768x1024 · 3:4 full": (1024, 768), - # 21:9 - "1152x512 · 21:9 fast": (512, 1152), - "1536x672 · 21:9 full": (672, 1536), -} -DEFAULT_CANVAS = "960x544 · 16:9 fast" -FPS, FRAMES_PER_CHUNK, LATENTS_PER_CHUNK = 24, 17, 5 -# It is the *snapped* frame count the ceiling has to hold for: 15 s is 360 frames, which rounds up to 362, i.e. -# 15.083 s, and is refused. -MIN_UI_DURATION, MAX_UI_DURATION = 2, 14 - - -def snap_frames(seconds: float) -> int: - """The frame count MiniMax-H3's video VAE can decode: the next `17 * n + 5` at 24 fps.""" - frames = max(1, round(float(seconds) * FPS)) - while frames % FRAMES_PER_CHUNK != LATENTS_PER_CHUNK: - frames += 1 - return frames - - -def lower_duration_floor(seconds: float = MIN_UI_DURATION) -> None: - """Let the pipeline generate below its 5 s floor. 56 frames (2.33 s) is fine on the released checkpoint.""" - from diffusers.modular_pipelines.minimax_h3.modular_pipeline import MiniMaxH3ModularPipeline - - MiniMaxH3ModularPipeline.min_duration = property(lambda self: float(seconds)) - - -PIPE = None -MANAGER = None -LOAD_ERROR: str | None = None -LOADED_IN: float | None = None -TURBO_AVAILABLE: bool = False -_TURBO_LoRA: list | None = None # list of (module, A, B) tuples — A/B factors on CPU, tiny footprint -_TURBO_merged = False -_NSFW_LoRA: dict[str, list] = {} # key -> list of (module, A, B) tuples, A/B on CPU -_NSFW_merged: set[str] = set() - - -def _convert_comfyui_h3_lora(sd): - """Convert ComfyUI-format MiniMax-H3 LoRA keys to the module-tree keys the loader navigates. - - ComfyUI keys look like `diffusion_model.blocks.N.attn.out_proj.lora_A.weight` (and - `diffusion_model.token_refiner.blocks.N.attn.out_proj.lora_A.weight` for the token refiner). The diffusers module - tree uses `transformer_blocks.N.attn.to_out.0` / `token_refiner.refiner_blocks.N.attn.to_out.0`, `attn.to_q/to_k/to_v` - (fused `qkv_proj` split 3-way), and `ff.net.0.proj` / `ff.net.2` (for `mlp.fc1` / `mlp.fc2`). - """ - out = {} - for k, v in sd.items(): - k = k.removeprefix("diffusion_model.").removeprefix("transformer.") - parts = k.split(".") - # Main blocks: [blocks, N, attn|mlp, target, lora_A|B, weight] - # Token refiner: [token_refiner, blocks, N, attn|mlp, target, lora_A|B, weight] - if parts[0] == "token_refiner": - prefix = "token_refiner.refiner_blocks." - block, layer, target = parts[2], parts[3], parts[4] - suffix = ".".join(parts[5:]) # e.g. "lora_A.weight" - else: - prefix = "transformer_blocks." - block, layer, target = parts[1], parts[2], parts[3] - suffix = ".".join(parts[4:]) # e.g. "lora_A.weight" - # Some ComfyUI exports also carry kohya-style `.alpha` scalars (alpha == rank here, so a no-op). - # Skip any non-lora_A/B key so metadata never reaches the shape-sensitive qkv split below. - if suffix not in ("lora_A.weight", "lora_B.weight"): - continue - if layer == "attn": - if target == "out_proj": - out[f"{prefix}{block}.attn.to_out.0.{suffix}"] = v - elif target == "qkv_proj": - if suffix == "lora_A.weight": - # A is shared across q/k/v - for name in ("to_q", "to_k", "to_v"): - out[f"{prefix}{block}.attn.{name}.lora_A.weight"] = v - else: # lora_B.weight — split the rows 3-way into q/k/v - head_dim = v.shape[0] // 3 - for i, name in enumerate(("to_q", "to_k", "to_v")): - out[f"{prefix}{block}.attn.{name}.lora_B.weight"] = v[i * head_dim:(i + 1) * head_dim] - elif layer == "mlp": - if target == "fc1": - out[f"{prefix}{block}.ff.net.0.proj.{suffix}"] = v - elif target == "fc2": - out[f"{prefix}{block}.ff.net.2.{suffix}"] = v - return out - - -def _convert_kohya_h3_lora(sd): - """Convert kohya/musubi-tuner-format MiniMax-H3 LoRA keys to ComfyUI format, then to module-tree keys. - - kohya keys look like `lora_unet_blocks_N_attn_out_proj.lora_down.weight` / `.lora_up.weight` / `.alpha` - (also `attn_qkv_proj`, `mlp_fc1`, `mlp_fc2`). We first rename to the ComfyUI layout the loader already - understands (`diffusion_model.blocks.N.attn.out_proj.lora_A/lora_B.weight`), folding the per-module - `alpha/rank` factor into the `lora_up` (B) tensor so the loader's `B @ A * scale` stays correct, then - hand off to `_convert_comfyui_h3_lora`. kohya has no `token_refiner` keys — those are simply absent. - """ - import torch - comfy = {} - alphas: dict[str, float] = {} - # First pass: collect alpha factors (alpha/rank) per module base name. - for k, v in sd.items(): - if k.endswith(".alpha"): - base = k[: -len(".alpha")] - rank = v.shape[0] if hasattr(v, "shape") and v.ndim else float(v) - alphas[base] = float(v) / float(rank) - for k, v in sd.items(): - if k.endswith(".alpha"): - continue - if k.endswith(".lora_down.weight"): - base = k[: -len(".lora_down.weight")] - lora = "lora_A" - elif k.endswith(".lora_up.weight"): - base = k[: -len(".lora_up.weight")] - lora = "lora_B" - else: - continue - # base: lora_unet_blocks_N_attn_out_proj -> diffusion_model.blocks.N.attn.out_proj - parts = base.split("_") - # parts: [lora, unet, blocks, N, attn, out, proj] (mlp_fc1 -> [.., mlp, fc1]) - block = parts[3] - layer = parts[4] - target = "_".join(parts[5:]) - comfy_key = f"diffusion_model.blocks.{block}.{layer}.{target}.{lora}.weight" - if lora == "lora_B" and base in alphas: - v = v * alphas[base] - comfy[comfy_key] = v - return _convert_comfyui_h3_lora(comfy) - - -def _apply_turbo(): - """Merge LoRA into transformer weights using A/B factors. - - The precomputed delta (B @ A) is ~57 MB per module × 363 = ~20 GB — far more GPU memory - than is free after the transformer is unpacked (~14 GB on an 80 GB card). Instead we store - the LoRA factors A (~2.6 MB) and B (~2.6 MB) per module — total ~1.2 GB — and compute - the delta on-the-fly: mod.weight += B @ A * scale. Peak extra GPU memory is one temporary - delta tensor (~57 MB), freed each iteration. - """ - global _TURBO_merged, _TURBO_LoRA - if _TURBO_merged or _TURBO_LoRA is None: - return - _t0 = time.time() - # Lazy CUDA transfer of A/B factors on first call (~1.2 GB — fits easily). - if _TURBO_LoRA and _TURBO_LoRA[0][1].device.type != "cuda": - print(f"[gen] _apply_turbo: moving {len(_TURBO_LoRA)} A/B factor pairs to CUDA ...", flush=True) - for _i, (mod, A, B) in enumerate(_TURBO_LoRA): - _TURBO_LoRA[_i] = (mod, A.to("cuda", non_blocking=True), B.to("cuda", non_blocking=True)) - print(f"[gen] _apply_turbo: A/B on CUDA after {time.time() - _t0:.2f}s", flush=True) - for mod, A, B in _TURBO_LoRA: - # delta = B @ A is temporary (~57 MB), freed next iteration — never stored simultaneously. - mod.weight.data += (B @ A) * TURBO_LORA_SCALE - _elapsed = time.time() - _t0 - _TURBO_merged = True - print(f"[gen] turbo LoRA merged ({len(_TURBO_LoRA)} modules in {_elapsed:.2f}s)", flush=True) - - -def _remove_turbo(): - """Restore base weights by undoing the LoRA merge.""" - global _TURBO_merged - if not _TURBO_merged or _TURBO_LoRA is None: - return - _t0 = time.time() - for _i, (mod, A, B) in enumerate(_TURBO_LoRA): - if _i == 0: - print(f"[gen] _remove_turbo: mod.device={mod.weight.device}, A.device={A.device}", flush=True) - mod.weight.data -= (B @ A) * TURBO_LORA_SCALE - _elapsed = time.time() - _t0 - _TURBO_merged = False - print(f"[gen] turbo LoRA removed ({len(_TURBO_LoRA)} modules in {_elapsed:.2f}s)", flush=True) - - -def _ensure_nsfw_lora_loaded(key): - """Download + convert + store a lazy NSFW LoRA's A/B factors on CPU. No-op if already loaded.""" - if key in _NSFW_LoRA: - return - cfg = NSFW_LORA_CONFIGS[key] - import torch - from huggingface_hub import hf_hub_download - from safetensors.torch import load_file as _load_lora - print(f"[gen] loading NSFW LoRA {key} from {cfg['repo']} ...", flush=True) - _path = hf_hub_download(cfg["repo"], cfg["file"]) - _raw = _load_lora(_path) - if cfg.get("format") == "kohya": - _sd = _convert_kohya_h3_lora(_raw) - else: - _sd = _convert_comfyui_h3_lora(_raw) - _pairs: dict[str, dict[str, torch.Tensor]] = {} - for _k, _v in _sd.items(): - if ".lora_A." in _k: - _pairs.setdefault(_k.split(".lora_A.")[0], {})["A"] = _v - elif ".lora_B." in _k: - _pairs.setdefault(_k.split(".lora_B.")[0], {})["B"] = _v - _loaded = [] - for _base, _pair in _pairs.items(): - if "A" not in _pair or "B" not in _pair: - continue - _parts = _base.split(".") - _obj = PIPE.transformer - for _p in _parts: - _obj = _obj[int(_p)] if _p.isdigit() else getattr(_obj, _p) - _loaded.append((_obj, _pair["A"].to(_obj.weight.dtype), _pair["B"].to(_obj.weight.dtype))) - del _sd, _pairs - import gc as _gc; _gc.collect() - _NSFW_LoRA[key] = _loaded - print(f"[gen] NSFW LoRA {key} parsed ({len(_loaded)} modules)", flush=True) - - -def _apply_nsfw(key): - """Merge a loaded NSFW LoRA into transformer weights on GPU. Lazy CUDA transfer of A/B factors.""" - if key in _NSFW_merged or key not in _NSFW_LoRA: - return - scale = NSFW_LORA_CONFIGS[key]["scale"] - if _NSFW_LoRA[key] and _NSFW_LoRA[key][0][1].device.type != "cuda": - for _i, (_mod, _A, _B) in enumerate(_NSFW_LoRA[key]): - _NSFW_LoRA[key][_i] = (_mod, _A.to("cuda", non_blocking=True), _B.to("cuda", non_blocking=True)) - for _mod, _A, _B in _NSFW_LoRA[key]: - _mod.weight.data += (_B @ _A) * scale - _NSFW_merged.add(key) - - -def _remove_nsfw(key): - """Undo an NSFW LoRA merge.""" - if key not in _NSFW_merged or key not in _NSFW_LoRA: - return - scale = NSFW_LORA_CONFIGS[key]["scale"] - for _mod, _A, _B in _NSFW_LoRA[key]: - _mod.weight.data -= (_B @ _A) * scale - _NSFW_merged.discard(key) - - -def status() -> str: - if LOAD_ERROR: - return LOAD_ERROR - if PIPE is None: - return f"Loading `{MODEL_REPO}` (transformer + VAEs, 77.3 GB). Watch the Space logs." - import h3_aoti - - return ( - f"Ready · transformer + VAEs **bfloat16, unquantized** · placement `{PLACEMENT}` · attention `{ATTENTION}` · " - f"{h3_aoti.status()} · loaded in {LOADED_IN:.0f}s · conditioner `{CONDITIONER_SPACE}`" - ) - - -def load_models() -> str | None: - """Load the denoising half at startup. - - `MiniMaxH3GeneratorBlocks` declares `transformer`, `vae`, `audio_vae`, the two schedulers and `video_processor`, - so `load_components` fetches exactly those subfolders — `text_encoder/` and `transformer_ref/` are never touched. - Both autoencoders carry `_keep_in_fp32_modules` over every module and stay float32: a bfloat16 audio VAE decodes - the soundtrack roughly 20 dB too quiet. - """ - global PIPE, MANAGER, LOAD_ERROR, LOADED_IN - - if PIPE is not None or LOAD_ERROR is not None: - return LOAD_ERROR - - started = time.time() - try: - import torch - from huggingface_hub import hf_hub_download - from diffusers import ComponentsManager - - from h3_split_blocks import MiniMaxH3GeneratorBlocks - - lower_duration_floor() - manager = ComponentsManager() - blocks = MiniMaxH3GeneratorBlocks() - print(f"[gen] loading {[c.name for c in blocks.expected_components]} from {MODEL_REPO} ...", flush=True) - pipe = blocks.init_pipeline(MODEL_REPO, components_manager=manager, collection="h3") - pipe.load_components(dtype=torch.bfloat16) - pipe.transformer.set_attention_backend(ATTENTION) - - if TURBO_LORA_REPO: - from safetensors.torch import load_file as _load_lora - - print(f"[gen] loading turbo LoRA from {TURBO_LORA_REPO} ...", flush=True) - _lora_path = hf_hub_download(TURBO_LORA_REPO, TURBO_LORA_FILE) - _lora_sd = _load_lora(_lora_path) - - # Group LoRA A/B pairs by target module name. - _lora_pairs: dict[str, dict[str, torch.Tensor]] = {} - for _k, _v in _lora_sd.items(): - if ".lora_A." in _k: - _base = _k.split(".lora_A.")[0] - _lora_pairs.setdefault(_base, {})["A"] = _v - elif ".lora_B." in _k: - _base = _k.split(".lora_B.")[0] - _lora_pairs.setdefault(_base, {})["B"] = _v - - # Store LoRA A/B factors on CPU (~1.2 GB total). The full delta (B @ A) would be - # ~20 GB and overflow GPU memory when moved to CUDA inside @spaces.GPU (~14 GB free). - # Instead _apply_turbo computes the delta on-the-fly: one temporary ~57 MB tensor - # per module, freed each iteration. - global TURBO_AVAILABLE, _TURBO_LoRA - _TURBO_LoRA = [] - for _base_name, _pair in _lora_pairs.items(): - if "A" not in _pair or "B" not in _pair: - continue - _base_name = _base_name.removeprefix("transformer.") - _parts = _base_name.split(".") - _obj = pipe.transformer - for _p in _parts: - _obj = _obj[int(_p)] if _p.isdigit() else getattr(_obj, _p) - _A = _pair["A"].to(_obj.weight.dtype) # (rank, in_features) - _B = _pair["B"].to(_obj.weight.dtype) # (out_features, rank) - _TURBO_LoRA.append((_obj, _A, _B)) - - del _lora_sd, _lora_pairs - import gc as _gc; _gc.collect() - TURBO_AVAILABLE = True - print(f"[gen] turbo LoRA parsed ({len(_TURBO_LoRA)} modules, merge pending)", flush=True) - if _TURBO_LoRA: - _m, _A, _B = _TURBO_LoRA[0] - print(f"[gen] sample: module={type(_m).__name__}, " - f"A.shape={_A.shape}, B.shape={_B.shape}, " - f"A.device={_A.device}, dtype={_A.dtype}", flush=True) - - # Still startup, still free: an AoTI package carries no weights and opens its archive lazily inside the GPU - # worker. Off unless `H3_AOTI=1`. - import h3_aoti - - h3_aoti.maybe_load(pipe.transformer) - - if PLACEMENT == "pack": - # Scoped to the transformer. `spaces` packs every startup-resident CUDA tensor into a second on-disk copy, - # and packing all 77.3 GB busts the 150 GB storage quota; the 61.7 GB transformer alone fits. The ~10 GB of - # fp32 VAEs move on the first GPU call instead. - pipe.transformer.to("cuda") - - if PLACEMENT == "offload": - manager.enable_auto_cpu_offload(device="cuda") - _arm_decode_hooks(pipe) - - PIPE, MANAGER = pipe, manager - LOADED_IN = time.time() - started - print(f"[gen] ready in {LOADED_IN:.0f}s", flush=True) - except Exception as error: - traceback.print_exc() - LOAD_ERROR = f"**Loading `{MODEL_REPO}` failed** after {time.time() - started:.0f}s: `{type(error).__name__}: {error}`" - return LOAD_ERROR - - -def _arm_decode_hooks(pipe): - """Make the offload hooks fire for the two VAEs. - - `enable_auto_cpu_offload` wraps `forward`, and the decode blocks call `vae.decode(...)` directly, so the hook - never runs and the VAE is still on the host when the latents arrive on the card. - """ - for name in ("vae", "audio_vae"): - module = getattr(pipe, name) - inner = module.decode - - def armed(*args, _module=module, _decode=inner, **kwargs): - hook = getattr(_module, "_hf_hook", None) - if hook is not None: - hook.pre_forward(_module) - return _decode(*args, **kwargs) - - module.decode = armed - - -@cache -def conditioner(): - """The other half, over the gradio API. `gradio_client` attaches the caller's own ZeroGPU token per call, so the - conditioner's booking is billed to whoever asked for the video.""" - from gradio_client import Client - - return Client(CONDITIONER_SPACE) - - -def encode_remote(prompt, image_path, last_image_path, canvas, num_frames, rewrite_prompt=False): - """`/encode` on the conditioner Space: a safetensors file holding `prompt_embeds` + `text_token_tags`, with the - resolved `height` / `width` / `num_frames` in its metadata, plus the plan. `canvas` is the label.""" - from gradio_client import handle_file - from safetensors import safe_open - - path, plan = conditioner().predict( - prompt=prompt, - image_path=handle_file(image_path) if image_path else None, - last_image_path=handle_file(last_image_path) if last_image_path else None, - canvas=canvas, - num_frames=num_frames, - rewrite_prompt=bool(rewrite_prompt), - api_name="/encode", - ) - with safe_open(path, framework="pt") as handle: - metadata = handle.metadata() - return handle.get_tensor("prompt_embeds"), handle.get_tensor("text_token_tags"), metadata, plan - - -# Seconds of GPU one request needs, from the packed video rows it is about to denoise: linear in the rows for the -# matmuls, quadratic for the attention, against the AoTI block package this Space runs. -_DUR_B, _DUR_C = 1.1745e-4, 3.8396e-9 -# The two resident decoders and the mux, which scale with the output rather than with the step count. -_DECODE_BASE, _DECODE_PER_DEFAULT_CANVAS, _DEFAULT_CANVAS_PIXELS = 15, 15, 960 * 544 * 124 -# `pack` mode: only the ~10 GB of VAEs move on a cold worker. -_PLACEMENT_ALLOWANCE, _PAD = 12, 10 -# First turbo merge transfers ~1.2 GB of LoRA A/B factors CPU→CUDA inside @spaces.GPU; budget extra time. -_TURBO_MERGE_BONUS = 120 - - -def get_duration(prompt_embeds, text_token_tags, image, last_image, height, width, num_frames, steps, seed, *a, **k): - height, width, num_frames, steps = int(height), int(width), int(num_frames), int(steps) - latent_frames = (num_frames - LATENTS_PER_CHUNK) // FRAMES_PER_CHUNK * LATENTS_PER_CHUNK + 2 - patches = (height // 32) * (width // 32) - rows = latent_frames * patches + (int(image is not None) + int(last_image is not None)) * patches - denoise = steps * (_DUR_B * rows + _DUR_C * rows**2) - decode = _DECODE_BASE + _DECODE_PER_DEFAULT_CANVAS * (height * width * num_frames) / _DEFAULT_CANVAS_PIXELS - # First turbo merge transfers ~1.2 GB of LoRA A/B factors CPU→CUDA inside @spaces.GPU. - turbo_bonus = _TURBO_MERGE_BONUS if k.get("turbo") and TURBO_AVAILABLE and not _TURBO_merged else 0 - return max(60, int(denoise + decode) + _PLACEMENT_ALLOWANCE + _PAD + turbo_bonus) - - -@spaces.GPU(duration=get_duration, size=GPU_SIZE) -def _generate(prompt_embeds, text_token_tags, image, last_image, height, width, num_frames, steps, seed, turbo=False, nsfw_keys=()): - """The only thing on GPU time: the packed-sequence denoise loop and the two decoders. - - Only the three generated outputs come back — a `@spaces.GPU` return crosses a process boundary by pickling, and - the full `PipelineState` still holds the packed latents, the rotary grid and the row indices on the card. - """ - import torch - - print(f"[gen] _generate ENTER: turbo={turbo}, TURBO_AVAILABLE={TURBO_AVAILABLE}, " - f"_TURBO_merged={_TURBO_merged}, steps={steps}, {width}x{height}, {num_frames}f", flush=True) - - if PLACEMENT == "lazy": - PIPE.to("cuda") - elif PLACEMENT == "pack": - PIPE.vae.to("cuda") - PIPE.audio_vae.to("cuda") - - # Merge LoRA inside @spaces.GPU where the real weights are live on CUDA (in pack mode, - # ZeroGPU unpacks the real transformer weights before calling this function). - if turbo and TURBO_AVAILABLE: - print("[gen] _generate: calling _apply_turbo ...", flush=True) - _apply_turbo() - print("[gen] _generate: _apply_turbo done", flush=True) - for _key in nsfw_keys: - _apply_nsfw(_key) - try: - print(f"[gen] _generate: starting PIPE (steps={steps}) ...", flush=True) - state = PIPE( - prompt_embeds=prompt_embeds.to("cuda"), - text_token_tags=text_token_tags, - image=image, - last_image=last_image, - height=height, - width=width, - num_frames=num_frames, - num_inference_steps=int(steps), - generator=torch.Generator("cpu").manual_seed(int(seed) if int(seed) >= 0 else torch.randint(0, 2**32, (1,)).item()), - ) - print("[gen] _generate: PIPE done", flush=True) - finally: - for _key in nsfw_keys: - _remove_nsfw(_key) - if turbo and TURBO_AVAILABLE: - _remove_turbo() - return state.get("videos")[0], state.get("audio")[0].cpu(), state.get("sampling_rate") - - -def generate(prompt, image_path=None, last_image_path=None, canvas=DEFAULT_CANVAS, duration=5, steps=25, seed=-1, upsample=False, turbo=False, nsfw_lora_keys=(), progress=gr.Progress(track_tqdm=True)): - """One request. `upsample` is last and defaults off, so a positional API client that predates it is unaffected.""" - if LOAD_ERROR: - raise gr.Error(LOAD_ERROR) - if PIPE is None: - raise gr.Error("The denoiser is still loading.") - if not prompt or not prompt.strip(): - raise gr.Error("MiniMax-H3 always takes a prompt, keyframes or not.") - - from PIL import Image, ImageOps - - from diffusers.utils import encode_video - - num_frames = snap_frames(duration) - - if turbo and TURBO_AVAILABLE: - steps = 7 # 7 sigma points → 6 transformer evaluations (sweet spot for larryvrh v4-step600-EMA) - - # LoRAs the user selected via the catalog dropdown; the AIO motion adapter is auto-loaded whenever any is on. - nsfw_keys = tuple(k for k in (nsfw_lora_keys or ()) if k in NSFW_LORA_CONFIGS) - if nsfw_keys: - nsfw_keys += ("nsfw_aio",) - for _key in nsfw_keys: - _ensure_nsfw_lora_loaded(_key) - for _key in nsfw_keys: - # The trigger token must be in the prompt text for the conditioner to encode the LoRA's concept. - prompt = f"{prompt}, {NSFW_LORA_CONFIGS[_key]['trigger']}" - - progress(0.0, desc=f"Upsampling the prompt on {CONDITIONER_SPACE} ..." if upsample else f"Conditioning on {CONDITIONER_SPACE} ...") - conditioned = time.time() - prompt_embeds, text_token_tags, metadata, plan = encode_remote( - prompt, image_path, last_image_path, canvas, num_frames, rewrite_prompt=upsample - ) - condition_seconds = time.time() - conditioned - height, width, num_frames = (int(metadata[key]) for key in ("height", "width", "num_frames")) - refined = plan.get("refined_prompt") or "" - - def keyframe(path): - # The conditioning latents encoded here have to be of the image the conditioner looked at, which it prepares - # exactly this way. - return ImageOps.exif_transpose(Image.open(path)).convert("RGB") if path else None - - progress(0.1, desc=f"Denoising {steps} steps at {width}x{height}, {num_frames} frames ...") - started = time.time() - frames, audio, sampling_rate = _generate( - prompt_embeds, - text_token_tags, - keyframe(image_path), - keyframe(last_image_path), - height, - width, - num_frames, - steps, - seed, - turbo, - nsfw_keys=nsfw_keys, - ) - generate_seconds = time.time() - started - - directory = os.path.join(tempfile.gettempdir(), "h3-outputs") - os.makedirs(directory, exist_ok=True) - path = os.path.join(directory, f"h3-{int(time.time() * 1000)}.mp4") - encode_video(frames, fps=FPS, output_path=path, audio=audio, audio_sample_rate=sampling_rate) - - lora_note = " · LoRA: " + ", ".join(NSFW_LORA_CONFIGS[k]["trigger"] for k in nsfw_keys) if nsfw_keys else "" - lora_label_text = "**LoRAs applied:** " + ", ".join(NSFW_LORA_CONFIGS[k]["label"] for k in nsfw_keys) if nsfw_keys else "" - report = ( - f"`{width}x{height}`, {num_frames} frames ({num_frames / FPS:.3f} s), {int(steps)} steps · " - f"conditioner {condition_seconds:.0f}s ({plan['num_text_tokens']} tokens" - f"{', upsampled' if refined else ''}) · " - f"denoise + decode {generate_seconds:.0f}s ({generate_seconds / int(steps):.1f} s/step) · seed {int(seed)}" - f"{lora_note}" - ) - print(f"[gen] {report}", flush=True) - return path, report, refined, gr.update(visible=bool(refined)), gr.DownloadButton(value=path, visible=True), gr.update(value=lora_label_text, visible=bool(nsfw_keys)) - - -def export_last_frame(video_path): - """Extract the last frame from a generated video and return it as an image file.""" - if not video_path: - raise gr.Error("No video to extract from.") - import subprocess, tempfile - out = os.path.join(tempfile.gettempdir(), f"h3-lastframe-{int(time.time() * 1000)}.png") - result = subprocess.run( - ["ffmpeg", "-sseof", "-0.1", "-i", video_path, "-frames:v", "1", "-y", out], - capture_output=True, text=True, - ) - if result.returncode != 0: - raise gr.Error(f"ffmpeg failed: {result.stderr[-300:]}") - return out - - -def _fit_keyframe(image_path, current_canvas): - """Cover-crop an uploaded keyframe to the closest supported aspect ratio and select that ratio's smallest - (fastest) canvas, unless the user already picked a matching ratio.""" - if not image_path: - return gr.update(), gr.update() - from PIL import Image as _Image - - img = _Image.open(image_path) - aspect = img.width / img.height - fastest = {} - for label, (h, w) in CANVASES.items(): - r = w / h - if r not in fastest or w * h < fastest[r][1][0] * fastest[r][1][1]: - fastest[r] = (label, (h, w)) - ratio = min(fastest, key=lambda r: abs(r - aspect)) - label, (h, w) = fastest[ratio] - - cur_h, cur_w = CANVASES[current_canvas] - if abs(cur_w / cur_h - aspect) <= abs(ratio - aspect): - label = current_canvas - h, w = cur_h, cur_w - - target = w / h - if abs(img.width / img.height - target) <= 1e-3: - return gr.update(value=image_path), gr.update(value=label) - if img.width / img.height > target: - new_w = int(img.height * target) - left = (img.width - new_w) // 2 - img = img.crop((left, 0, left + new_w, img.height)) - else: - new_h = int(img.width / target) - top = (img.height - new_h) // 2 - img = img.crop((0, top, img.width, top + new_h)) - img.save(image_path) - return gr.update(value=image_path), gr.update(value=label) - - -load_models() - -INTRO = """# minimax h3 turbo + lora's - -
- [ model ]   - [ blog ]   - [ reference to video ] -
- -**MiniMax-H3** is a 33B parameter state of the art video generation model that produces video and a -fully synchronized soundtrack (ambience, foley, speech). - -**Turbo mode** (optional) applies the [larryvrh distillation LoRA](https://huggingface.co/InstantX/MiniMax-H3-Turbo-Lora-Diffusers) -at generation time, reducing inference from 25 steps to 7 for ~4× faster generation with minimal quality loss. -""" - -CSS = """ -.main.fillable { max-width: 1250px !important; } - -/* ── Root gradient background ── */ -.dark .gradio-container { - background: linear-gradient(135deg, #0a1628 0%, #0d2137 25%, #0f2b3a 50%, #0e3330 75%, #0a2a1f 100%) !important; - color: #e8f0f8 !important; - min-height: 100vh; - - /* ── Override Gradio's CSS variables for dark theme ── */ - --background-fill-primary: rgba(10, 22, 40, 0.6) !important; - --background-fill-secondary: rgba(10, 22, 40, 0.4) !important; - --block-background-fill: rgba(10, 22, 40, 0.5) !important; - --block-border-color: rgba(79, 195, 247, 0.15) !important; - --block-label-text-color: #a8c4d8 !important; - --block-title-text-color: #a8c4d8 !important; - --background-text-color: #e0edf5 !important; - --body-text-color: #e0edf5 !important; - --body-text-color-subdued: #8aa8bc !important; - --border-color-primary: rgba(79, 195, 247, 0.15) !important; - --color-accent: #26a69a !important; - --color-accent-soft: rgba(38, 166, 154, 0.15) !important; - --button-primary-background-fill: linear-gradient(135deg, #0288d1 0%, #00897b 50%, #2e7d32 100%) !important; - --button-primary-text-color: #ffffff !important; - --button-secondary-background-fill: rgba(255, 255, 255, 0.06) !important; - --button-secondary-border-color: rgba(255, 255, 255, 0.1) !important; - --button-secondary-text-color: #b0c8dc !important; - --input-background-fill: rgba(10, 22, 40, 0.6) !important; - --input-background-fill-focus: rgba(10, 22, 40, 0.7) !important; - --input-border-color: rgba(79, 195, 247, 0.15) !important; - --input-border-color-focus: rgba(79, 195, 247, 0.45) !important; - --slider-color: #26a69a !important; - --accordion-border-color: rgba(255, 255, 255, 0.06) !important; -} - -/* ── Intro markdown ── */ -.gradio-container .prose h1, -.gradio-container .prose h2 { - background: linear-gradient(135deg, #4fc3f7, #26a69a) !important; - -webkit-background-clip: text !important; - -webkit-text-fill-color: transparent !important; - background-clip: text !important; -} -.gradio-container .prose { - color: #c8dde8 !important; -} -.gradio-container .prose a { - color: #4dd0e1 !important; -} - -/* ── Glass card panels (no backdrop-filter on .block — it traps fixed-position dropdown popups) ── */ -.gradio-container .block { - background: rgba(255, 255, 255, 0.04) !important; - border: 1px solid rgba(255, 255, 255, 0.08) !important; - border-radius: 14px !important; - box-shadow: 0 4px 30px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255,255,255,0.05) !important; -} - -/* ── Text / Number inputs (Gradio 6: label.container > .input-container > textarea/input) ── */ -.gradio-container label.container textarea, -.gradio-container label.container input[type="text"], -.gradio-container input[type="number"] { - background: rgba(10, 22, 40, 0.6) !important; - border: 1px solid rgba(79, 195, 247, 0.15) !important; - color: #e0edf5 !important; - border-radius: 10px !important; -} -.gradio-container label.container textarea:focus, -.gradio-container label.container input[type="text"]:focus, -.gradio-container input[type="number"]:focus { - border-color: rgba(79, 195, 247, 0.45) !important; - box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.12) !important; -} - -/* ── Labels (Gradio 6: BlockTitle renders ) ── */ -.gradio-container [data-testid="block-info"], -.gradio-container label { - color: #a8c4d8 !important; - font-weight: 500 !important; -} - -/* ── Slider track ── */ -.gradio-container input[type="range"] { - accent-color: #26a69a !important; -} - -/* ── Checkbox (Gradio 6: