Since DallE-2 and Stable Diffusion launched, I have been super excited to try them out on multiple online websites, but I wanted to setup everything locally on my machine which should be easily accessible when I need to create a random Image. also play with some properties which stable diffusion provides, I was also reading about how we can set Dreambooth by Google to use Stable Diffusion and merge our real world samples Images into the generated Image context.
example I can provide my Images to the model and ask to create a version of me as Rambo, with Stable diffusion thats not possible because it does not know who I am. Things are getting pretty exciting on the AI domain, lets jump into setting things up on my local machine.
Python
installed and pip
latest installed..sh
file is installed I run bash Miniforge3-MacOSX-arm64.sh
from the terminal where file is downloaded./user/div/miniforge...
conda
(confirmed)cd stable-defusion
mkdir -p models/ldm/stable-diffusion-v1/
(looked into the folder and found we have a lot of other models as well)PATH
for the downloaded weights (in my case its downloaded to weights folder inside the repo folder)PATH_TO_CKPT="/Users/div/Documents/Weekend-Projects/stable-diffusion/weghts"
ln -s "$PATH_TO_CKPT/sd-v1-4.ckpt" models/ldm/stable-diffusion-v1/model.ckpt
model/ldm/stable-diffusion-v1
folder and can see a symlink named model.ckpt
CONDA_SUBDIR=osx-arm64 conda env create -f environment-mac.yaml
This command will take some time and show message as [CCollecting package metadata (repodata.json): -
.. and other installation steps, no input needed from our side. this step took a long time, around 3-4 minutes in my case and downloaded /installed a lot of stuff. note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for tokenizers
ERROR: Could not build wheels for tokenizers, which is required to install pyproject.toml-based projects
failed
CondaEnvException: Pip failed
Rust
is requiredcurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
CondaValueError: prefix already exists: /Users/div/miniforge3/envs/ldm
conda env remove -n ldm
CONDA_SUBDIR=osx-arm64 conda env create -f environment-mac.yaml
ERROR: Failed building wheel for tokenizers
ERROR: Could not build wheels for tokenizers, which is required to install pyproject.toml-based projects
failed
CondaEnvException: Pip failed
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
as mentioned in this official link : https://www.rust-lang.org/tools/install
conda env remove -n ldm
to remove the ldm packages before installing againCONDA_SUBDIR=osx-arm64 conda env create -f environment-mac.yam
Run this againconda activate ldm
python scripts/preload_models.py
pytorch_model.bin
which was around 1.3 GB.models from RealESRGAN and facexlib
, which takes some time as well...success
message on the terminal I move to next and final step.python scripts/dream.py --full_precision
after running this command I can see a message in terminal as * Initializing, be patient...
a curious phoenix watching a wizard study magic in a mages workshop, soft lighting, mythical phoenix, digital art trending on artstation -n 3
-n 3
is for the number of Images we want to generate, I only wanted 3 samples everytime.
concept art of a jungle path leading to tree of life, religious, in the style of fenghua zhong and ruan jia and jeremy lipking and peter mohrbacher, mystical colors, rim light, beautiful lighting,k, stunning scene, raytracing, octane, trending on artstation
Wow, I see myself using this Image as my wallpaper.
In the next series I will try to setup Dreambooth.
š Thanks for reading and setting up, please share your generated images to me via Twitter @divyanshunegi
X
I'd appreciate your feedback so I can make my blog posts more helpful. Did this post help you learn something or fix an issue you were having?
Yes
No
X
If you'd like to support this blog by buying me a coffee I'd really appreciate it!
X
Subscribe to my newsletter
Join 107+ other developers and get free, weekly updates and code insights directly to your inbox.
Email Address
Powered by Buttondown
Divyanshu Negi is a VP of Engineering at Zaapi Pte.
X