1.2.0 • Published 2 years ago

@leomaradan/sd-tools v1.2.0

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

SD Tools

"Here's looking at you, kid."

Welcome to the SD Tools, your all-in-one command line interface for interacting with the AUTOMATIC1111's Stable Diffusion Web UI. This tool brings a robust queue system and a variety of commands to streamline your workflow with Stable Diffusion.

"May the Force be with you."

Queue System: The Ultimate Power

Our queue system is as versatile as a Jedi Master. With it, you can:

  • Load JSON or JS Files: Queue your prompts with ease.
  • Control Image Naming: Take charge of your image names with custom formatting.
  • Extension Management: Seamlessly handle extensions like ControlNet, Adetailers, MultiDiffusion, Scheduler Assistant, or Cutoff.
  • Basic to Advanced Scripting: Whether it's simple JSON scripting or full-blown prompt generation scripts, we've got you covered.
  • Permutations Galore: Generate multiple prompts with a single instruction, multiplying parameters like never before.
  • Cascading Prompts Files: Share common bases and build upon them effortlessly.
  • Automated Behaviors: Trigger actions like Adetailers, ControlNet Poses, and Cutoff tokens automatically.
  • And more!: Maybe I'll document it later.

"I'll be back."

Additional Commands: More Than Meets the Eye

Our tool offers several powerful commands to enhance your workflow:

  • Rename: Rename images in bulk using generation parameters and custom rules from JSON.
  • Extract: Extract prompts from lists of images into text or JSON formats.
  • Upscale: Upscale images from a directory using ControlNet Tiles or MultiDiffusion.
  • Redraw: Redraw images from a directory with specific styles using ControlNet ip-adapter or Lineart.

"To infinity and beyond!"

Getting Started

  1. Ensure nodejs exists (> 18.x):
node -v
  1. Install the dependencies:

NPM:

npm install -g @leomaradan/sd-tools

YARN:

yarn global add @leomaradan/sd-tools
  1. Run AUTOMATIC1111 with --api:

Windows

cd <automatic1111 folder>
webui-user.bat --api

Unix

cd <automatic1111 folder>
./webui.sh --api
  1. Run the Tool:
    ./sd-tools init

"Why so serious?"

Usage Examples

  • Queue Command:

    sd-tools queue your_prompts.json

    Allowed parameters:

    • --silent: Do not display anything in the terminal
    • --no-log: Don't log the queries output to a file
    • --verbose: Display additional information in the terminal
    • --simulate: Run the whole process but don't send the queries to the API
    • -v, --validate: Only validate the prompts file
  • Rename Command:

    sd-tools rename <source> <target>

    Allowed parameters:

    • --silent: Do not display anything in the terminal
    • --no-log: Don't log the queries output to a file
    • --verbose: Display additional information in the terminal
    • -c, --config: Configuration file for renaming images.
    • -k, --keys: keys to search for. Allowed formats: "key:value" or "key:value1;value2"
    • -p, --pattern: Replace pattern
    • -t, --test: Test mode
  • Extract Command:

    sd-tools extract <source> <format = textbox | json>

    Allowed parameters:

    • --silent: Do not display anything in the terminal
    • --no-log: Don't log the queries output to a file
    • --verbose: Display additional information in the terminal
    • -a, --add-before: Add a string before the extracted text. Use | to add multiple texts and generate multiple outputs
    • -o, --output: Optional output file. If not provided, the output will be displayed in the terminal
    • -r, --recursive: Recursively extract from from sub-directories
  • Upscale Command:

    sd-tools upscale <source> <style = controlnet | tiled-diffusion>

    Allowed parameters:

    • --silent: Do not display anything in the terminal
    • --no-log: Don't log the queries output to a file
    • --verbose: Display additional information in the terminal
    • --simulate: Run the whole process but don't send the queries to the API
    • -c, --checkpoint: Force a specific checkpoint
    • -d, --denoising: Denoising factor. If multiple values are provided, the command will generate multiple queries
    • -t, --recursive: Recursively upscale images from sub-directories
    • -x, --upscaling: Upscaling factor. If multiple values are provided, the command will generate multiple queries
  • Redraw Command:

    sd-tools redraw <source> <style = realism | anime | both> <method = classical | ip-adapter | both>

    Allowed parameters:

    • --silent: Do not display anything in the terminal
    • --no-log: Don't log the queries output to a file
    • --verbose: Display additional information in the terminal
    • --simulate: Run the whole process but don't send the queries to the API
  • Other Commands:

    Init the tools, or force refreshing the cache

    sd-tools init

    Allowed parameters:

    • -e, --endpoint: Endpoint to use. Default is http://127.0.0.1:7860
    • -f, --force: Force reset config
    • -p, --purge-cache: Purge the cache

    Get or set the configs

    sd-tools config-get <key>
    sd-tools config-set <key> <value>

    Running the configuration wizard

    sd-tools wizard

"I'm the king of the world!"

Contributing

We welcome contributions from everyone! Whether it's bug fixes, feature additions, or documentation improvements, feel free to submit a pull request.

"Hasta la vista, baby."

License

This project is licensed under the MIT License. See the LICENSE file for details.

"Houston, we have a problem."

Troubleshooting

If you encounter any issues, check out our Wiki or open an issue on GitHub.

Please be aware that this tool is still in development, and some features may not be fully implemented or may change in the future. It works on my PC, bye the way


Enjoy your journey with the SD Tools, and remember, the only limit is your imagination!