Skip to content

Commit

Permalink
fix: update sd15 weight links
Browse files Browse the repository at this point in the history
  • Loading branch information
brycedrennan committed Sep 21, 2024
1 parent 1f0ae5f commit 3511d7f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ jobs:
uv pip install --system ${{ needs.build-wheel.outputs.wheel_name }}
- name: Generate an image
run: |
imagine fruit --steps 3 --size 512 --seed 1
imagine fruit --steps 3 --size 128 --seed 1
- uses: actions/upload-artifact@v3
with:
name: images
Expand Down Expand Up @@ -188,7 +188,7 @@ jobs:
shell: bash -l {0}
run: |
conda activate test-env
imagine fruit --steps 3 --size 512 --seed 1
imagine fruit --steps 3 --size 128 --seed 1
- uses: actions/upload-artifact@v3
with:
name: images
Expand Down
2 changes: 1 addition & 1 deletion imaginairy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def __post_init__(self):
aliases=MODEL_ARCHITECTURE_LOOKUP["sd15"].aliases,
architecture=MODEL_ARCHITECTURE_LOOKUP["sd15"],
defaults={"negative_prompt": DEFAULT_NEGATIVE_PROMPT},
weights_location="https://huggingface.co/runwayml/stable-diffusion-v1-5/tree/1d0c4ebf6ff58a5caecab40fa1406526bca4b5b9/",
weights_location="https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/tree/f03de327dd89b501a01da37fc5240cf4fdba85a1/",
),
ModelWeightsConfig(
name="Stable Diffusion 1.5 - Inpainting",
Expand Down
8 changes: 5 additions & 3 deletions imaginairy/weight_management/execution_trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,15 @@ def trace_sd15_diffusers_execution_order(device=None):
image_size = 256
img_in = torch.randn(1, 3, image_size, image_size).to(device)
vae = AutoencoderKL.from_pretrained(
pretrained_model_name_or_path="runwayml/stable-diffusion-v1-5", subfolder="vae"
pretrained_model_name_or_path="stable-diffusion-v1-5/stable-diffusion-v1-5",
subfolder="vae",
).to(device)
vae_execution_order = trace_execution_order(vae, (img_in,))

# text encoder model

text_encoder = CLIPTextModelWithProjection.from_pretrained(
pretrained_model_name_or_path="runwayml/stable-diffusion-v1-5",
pretrained_model_name_or_path="stable-diffusion-v1-5/stable-diffusion-v1-5",
subfolder="text_encoder",
).to(device)
tokens = torch.Tensor(
Expand Down Expand Up @@ -200,7 +201,8 @@ def trace_sd15_diffusers_execution_order(device=None):
text_embedding = torch.randn(1, 77, 768).to(device)
timestep = torch.tensor(data=[0]).to(device)
unet = UNet2DConditionModel.from_pretrained(
pretrained_model_name_or_path="runwayml/stable-diffusion-v1-5", subfolder="unet"
pretrained_model_name_or_path="stable-diffusion-v1-5/stable-diffusion-v1-5",
subfolder="unet",
).to(device)
unet_execution_order = trace_execution_order(
unet, (latent_in, timestep, text_embedding)
Expand Down
6 changes: 3 additions & 3 deletions imaginairy/weight_management/generate_weight_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ def save_diffusers_patterns():
model_name=utils.MODEL_NAMES.SD15,
component_name=utils.COMPONENT_NAMES.VAE,
format_name=utils.FORMAT_NAMES.DIFFUSERS,
weights_url="https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/vae/diffusion_pytorch_model.fp16.safetensors",
weights_url="https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/main/vae/diffusion_pytorch_model.fp16.safetensors",
)

save_weight_info(
model_name=utils.MODEL_NAMES.SD15,
component_name=utils.COMPONENT_NAMES.UNET,
format_name=utils.FORMAT_NAMES.DIFFUSERS,
weights_url="https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/unet/diffusion_pytorch_model.fp16.safetensors",
weights_url="https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/main/unet/diffusion_pytorch_model.fp16.safetensors",
)

save_weight_info(
model_name=utils.MODEL_NAMES.SD15,
component_name=utils.COMPONENT_NAMES.TEXT_ENCODER,
format_name=utils.FORMAT_NAMES.DIFFUSERS,
weights_url="https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/text_encoder/model.fp16.safetensors",
weights_url="https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/main/text_encoder/model.fp16.safetensors",
)


Expand Down
2 changes: 1 addition & 1 deletion scripts/controlnet_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from imaginairy.utils.downloads import get_cached_url_path
from imaginairy.utils.paths import PKG_ROOT

sd15_url = "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/889b629140e71758e1e0006e355c331a5744b4bf/v1-5-pruned-emaonly.ckpt"
sd15_url = "https://huggingface.co/stable-diffusion-v1-5/stable-diffusion-v1-5/resolve/f03de327dd89b501a01da37fc5240cf4fdba85a1/v1-5-pruned-emaonly.ckpt"


def main():
Expand Down

0 comments on commit 3511d7f

Please sign in to comment.