Skip to content

Select command line arguments upon starting the sd-webui

Notifications You must be signed in to change notification settings

Nenotriple/sd-webui-user-selector

Repository files navigation

webui-user-selector.bat

Select command-line arguments when starting AUTOMATIC1111's sd-webui

webui-user-selector_example

For more information on command-line arguments that can be used in this .bat file, please refer to this wiki page.

AUTOMATIC1111 sd-webui - Command-Line Arguments and Settings

How to use

Simply place the webui-user-selector.bat file in the "stable-diffusion-webui" folder and double-click it.

(There's no need to replace the original webui-user.bat file)

🍰 EASY WAY: Edit/Add/Remove Options

  1. Download the included Python script webui-user-selector_EDITOR.py, and run it once to create the settings template.

  2. Edit the webui-user-selector_settings.txt file with the options you want.

    • Follow the provided pattern (it's easy).
    • You can simply copy the Option blocks or delete them; just make sure they're numbered correctly.
    • Use AND to run another command, like call git pull.
  3. When you're done, run the Python script again to create/edit the webui-user-selector.bat file.

⛰️ HARD WAY: Edit/Add/Remove Options

Understanding the .bat File

In the provided .bat file, there are several options (1-4) that a user can select. Each option corresponds to a different set of commands that will be executed.

Here is the full example batch script:

@echo off

set PYTHON=
set GIT=
set VENV_DIR=

echo Please select an option:

echo 1) xformers                        (Fastest)
echo 2) xformers + medvram              (Slower)
echo 3) xformers + lowvram              (Slowest)
echo 4) Update                          (git pull, reinstall xformers, reinstall torch)

choice /C 1234 /N /M "Choice (1-4): "

if errorlevel 4 (
    echo Updating...
    set COMMANDLINE_ARGS= --reinstall-xformers --reinstall-torch --xformers
    call git pull
) else if errorlevel 3 (
    echo Starting...
    set COMMANDLINE_ARGS= --xformers --lowvram
) else if errorlevel 2 (
    echo Starting...
    set COMMANDLINE_ARGS= --xformers --medvram
) else if errorlevel 1 (
    echo Starting...
    set COMMANDLINE_ARGS= --xformers
)

call webui.bat

Editing an Option

Right click the .bat file and select Edit.

To edit an option, you need to change the commands that are executed when that option is selected. For example, if you want to change what happens when option 1 is selected, you would edit the following section:

) else if errorlevel 1 (
    echo Starting...
    set COMMANDLINE_ARGS= --xformers
)

You can replace --xformers with any other command you want to execute, or add additional commands.

After editing the else if errorlevel block you should update the echo line that corresponds to the option name.


Adding an Option

To add an option, you need to add another else if errorlevel block. For example, if you want to add an option 5, you would add the following section:

) else if errorlevel 5 (
    echo Starting...
    set COMMANDLINE_ARGS= --new-option
)

After adding a new option you should update/add the echo line that corresponds to the option name.


Removing an Option

To remove an option, simply delete the corresponding else if errorlevel block. Then update the appropriate echo and choice lines.


Important Note

Whenever you add or remove an option, remember to update the choice /C 1234 /N /M "Choice (1-4): " line. The /C parameter should include all possible choices. For example, if you have 5 options, it should be choice /C 12345 /N /M "Choice (1-5): ".

About

Select command line arguments upon starting the sd-webui

Topics

Resources

Stars

Watchers

Forks