stable-diffusion-webui
stable-diffusion-webui copied to clipboard
Use parse_known_args in modules/shared.py for better WSGI support.
Describe what this pull request is trying to achieve.
When running in a WSGI environment (e.g. with gunicorn
) there will often be additional, unknown command line args in scope. Without this change, unknown command line args will fail at initialization time.
Additional notes and description of your changes
Using parse_known_args()
instead of parse_args()
allows broader usage with standard hosting patterns such as gunicorn
.
Environment this was tested in
OS: Linux
Merging this in would make the program not error out when the user types an argument incorrectly. I would rather keep that than support some unicorn.
Merging this in would make the program not error out when the user types an argument incorrectly. I would rather keep that than support some unicorn.
Hmm, could we put disabling strict arg parsing behind an environment variable for minimal disruption to existing code? I believe hosting behind a proxy is common enough to merit a fix for this use case.
Yeah, that's a good idea. I was thinking about adding a commandline arg and handling it in launch, bit this is simpler.
Thank you for the fix.
https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Command-Line-Arguments-and-Settings