Stability-AI / stablediffusion

High-Resolution Image Synthesis with Latent Diffusion Models
MIT License
38.93k stars 5.03k forks source link

Please make a Dockerfile #4

Open zackees opened 1 year ago

zackees commented 1 year ago

This would allow people to spin up an instance very fast.

0xdevalias commented 1 year ago

Similar:

xiankgx commented 1 year ago

Dockerfile

FROM pytorch/pytorch:1.12.1-cuda11.3-cudnn8-devel

RUN apt update && apt install --yes git ffmpeg libsm6 libxext6

# Create conda environment
RUN git clone https://github.com/Stability-AI/stablediffusion.git

WORKDIR /workspace/stablediffusion/

# Overwrite the environment.yaml file
COPY environment.yaml .
RUN conda env create -f environment.yaml

# Make RUN commands use the new environment:
SHELL ["conda", "run", "-n", "ldm", "/bin/bash", "-c"]

# Install xformers for memory efficient flash attention
RUN conda install xformers -c xformers/label/dev

RUN conda init bash
RUN echo "conda activate ldm" >> $HOME/.bashrc

Modified environment file .

name: ldm
channels:
  - pytorch
  - defaults
dependencies:
  # Changed to Python 3.9 to make use of precompiled binaries for xformers
  - python=3.9
  - pip
  - cudatoolkit=11.3
  - pytorch=1.12.1
  - torchvision=0.13.1
  - numpy=1.23.1
  - pip:
    - albumentations==1.3.0
    - opencv-python==4.6.0.66
    - imageio==2.9.0
    - imageio-ffmpeg==0.4.2
    - pytorch-lightning==1.4.2
    - omegaconf==2.1.1
    - test-tube>=0.7.5
    - streamlit==1.12.1
    - einops==0.3.0
    - transformers==4.19.2
    - webdataset==0.2.5
    - kornia==0.6
    - open_clip_torch==2.0.2
    - invisible-watermark>=0.1.5
    - streamlit-drawable-canvas==0.8.0
    - torchmetrics==0.6.0
    - -e .
bsefton12 commented 1 year ago

See this repo https://github.com/AbdBarho/stable-diffusion-webui-docker

GeoDerp commented 1 year ago

Sorry @prasantpoudel & @xiankgx for standing on your toes ! I guess I have just made another one. Pull request here: #326 Does yours have the same issues as mine?

soulteary commented 9 months ago

maybe someone need, just use sd:

or, someone need better performance sd-webui: