Panchovix / stable-diffusion-webui-reForge

GNU Affero General Public License v3.0
287 stars 10 forks source link

[Feature Request]: Please add --models-dir option #15742 from upstream A1111 #87

Closed aoleg closed 1 month ago

aoleg commented 1 month ago

Is there an existing issue for this?

What would your feature do ?

A1111 1.10 adds --models-dir option, which allows sharing the "models" folder across different WebUI installations. Currently, both A1111 WebUI and WebUI Forge support this feature, yet reForge currently does not. Please consider merging this pull request to add the feature: https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15742

Proposed workflow

The --model-dir option overrides the location of the models directory for stable diffusion, so that models can be shared across multiple installations. When --data-dir is specified alone, both the extensions and models folders are present in this folder. --models-dir can be used independently, but when used with --data-dir, models are found in --models-dir, and extensions are under --data-dir.

Additional information

https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15742

Panchovix commented 1 month ago

Hi there, thanks for the suggestion. I was just testing this the other day and I'm not sure why --data-dir is getting ignored. Will check it out when I have time, but not even the debugger is giving me any signs haha.

aoleg commented 1 month ago

Hi there, thanks for the suggestion. I was just testing this the other day and I'm not sure why --data-dir is getting ignored. Will check it out when I have time, but not even the debugger is giving me any signs haha.

It is not the "--data-dir" being ignored, it's the complete "--models-dir" pull is missing from reForge. You can easily check the "modules/cmd_args.py" file. Both A1111 and WebUI Forge have this line:

parser.add_argument("--data-dir", type=normalized_filepath, default=os.path.dirname(os.path.dirname(os.path.realpath(__file__))), help="base path where all user data is stored")
parser.add_argument("--models-dir", type=normalized_filepath, default=None, help="base path where models are stored; overrides --data-dir")
parser.add_argument("--config", type=normalized_filepath, default=sd_default_config, help="path to config which constructs model",)

While reForge has this:

parser.add_argument("--data-dir", type=normalized_filepath, default=os.path.dirname(os.path.dirname(os.path.realpath(__file__))), help="base path where all user data is stored")
parser.add_argument("--config", type=normalized_filepath, default=sd_default_config, help="path to config which constructs model",)

Note that you need the entire pull request https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15742 and not just one line from the "modules/cmd_args.py" file.

aoleg commented 1 month ago

Basically, these are the changes required: https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15742/files/5fbac49791d9a4a6af85c8236ba9179d7415e0f9

Panchovix commented 1 month ago

Basically, these are the changes required: https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/15742/files/5fbac49791d9a4a6af85c8236ba9179d7415e0f9

Wow you're correct! Well paths_internal is updated, but cmd_args wasn't, not sure how I missed it. Can you try if it works as it should now in your case?

EDIT: it seems data-dir works correctly, but model-dir maybe don't. I need confirmation haha

aoleg commented 1 month ago

EDIT: it seems data-dir works correctly, but model-dir maybe don't. I need confirmation haha

I am testing --models-dir, and it seems to be working. I have also tested --models-dir together with separate --ckpt-dir and --lora-dir, and it seems to be working, too.

Panchovix commented 1 month ago

Perfect, that fixes the issue then. Thanks for the update.