Upscaling Karlo text-to-image generation using Stable Diffusion v2.
A Streamlit app that combines Karlo text-to-image generations with the Stable-Diffusion v2 upscaler in a simple webUI.
Now available on Google Colab:
Built with:
Note that xformers is not in the
requirements.txt
. Using it is optional, but I'd recommend it if you have a GPU with low memory. You can follow the instructions on their repo to get it set up in the python environment.
git clone https://github.com/kpthedev/stable-karlo.git
cd stable-karlo
python -m venv .env
source .env/bin/activate
pip install -r requirements.txt
git clone https://github.com/kpthedev/stable-karlo.git
cd stable-karlo
python -m venv .env
.env\Scripts\activate
pip install -r requirements.txt
pip install --upgrade --force-reinstall torch --extra-index-url https://download.pytorch.org/whl/cu117
To run the app, make sure you are in the stable-karlo
folder and have activated the environment, then run:
streamlit run app.py
This should open the webUI in your browser automatically.
The very first time you run the app, it will download the models from Huggingface. This may take a while, depending on your internet speed—the models are around 18GB total.
In the settings of each model, there are options for lowering the VRAM requirements:
Both model settings have a Use CPU offloading option, which will substantially lower the VRAM usage.
The Upscaler has two other methods to lower the VRAM usage:
Model | Optimizations | VRAM Usage |
---|---|---|
Karlo | none | 10GB |
Karlo | CPU-offloading | 7GB |
Model | Optimizations | VRAM Usage |
---|---|---|
Karlo + Upscale | none | >24GB |
Karlo + Upscale | Downscale to < 190px | 12GB |
Karlo + Upscale | xformers | 15GB |
Karlo + Upscale | CPU-offloading + xformers | 15GB |
Karlo + Upscale | CPU-offloading + Downscale to < 190px | 12GB |
Karlo + Upscale | CPU-offloading + xformers + Downscale to < 190px | 10GB |
All the original code that I have written is licensed under a GPL license. The licenses for the respective model weights, are included in the repository.