Stable Diffusion Lab using Python
Developed on Apple Silicon, with pytorch nightly. See GymDreams8 Docs Pytorch Nightly for details.
# Create virtualenv with pyenv
pyenv virtualenv 3.10.9 sdlab
# Activate virtualenv
pyenv shell sdlab
# Install Pytorch Nightly
pip install --pre torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/nightly/cpu
# Install requirements
pip install -r requirements.txt
Just run the script ./sdlab/txt2img.py
e.g.:
python ./sdlab/txt2img.py
I dev on an M2Max so the pipeline is intentionally not run on a GPU. I’ll add a config to run on CUDA later, but since this was just for me, having CUDA in this code is not a priority. I believe that all you need to add is:
pipe.to("cuda")
Also for my own dev only, but I save my images to Dropbox. You can replace these with your own paths and safe tensors models.
txt2img = Text2Image(
model_path='~/_StableDiffusion_Models/Stable-diffusion/airfucksBruteMix_v10.safetensors',
outputs_path='~/Dropbox/StableDiffusion/outputs_code',
prompt='man'
)