Skip to content

Add torch_xla and from_single_file to instruct-pix2pix #10444

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

Merged
merged 5 commits into from
Jan 6, 2025

Conversation

hlky
Copy link
Contributor

@hlky hlky commented Jan 3, 2025

What does this PR do?

Replaces #10355

from_single_file changes were determined by comparing v1-5-pruned.safetensors to instruct-pix2pix-00-22000.safetensors

import safetensors
from huggingface_hub import hf_hub_download

pix2pix = safetensors.safe_open(hf_hub_download("timbrooks/instruct-pix2pix", filename="instruct-pix2pix-00-22000.safetensors"), framework="pt")

v1 = safetensors.safe_open(hf_hub_download("stable-diffusion-v1-5/stable-diffusion-v1-5", filename="v1-5-pruned.safetensors"), framework="pt")

extra_keys = set(pix2pix.keys()) - set(v1.keys())
print(extra_keys)

for key in pix2pix.keys():
    tensor = pix2pix.get_tensor(key)
    tensor_v1 = v1.get_tensor(key)
    if tensor.shape != tensor_v1.shape:
        print(f"{key} {tensor.shape} (pix2pix) != {tensor_v1.shape} (v1)")
set()
model.diffusion_model.input_blocks.0.0.weight torch.Size([320, 8, 3, 3]) (pix2pix) != torch.Size([320, 4, 3, 3]) (v1)
model_ema.diffusion_modelinput_blocks00weight torch.Size([320, 8, 3, 3]) (pix2pix) != torch.Size([320, 4, 3, 3]) (v1)

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@sayakpaul @chaowenguo

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Copy link
Member

@sayakpaul sayakpaul left a comment

Choose a reason for hiding this comment

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

Can we also have a nightly test for this?

@yiyixuxu yiyixuxu merged commit 8f2253c into huggingface:main Jan 6, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants