SwarmUI
SwarmUI (formerly StableSwarmUI), A Modular Stable Diffusion Web-User-Interface, with an emphasis on making powertools easily accessible, high performance, and extensibility.
Top Related Projects
TensorFlow Tutorial and Examples for Beginners (support TF v1 & v2)
An Open Source Machine Learning Framework for Everyone
Deep Learning for humans
Tensors and Dynamic neural networks in Python with strong GPU acceleration
scikit-learn: machine learning in Python
Quick Overview
SwarmUI is a React-based UI library that provides a set of components and utilities for building swarm-based user interfaces. It aims to simplify the development of complex, dynamic, and interactive user interfaces by leveraging the power of swarm algorithms.
Pros
- Swarm-based Approach: SwarmUI's swarm-based approach allows for the creation of dynamic and responsive user interfaces that can adapt to changing conditions and user interactions.
- Reusable Components: The library provides a collection of reusable UI components that can be easily integrated into your React-based projects.
- Customization: SwarmUI offers a high degree of customization, allowing developers to tailor the appearance and behavior of the UI components to fit their specific needs.
- Performance: The library is designed with performance in mind, utilizing efficient algorithms and techniques to ensure smooth and responsive user experiences.
Cons
- Learning Curve: Developers new to swarm-based UI concepts may face a steeper learning curve when adopting SwarmUI.
- Dependency on React: SwarmUI is tightly coupled with the React framework, which may limit its use in non-React-based projects.
- Limited Documentation: The project's documentation could be more comprehensive, making it challenging for new users to get started quickly.
- Potential Performance Issues: While the library is designed for performance, complex or heavily-used swarm-based UIs may still encounter performance challenges in certain scenarios.
Code Examples
Here are a few code examples demonstrating the usage of SwarmUI components:
import React from 'react';
import { SwarmGrid, SwarmNode } from 'swarm-ui';
const MyGrid = () => {
return (
<SwarmGrid>
<SwarmNode>Node 1</SwarmNode>
<SwarmNode>Node 2</SwarmNode>
<SwarmNode>Node 3</SwarmNode>
</SwarmGrid>
);
};
This example shows how to create a simple grid layout using the SwarmGrid
and SwarmNode
components.
import React from 'react';
import { SwarmForce, SwarmNode } from 'swarm-ui';
const MyForceLayout = () => {
return (
<SwarmForce>
<SwarmNode>Node 1</SwarmNode>
<SwarmNode>Node 2</SwarmNode>
<SwarmNode>Node 3</SwarmNode>
</SwarmForce>
);
};
This example demonstrates the use of the SwarmForce
component to create a force-directed layout for the nodes.
import React from 'react';
import { SwarmCircle, SwarmNode } from 'swarm-ui';
const MyCircularLayout = () => {
return (
<SwarmCircle>
<SwarmNode>Node 1</SwarmNode>
<SwarmNode>Node 2</SwarmNode>
<SwarmNode>Node 3</SwarmNode>
</SwarmCircle>
);
};
This example shows how to use the SwarmCircle
component to arrange the nodes in a circular layout.
Getting Started
To get started with SwarmUI, follow these steps:
- Install the library using npm or yarn:
npm install swarm-ui
- Import the necessary components and utilities in your React project:
import { SwarmGrid, SwarmNode } from 'swarm-ui';
- Use the SwarmUI components in your JSX code:
<SwarmGrid>
<SwarmNode>Node 1</SwarmNode>
<SwarmNode>Node 2</SwarmNode>
<SwarmNode>Node 3</SwarmNode>
</SwarmGrid>
- Customize the appearance and behavior of the components by passing in the appropriate props:
<SwarmNode color="#ff0000" size={50}>
Custom Node
</SwarmNode>
- Refer to the project's documentation for more advanced usage and configuration options.
Competitor Comparisons
TensorFlow Tutorial and Examples for Beginners (support TF v1 & v2)
Pros of TensorFlow-Examples
- Comprehensive collection of TensorFlow examples covering a wide range of machine learning topics
- Well-organized and easy to navigate, with clear documentation and explanations
- Actively maintained with regular updates and contributions from the community
Cons of TensorFlow-Examples
- Primarily focused on TensorFlow, which may not be suitable for users interested in other machine learning frameworks
- Some examples may be outdated or not compatible with the latest version of TensorFlow
- Limited support for more advanced or specialized use cases
Code Comparison
TensorFlow-Examples (Linear Regression):
import tensorflow as tf
import numpy as np
# Create sample data
X = np.array([3.3, 4.4, 5.5, 6.71, 6.93, 4.168, 9.779, 6.182, 7.59, 2.167, 7.042, 10.791, 5.313, 7.997, 5.654, 9.27, 3.1])
Y = np.array([1.7, 2.76, 2.09, 3.19, 1.694, 1.573, 3.366, 2.596, 2.53, 1.221, 2.827, 3.465, 1.65, 2.904, 2.42, 2.94, 1.3])
# Build the linear regression model
model = tf.keras.models.Sequential([
tf.keras.layers.Dense(units=1, input_shape=[1])
])
model.compile(optimizer='sgd', loss='mean_squared_error')
# Train the model
model.fit(X, Y, epochs=500)
SwarmUI (Particle Swarm Optimization):
import numpy as np
import matplotlib.pyplot as plt
def objective_function(x):
return x**2
# Initialize particles
n_particles = 20
x = np.random.uniform(-10, 10, (n_particles, 1))
v = np.random.uniform(-1, 1, (n_particles, 1))
pbest = x.copy()
gbest = pbest[0]
pbest_fitness = np.apply_along_axis(objective_function, axis=1, arr=pbest)
gbest_fitness = np.min(pbest_fitness)
# Optimize
for i in range(100):
# Update velocity and position
v = 0.9 * v + 2 * np.random.rand() * (pbest - x) + 2 * np.random.rand() * (gbest - x)
x = x + v
# Update personal and global best
new_fitness = np.apply_along_axis(objective_function, axis=1, arr=x)
pbest[new_fitness < pbest_fitness] = x[new_fitness < pbest_fitness]
pbest_fitness = np.minimum(pbest_fitness, new_fitness)
if np.min(new_fitness) < gbest_fitness:
gbest = x[np.argmin(new_fitness)]
gbest_fitness = np.min(new_fitness)
An Open Source Machine Learning Framework for Everyone
Pros of TensorFlow
- TensorFlow is a widely-used and well-established machine learning framework, with a large and active community.
- It offers a comprehensive set of tools and libraries for building and deploying machine learning models.
- TensorFlow has extensive documentation, tutorials, and resources available, making it easier for developers to get started and learn.
Cons of TensorFlow
- TensorFlow can have a steeper learning curve compared to some other machine learning libraries, especially for beginners.
- The codebase of TensorFlow is relatively large and complex, which can make it more challenging to understand and customize.
Code Comparison
TensorFlow:
import tensorflow as tf
# Create a simple neural network
model = tf.keras.Sequential([
tf.keras.layers.Dense(64, activation='relu', input_shape=(10,)),
tf.keras.layers.Dense(32, activation='relu'),
tf.keras.layers.Dense(1)
])
# Compile the model
model.compile(optimizer='adam', loss='mean_squared_error')
SwarmUI:
import swarmui
# Create a simple UI element
button = swarmui.Button(
text="Click me",
on_click=lambda: print("Button clicked!")
)
# Add the button to the UI
swarmui.add_element(button)
Deep Learning for humans
Pros of Keras
- Keras is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano. This makes it a popular choice for deep learning projects.
- Keras has a large and active community, with extensive documentation and a wealth of pre-built models and examples.
- Keras is known for its simplicity and ease of use, making it a great choice for beginners in the field of deep learning.
Cons of Keras
- Keras is primarily focused on deep learning, and may not be the best choice for other types of machine learning tasks.
- Keras is built on top of other deep learning frameworks, which can add an extra layer of complexity for users who need to work with the underlying frameworks directly.
- Keras may not offer as much flexibility and control as lower-level deep learning frameworks like TensorFlow or PyTorch.
Code Comparison
Keras:
from keras.models import Sequential
from keras.layers import Dense, Activation
model = Sequential()
model.add(Dense(64, input_dim=20))
model.add(Activation('relu'))
SwarmUI:
from swarmui.core import SwarmUI
from swarmui.components import Button, Slider
app = SwarmUI()
button = Button(label="Click me")
slider = Slider(label="Adjust value", value=50)
app.add_component(button)
app.add_component(slider)
app.run()
Tensors and Dynamic neural networks in Python with strong GPU acceleration
Pros of PyTorch
- PyTorch is a widely-used, open-source machine learning library that provides a flexible and intuitive interface for building and training neural networks.
- It has a large and active community, with extensive documentation, tutorials, and pre-trained models available.
- PyTorch is known for its dynamic computational graphs, which allow for more flexible and efficient model development.
Cons of PyTorch
- PyTorch can have a steeper learning curve compared to some other machine learning frameworks, especially for beginners.
- The library can be resource-intensive, particularly for large-scale models or datasets, which may require more powerful hardware.
Code Comparison
PyTorch (5 lines):
import torch
import torch.nn as nn
class MyModel(nn.Module):
def __init__(self):
super(MyModel, self).__init__()
self.fc = nn.Linear(10, 5)
SwarmUI (5 lines):
import swarmui as ui
class MyWidget(ui.Widget):
def __init__(self):
super().__init__()
self.label = ui.Label("Hello, SwarmUI!")
scikit-learn: machine learning in Python
Pros of scikit-learn
- Extensive documentation and community support
- Wide range of machine learning algorithms and models
- Efficient and optimized for performance
Cons of scikit-learn
- Steep learning curve for beginners
- Limited support for deep learning and neural networks
- Primarily focused on traditional machine learning tasks
Code Comparison
scikit-learn
from sklearn.datasets import load_iris
from sklearn.tree import DecisionTreeClassifier
iris = load_iris()
X, y = iris.data, iris.target
clf = DecisionTreeClassifier()
clf.fit(X, y)
SwarmUI
from swarmui.core import SwarmUI
from swarmui.widgets import Button, Slider
app = SwarmUI()
button = Button(label="Click me")
slider = Slider(label="Adjust value")
app.add_widget(button)
app.add_widget(slider)
app.run()
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
SwarmUI
SwarmUI v0.9.5 Beta.
Formerly known as StableSwarmUI.
A Modular AI Image Generation Web-User-Interface, with an emphasis on making powertools easily accessible, high performance, and extensibility. Supports AI image models (Stable Diffusion, Flux, etc.), and AI video models (LTX-V, Hunyuan Video, Cosmos, Wan, etc.), with plans to support eg audio and more in the future.
- Discord Community: Join the Discord to discuss the project, get support, see announcements, etc.
- Announcements: Follow the Feature Announcements Thread for updates on new features.
- General documentation: /docs folder
- Website: SwarmUI.net
Status
This project is in Beta status. This means for most tasks, Swarm has excellent tooling available to you, but there is much more planned. Swarm is recommended as an ideal UI for most users, beginners and pros alike. There are still some things to be worked out.
Beginner users will love Swarm's primary Generate tab interface, making it easy to generate anything with a variety of powerful features. Advanced users may favor the Comfy Workflow tab to get the unrestricted raw graph, but will still have reason to come back to the Generate tab for convenience features (image editor, auto-workflow-generation, etc) and powertools (eg Grid Generator).
Those interested in helping push Swarm from Beta to a Full ready-for-anything perfected Release status are welcome to submit PRs (read the Contributing document first), and you can contact us here on GitHub or on Discord. I highly recommend reaching out to ask about plans for a feature before PRing it. There may already be specific plans or even a work in progress.
Key feature targets not yet implemented:
- Better mobile browser support
- full detail "Current Model" display in UI, separate from the model selector (probably as a tab within the batch sidebar?)
- LLM-assisted prompting (there's an extension for it, but LLM control should be natively supported)
- convenient direct-distribution of Swarm as a program (Tauri, Blazor Desktop, or an Electron app?)
Try It On Google Colab
Google Colab
WARNING: Google Colab does not necessarily allow remote WebUIs, particularly for free accounts, use at your own risk.
Colab link if you want to try Swarm: https://colab.research.google.com/github/mcmonkeyprojects/SwarmUI/blob/master/colab/colab-notebook.ipynb
Run it on a Cloud GPU Provider
Runpod
Runpod template (note: maintained by third party contributor nerdylive123): https://runpod.io/console/deploy?template=u7mlkrmxq3&ref=c6jd6jj0
Vast.ai
Vast.ai template (readme): https://cloud.vast.ai/?ref_id=62897&creator_id=62897&name=SwarmUI
Note it may take several minutes to start up the first time. Check the container logs to see setup progress. Check the template ?
info for hints on how to use.
Installing on Windows
Note: if you're on Windows 10, you may need to manually install git and DotNET 8 SDK first. (Windows 11 this is automated).
- Download The Install-Windows.bat file, store it somewhere you want to install at (not
Program Files
), and run it.- It should open a command prompt and install itself.
- If it closes without going further, try running it again, it sometimes needs to run twice. (TODO: Fix that)
- It will place an icon on your desktop that you can use to re-launch the server at any time.
- When the installer completes, it will automatically launch the SwarmUI server, and open a browser window to the install page.
- Follow the install instructions on the page.
- After you submit, be patient, some of the install processing take a few minutes (downloading models and etc).
(TODO): Even easier self-contained pre-installer, a .msi
or .exe
that provides a general install screen and lets you pick folder and all.
Alternate Manual Windows Install
- Install git from https://git-scm.com/download/win
- Install DotNET 8 SDK from https://dotnet.microsoft.com/en-us/download/dotnet/8.0 (Make sure to get the SDK x64 for Windows)
- open a terminal to the folder you want swarm in and run
git clone https://github.com/mcmonkeyprojects/SwarmUI
- open the folder and run
launch-windows.bat
Installing on Linux
-
Install
git
,python3
via your OS package manager if they are not already installed (make sure to includepip
andvenv
on distros that do not include them in python directly)- For example, on recent Ubuntu versions,
sudo apt install git python3-pip python3-venv
- For example, on recent Ubuntu versions,
-
Download the install-linux.sh file, store it somewhere you want to install at, and run it
- If you like terminals, you can open a terminal to the folder and run the following commands:
wget https://github.com/mcmonkeyprojects/SwarmUI/releases/download/0.6.5-Beta/install-linux.sh -O install-linux.sh
chmod +x install-linux.sh
- If you like terminals, you can open a terminal to the folder and run the following commands:
-
Run the
./install-linux.sh
script, it will install everything for you and eventually open the webpage in your browser. -
Follow the install instructions on-page.
-
You can at any time in the future run the
launch-linux.sh
script to re-launch Swarm. -
If the page doesn't open itself, you can manually open
http://localhost:7801
Alternate Manual Linux Install
- Install
git
,python3
via your OS package manager if they are not already installed (make sure to includepip
andvenv
on distros that do not include them in python directly)- For example, on recent Ubuntu versions,
sudo apt install git python3-pip python3-venv
- You'll want Python 3.11. Things should also work fine with 3.10 or 3.12. Do not use 3.13.
- For example, on recent Ubuntu versions,
- Install DotNET 8 using the instructions at https://dotnet.microsoft.com/en-us/download/dotnet/8.0 (you need
dotnet-sdk-8.0
, as that includes all relevant sub-packages)- Some users have said that certain Linux distros expect
aspnet-runtime
to be installed separately
- Some users have said that certain Linux distros expect
- Open a shell terminal and
cd
to a directory you want to install into - Run shell commands:
git clone https://github.com/mcmonkeyprojects/SwarmUI
- cd
SwarmUI
./launch-linux.sh
- or if running on a headless server,
./launch-linux.sh --launch_mode none --host 0.0.0.0
and/or swap host for cloudflared
- open
http://localhost:7801/Install
(if it doesn't launch itself) - Follow the install instructions on-page.
(TODO): Maybe outlink a dedicated document with per-distro details and whatever. Maybe also make a one-click installer for Linux?
Installing on Mac
Note: You can only run SwarmUI on Mac computers with M-Series Apple silicon processors (eg M1, M2, ...).
- Open Terminal.
- Ensure your
brew
packages are updated withbrew update
. - Verify your
brew
installation withbrew doctor
. You should not see any error in the command output. - Install .NET for macOS:
brew install dotnet
. - If you don't have Python, install it:
brew install python@3.11
andbrew install virtualenv
- Python 3.11, 3.10, 3.12 are all fine. 3.13 is not, do not use 3.13.
- Change the directory (
cd
) to the folder where you want to install SwarmUI. - Clone the SwarmUI GitHub repository:
git clone https://github.com/mcmonkeyprojects/SwarmUI
. cd SwarmUI
and run the installation script:./launch-macos.sh
.- Wait for the web browser to open, and follow the install instructions on-page.
Installing With Docker
See Docs/Docker.md for detailed instructions on using SwarmUI in Docker.
Documentation
Motivations
The "Swarm" name is in reference to the original key function of the UI: enabling a 'swarm' of GPUs to all generate images for the same user at once (especially for large grid generations). This is just the feature that inspired the name and not the end all of what Swarm is.
The overall goal of SwarmUI is to a be full-featured one-stop-shop for all things Stable Diffusion.
See the motivations document for motivations on technical choices.
Legal
This project:
- embeds a copy of 7-zip (LGPL).
- has the ability to auto-install ComfyUI (GPL).
- has the option to use as a backend AUTOMATIC1111/stable-diffusion-webui (AGPL).
- can automatically install christophschuhmann/improved-aesthetic-predictor (Apache2) and yuvalkirstain/PickScore (MIT).
- can automatically install git-for-windows (GPLv2).
- can automatically install MIT/BSD/Apache2/PythonSoftwareFoundation pip packages: spandrel, dill, imageio-ffmpeg, opencv-python-headless, matplotlib, rembg, kornia, Cython
- can automatically install ultralytics (AGPL) for
YOLOv8
face detection (ieSwarmYoloDetection
node or<segment:yolo-...>
syntax usage may become subject to AGPL terms), - can automatically install insightface (MIT) for
IP Adapter - Face
support - uses JSON.NET (MIT), FreneticUtilities (MIT), LiteDB (MIT), ImageSharp (Apache2 under open-source Split License)
- embeds copies of web assets from BootStrap (MIT), Select2 (MIT), JQuery (MIT), exifr (MIT).
- contains some icons from Cristian Munoz (CC-BY-4.0), the font inter by rsms (OFL), Unifont by GNU (OFL), Material Symbols Outlined by Google (Apache2).
- can be used to install some custom node packs, which have individual license notices for any non-pure-FOSS licenses before install.
- supports user-built extensions which may have their own licenses or legal conditions.
SwarmUI itself is under the MIT license, however some usages may be affected by the GPL variant licenses of connected projects list above, and note that any models used have their own licenses.
Previous License
(For updates prior to June 2024)
The MIT License (MIT) Copyright (c) 2024 Stability AI
License
The MIT License (MIT)
Copyright (c) 2024-2025 Alex "mcmonkey" Goodwin
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Top Related Projects
TensorFlow Tutorial and Examples for Beginners (support TF v1 & v2)
An Open Source Machine Learning Framework for Everyone
Deep Learning for humans
Tensors and Dynamic neural networks in Python with strong GPU acceleration
scikit-learn: machine learning in Python
Convert
designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot