Gourieff / sd-webui-reactor

Fast and Simple Face Swap Extension for StableDiffusion WebUI (A1111 SD WebUI, SD WebUI Forge, SD.Next, Cagliostro)
GNU Affero General Public License v3.0
2.17k stars 235 forks source link

Update install.py Optimized Installer #372

Closed ranareehanaslam closed 2 months ago

ranareehanaslam commented 2 months ago

Key Changes and Optimizations:

  1. Consolidated Import Logic: Simplified how models_path is determined by sequentially attempting to import from different modules and falling back to a default path.

  2. Simplified Command Execution: Introduced a run_command function to reduce redundancy when calling subprocess for pip installations and uninstallations.

  3. Enhanced Package Check: Streamlined is_installed to optionally check for a minimum version, using the packaging library for accurate version comparison.

  4. Streamlined Model Download: The download process now directly checks if the model file exists before attempting to download, avoiding unnecessary downloads.

  5. Simplified ONNX Runtime Installation: The install_ort function now dynamically selects and installs the appropriate version of ONNX Runtime based on the availability of CUDA and its version.

  6. Requirements Installation: The requirements installation process is encapsulated within install_requirements, simplifying the main logic and ensuring all dependencies are installed or updated as needed.

This optimized script aims to make the installation process more efficient, readable, and maintainable, ensuring that dependencies are correctly managed and the necessary models are downloaded as required.

Gourieff commented 2 months ago

Thanks for your PR, but

Path.cwd()

We don't need to have models inside the ReActor's directory

"last_device" - is very important part as well as other things you cut - they shouldn't be cut

There's no need to simplify this script because it works super correctly and takes into account many nuances which are really necessary for the current version and functionality

"Don't touch what works correctly" - this is a good phrase indeed :)