Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

Add DeepSpeed to LightningStableDiffusion model #2

Merged
merged 16 commits into from
Jan 11, 2023
Merged

Conversation

tchaton
Copy link

@tchaton tchaton commented Jan 9, 2023

This PR extracts the DeepSpeed Stable Diffusion Inference Optimization Policy applied over Diffusers models when doing the following.

pipe = diffusers.StableDiffusionPipeline.from_pretrained(
    "runwayml/stable-diffusion-v1-5",
    use_auth_token=hf_auth_key,
    torch_dtype=torch.float16,
    revision="fp16")

print(pipe)
pipe = deepspeed.init_inference(pipe.to("cuda"), dtype=torch.float16)

This PR introduces the following:

@tchaton tchaton changed the title Add DeepSpeed Add DeepSpeed to LightningStableDiffusion model Jan 9, 2023
Copy link

@lantiga lantiga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, learned a lot :-) I added a couple of comments

ldm/lightning.py Show resolved Hide resolved
ldm/deepspeed_replace.py Show resolved Hide resolved
scripts/txt2img.py Show resolved Hide resolved
@tchaton tchaton merged commit 03ae671 into lit Jan 11, 2023
@tchaton tchaton deleted the add_deepspeed branch January 11, 2023 17:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants