For ComfyUI users

#6
by Meryruizk - opened

USE EULER + BETA instead of res_Multistep because res_multistep give disco lights.

If you're using the portable version of python, place this script in the python_embeded folder along with the lora from this repo and run:

python.exe convert_h3_lora_for_comfyui.py MiniMax-H3-Turbo-Lora.safetensors MiniMax-H3-Turbo-Lora_comfy.safetensors

It works with the bf16 and int8 (non-pruned) versions only — pruned versions are working too just ignore the adaln_proj.linear.weight shape errors.

import sys
from safetensors.torch import load_file, save_file

def convert(in_path: str, out_path: str, prefix: str = "diffusion_model."):
    sd = load_file(in_path)

    new_sd = {}
    skipped = 0
    for k, v in sd.items():
        if k.startswith(prefix):
            new_key = k  # already prefixed, leave as-is
            skipped += 1
        else:
            new_key = prefix + k
        new_sd[new_key] = v

    save_file(new_sd, out_path)

    print(f"Converted {len(sd)} keys ({skipped} already had the prefix).")
    print("Sample before -> after:")
    for i, k in enumerate(list(sd.keys())[:3]):
        print(f"  {k}  ->  {prefix + k if not k.startswith(prefix) else k}")
    print(f"\nSaved: {out_path}")

if __name__ == "__main__":
    if len(sys.argv) != 3:
        print(__doc__)
        sys.exit(1)
    convert(sys.argv[1], sys.argv[2])

worked with pruned, but audio suffer

worked with pruned, but audio suffer

For me it's not working and giving errors. Though let me check again.

worked with pruned, but audio suffer

Thanks for letting me know I tested and yes it is working, I updated my message above to reflect the change.

Also general recommendation for current version (using Euler + Beta) I currently find around 1.8 to 2.2 strength gives the most accurate result

Also general recommendation for current version (using Euler + Beta) I currently find around 1.5 to 1.8 strength gives the most accurate result

Yes, I forgot to mention it, because res_multistep on 4 steps just gives weird light effects

Meryruizk changed discussion status to closed
Meryruizk changed discussion status to open

We almost there

We almost there

Hell yeah! And this is not even final version of lora its still being trained.

We almost there

try 10 step! it almost comparable to 20 step already

We almost there

Those broken audio are most likely due to comfyui stock scheduler, i just updated the readme about this.

do you mind sharing your workflow? still getting a very noisy result

Those broken audio are most likely due to comfyui stock scheduler, i just updated the readme about this.

Do generate.py use ComyUi memory management? if so, then we can use it even with 8gb Vram otherwise I have no hope. lol, because my card is 8GB

do you mind sharing your workflow? still getting a very noisy result

On 4 steps the results are still not that great, because the lora is not yet completely trained.
And make sure to use Euler Sampler with beta scheduler, fast motion is still so noisy, still shots are much better right now with this lora.

Tested some more 8 steps looks good

Tested some more 8 steps looks good

are you using anything else beside lora? sage attention or spectrum ?

Tested some more 8 steps looks good

are you using anything else beside lora? sage attention or spectrum ?

Sageattention and sol-attn only

can confirm that the lora works with GGUF format but audio indeed suffers on res_multistep

We almost there

Those broken audio are most likely due to comfyui stock scheduler, i just updated the readme about this.

@larryvrh Could you please provide the correct ComfyUI workflow to facilitate subsequent testing ?

Update: Problem solved!

I replaced the LoRa with this converted version to run on ComfyUI, and it worked incredibly well. Very fast generation and with excellent quality! ( https://huggingface.co/QrusherZA/H3_Turbo_ComfyUI/tree/main ). Use the node "Power LoRa Loader"..I'm using a 720 x 720 resolution, 4 or 6 steps, and Euler - beta. Another tip to speed things up even more is to use the "spectrum apply minimax h3" node; it's amazing, it almost halves the generation time and has very little quality loss! ;)

We almost there

Those broken audio are most likely due to comfyui stock scheduler, i just updated the readme about this.

@larryvrh Could you please provide the correct ComfyUI workflow to facilitate subsequent testing ?

done :)

Sign up or log in to comment