Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update sd15 weight links #490

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
fail-fast: false
matrix:
python-version: ["3.10", "3.11"]
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
os: ["ubuntu-latest", "windows-latest", "m2-16gb"]
steps:
- uses: actions/checkout@v3
- uses: actions/[email protected]
Expand All @@ -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 All @@ -163,7 +163,7 @@ jobs:
fail-fast: false
matrix:
python-version: [ "3.10", "3.11" ]
os: [ "ubuntu-latest", "windows-latest", "macos-latest" ]
os: [ "ubuntu-latest", "windows-latest", "m2-16gb" ]
steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v3
Expand All @@ -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
Loading