29325a7214
Around the time we (I) implemented pydantic events, I noticed a short pause between progress images every 4 or 5 steps when generating with SDXL. It didn't happen with SD1.5, but I did notice that with SD1.5, we'd get 4 or 5 progress events simultaneously. I'd expect one event every ~25ms, matching my it/s with SD1.5. Mysterious! Digging in, I found an issue is related to our use of a synchronous queue for events. When the event queue is empty, we must call `asyncio.sleep` before checking again. We were sleeping for 100ms. Said another way, every time we clear the event queue, we have to wait 100ms before another event can be dispatched, even if it is put on the queue immediately after we start waiting. In practice, this means our events get buffered into batches, dispatched once every 100ms. This explains why I was getting batches of 4 or 5 SD1.5 progress events at once, but not the intermittent SDXL delay. But this 100ms wait has another effect when the events are put on the queue in intervals that don't perfectly line up with the 100ms wait. This is most noticeable when the time between events is >100ms, and can add up to 100ms delay before the event is dispatched. For example, say the queue is empty and we start a 100ms wait. Then, immediately after - like 0.01ms later - we push an event on to the queue. We still need to wait another 99.9ms before that event will be dispatched. That's the SDXL delay. The easy fix is to reduce the sleep to something like 0.01 seconds, but this feels kinda dirty. Can't we just wait on the queue and dispatch every event immediately? Not with the normal synchronous queue - but we can with `asyncio.Queue`. I switched the events queue to use `asyncio.Queue` (as seen in this commit), which lets us asynchronous wait on the queue in a loop. Unfortunately, I ran into another issue - events now felt like their timing was inconsistent, but in a different way than with the 100ms sleep. The time between pushing events on the queue and dispatching them was not consistently ~0ms as I'd expect - it was highly variable from ~0ms up to ~100ms. This is resolved by passing the asyncio loop directly into the events service and using its methods to create the task and interact with the queue. I don't fully understand why this resolved the issue, because either way we are interacting with the same event loop (as shown by `asyncio.get_running_loop()`). I suppose there's some scheduling magic happening. |
||
---|---|---|
.dev_scripts | ||
.github | ||
coverage | ||
docker | ||
docs | ||
installer | ||
invokeai | ||
scripts | ||
tests | ||
.dockerignore | ||
.editorconfig | ||
.git-blame-ignore-revs | ||
.gitattributes | ||
.gitignore | ||
.gitmodules | ||
.pre-commit-config.yaml | ||
.prettierrc.yaml | ||
flake.lock | ||
flake.nix | ||
InvokeAI_Statement_of_Values.md | ||
LICENSE | ||
LICENSE-SD1+SD2.txt | ||
LICENSE-SDXL.txt | ||
Makefile | ||
mkdocs.yml | ||
pyproject.toml | ||
README.md | ||
Stable_Diffusion_v1_Model_Card.md |
Invoke - Professional Creative AI Tools for Visual Media
To learn more about Invoke, or implement our Business solutions, visit invoke.com
Invoke is a leading creative engine built to empower professionals and enthusiasts alike. Generate and create stunning visual media using the latest AI-driven technologies. Invoke offers an industry leading web-based UI, and serves as the foundation for multiple commercial products.
Invoke is available in two editions:
Community Edition | Professional Edition |
---|---|
For users looking for a locally installed, self-hosted and self-managed service | For users or teams looking for a cloud-hosted, fully managed service |
- Free to use under a commercially-friendly license | - Monthly subscription fee with three different plan levels |
- Download and install on compatible hardware | - Offers additional benefits, including multi-user support, improved model training, and more |
- Includes all core studio features: generate, refine, iterate on images, and build workflows | - Hosted in the cloud for easy, secure model access and scalability |
Quick Start -> Installation and Updates | More Information -> www.invoke.com/pricing |
Documentation
Quick Links |
---|
Installation and Updates - Documentation and Tutorials - Bug Reports - Contributing |
Quick Start
-
Download and unzip the installer from the bottom of the latest release.
-
Run the installer script.
- Windows: Double-click on the
install.bat
script. - macOS: Open a Terminal window, drag the file
install.sh
from Finder into the Terminal, and press enter. - Linux: Run
install.sh
.
- Windows: Double-click on the
-
When prompted, enter a location for the install and select your GPU type.
-
Once the install finishes, find the directory you selected during install. The default location is
C:\Users\Username\invokeai
for Windows or~/invokeai
for Linux/macOS. -
Run the launcher script (
invoke.bat
for Windows,invoke.sh
for macOS and Linux) the same way you ran the installer script in step 2. -
Select option 1 to start the application. Once it starts up, open your browser and go to http://localhost:9090.
-
Open the model manager tab to install a starter model and then you'll be ready to generate.
More detail, including hardware requirements and manual install instructions, are available in the installation documentation.
Docker Container
We publish official container images in Github Container Registry: https://github.com/invoke-ai/InvokeAI/pkgs/container/invokeai. Both CUDA and ROCm images are available. Check the above link for relevant tags.
Important
Ensure that Docker is set up to use the GPU. Refer to NVIDIA or AMD documentation.
Generate!
Run the container, modifying the command as necessary:
docker run --runtime=nvidia --gpus=all --publish 9090:9090 ghcr.io/invoke-ai/invokeai
Then open http://localhost:9090
and install some models using the Model Manager tab to begin generating.
For ROCm, add --device /dev/kfd --device /dev/dri
to the docker run
command.
Persist your data
You will likely want to persist your workspace outside of the container. Use the --volume /home/myuser/invokeai:/invokeai
flag to mount some local directory (using its absolute path) to the /invokeai
path inside the container. Your generated images and models will reside there. You can use this directory with other InvokeAI installations, or switch between runtime directories as needed.
DIY
Build your own image and customize the environment to match your needs using our docker-compose
stack. See README.md in the docker directory.
Troubleshooting, FAQ and Support
Please review our FAQ for solutions to common installation problems and other issues.
For more help, please join our Discord.
Features
Full details on features can be found in our documentation.
Web Server & UI
Invoke runs a locally hosted web server & React UI with an industry-leading user experience.
Unified Canvas
The Unified Canvas is a fully integrated canvas implementation with support for all core generation capabilities, in/out-painting, brush tools, and more. This creative tool unlocks the capability for artists to create with AI as a creative collaborator, and can be used to augment AI-generated imagery, sketches, photography, renders, and more.
Workflows & Nodes
Invoke offers a fully featured workflow management solution, enabling users to combine the power of node-based workflows with the easy of a UI. This allows for customizable generation pipelines to be developed and shared by users looking to create specific workflows to support their production use-cases.
Board & Gallery Management
Invoke features an organized gallery system for easily storing, accessing, and remixing your content in the Invoke workspace. Images can be dragged/dropped onto any Image-base UI element in the application, and rich metadata within the Image allows for easy recall of key prompts or settings used in your workflow.
Other features
- Support for both ckpt and diffusers models
- SD1.5, SD2.0, and SDXL support
- Upscaling Tools
- Embedding Manager & Support
- Model Manager & Support
- Workflow creation & management
- Node-Based Architecture
Contributing
Anyone who wishes to contribute to this project - whether documentation, features, bug fixes, code cleanup, testing, or code reviews - is very much encouraged to do so.
Get started with contributing by reading our contribution documentation, joining the #dev-chat or the GitHub discussion board.
We hope you enjoy using Invoke as much as we enjoy creating it, and we hope you will elect to become part of our community.
Thanks
Invoke is a combined effort of passionate and talented people from across the world. We thank them for their time, hard work and effort.
Original portions of the software are Copyright © 2024 by respective contributors.