Sign In

How to Script Merge Flow Quickly for Colab

How to Script Merge Flow Quickly for Colab

Link to the scripter is HERE!

Hi, I'm Chattiori (Merge creator of BismuthMix, AnyOrangeMix, CloverMix and LunaReality).

As you can see, I made a lot of merges in almost half an year (include the one on HuggingFace, there are about 50 merges).

Recently, I made the model merger called Chattiori's Model Merger, which (I think) it's far better than any other mergers despite how fast and how wide it can do and it runs only with a single cmd line.

But because of that, I can clearly say that this is not easy to script by yourself.

So, I made a GUI scripter that creates merge flow.

For recent models (since LunaReality Series), I use this scripter and allows me to decrease the time to make scripts from an hour to around 5 minutes.

The following is the time I spent for making the same merge model using this script and using webui with super mergers.

(Script writing + Download model + Merge time >> Sum)

Sum Twice, ChillyMix-V2 + midmix-v2.0 + AddictiveFuture_Realistic_SemiAsian-V1, alpha(0.5) beta(0.5)

  1. (webui + super merger) 4:51 + 3:16 + 2:27 >> 10 min. 34 sec.

  2. (using this script) 1:21 + 1:42 + 1:14 >> 5 min. 17 sec.

From this, I can definitely say that it'll help you make merge a lot faster.

On this, I'm going to introduce how to use it and utilize the merge.

! Disclaimer !

Currently, I cannot utilize loading XL models so if you want to use it, I recommend using super merger.

Step 0: Requirements

Step 1: Fetch Data from Civitai

  1. Open database_fetch.py

  2. Fill the field to get the right setting of fetching and making local database.

    • Query: Quick Search

    • Tag: Tag

    • Username: Username

    • Type: Type of model (Please use Checkpoint)

    • Sort: Sorting of the search (Highest%20Rated, Most%20Downloaded, Most%20Liked, Most%20Discussed, Newest)

    • Period: Period of model uploaded

    • Rating: The least rating number (0.0~5.0)

    • Page: The first page offset

    • Limit: Limit number of models to make local database(101~)

    • Output: Output json file name

    • Allow XL: Please leave it unchecked

  3. Press Start

Step 2: Write down Merge Flow

  1. Open make_recipe.py

  2. Fill the field to get the merge flow

    • Input: The JSON file's name without extension

    • VAE: VAE file's name

    • VAE_URL: The URL of VAE file

    • Recipe: The name of merge flow file

    • Markdown: The name of credit file

    • HTML: HTML version of Markdown

    • Output: The final name of the merge

    • Least_Most: The value of rand ratio (Least-Most)

    • Token: Your HuggingFace Token

    • NameRepo: Your HF repo (Name/Repo)

    • Plan: Plan/Flow of the merge

      • Listed Models: Start with LIST: and write the exact models by ID,ID,...

      • Random Number Models: Start with RANDNUM: and write the least-most amount

      • Planned Flow: Start with PLAN: and write the merge in the following format:

        For Weighted Sum, Final:WS,ID+ID,LEAST_A:MOST_A:SEED_A

        For Sum Twice, Final:ST,ID+ID+ID,LEAST_A:MOST_A:SEED_A|LEAST_B:MOST_B:SEED_B

        And break each one of them with ,%

        For Example,

        Sum Twice, real-max-v3.4 + GeminiX Mix v1.0 + Kawaii Realistic Asian Mix v0.3, rand_alpha(0.3, 0.6, 69420) rand_beta(0.2, 0.4, 42069) >> 00a

        Sum Twice, Shampoo Mix-v4.0 + majicMix realistic-v6 + CyberRealistic-v3.1, rand_alpha(0.3, 0.6, 664728) rand_beta(0.2, 0.7, 883528) >> 00b

        Would be 00a:ST,60188+52602+83766,0.3:0.6:69420|0.2:0.4:42069,%00b:ST,33918+43331+15003,0.3:0.6:664728|0.2:0.7:883528

      • Number Of Model: Just write the number of model without anything

  3. Press Start

Step 3: Copy and Paste

Open and Copy and Paste the contents on each files to each pages

  • Open Recipe with text editor and copy it to Colab Notebook

  • Open Markdown with text editor and copy it to HuggingFace

  • Open HTML with browser and copy it to Civitai

Now, Execute the notebook to get the merge

2

Comments