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

Align PT and Flax API - allow loading checkpoint from PyTorch configs #827

Merged
merged 8 commits into from
Oct 13, 2022

Conversation

patrickvonplaten
Copy link
Contributor

No description provided.

@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Oct 13, 2022

The documentation is not available anymore as the PR was closed or merged.

@patrickvonplaten patrickvonplaten changed the title up Align PT and Flax API - allow loading checkpoint from PyTorch configs Oct 13, 2022
@patrickvonplaten patrickvonplaten merged commit 7c22626 into main Oct 13, 2022
@patrickvonplaten patrickvonplaten deleted the finalize_flax_pipe branch October 13, 2022 15:43
assert np.abs((np.abs(images[0, 0, :2, :2, -2:], dtype=np.float32).sum() - 0.05652401)) < 1e-3
assert np.abs((np.abs(images, dtype=np.float32).sum() - 2383808.2)) < 1e-2

def test_stable_diffusion_v1_4_bfloat_16(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no safety + outer pmap

assert np.abs((np.abs(images[0, 0, :2, :2, -2:], dtype=np.float32).sum() - 0.06652832)) < 1e-3
assert np.abs((np.abs(images, dtype=np.float32).sum() - 2384849.8)) < 1e-2

def test_stable_diffusion_v1_4_bfloat_16_with_safety(self):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

with safety + inner pmap


# shard inputs and rng
params = replicate(params)
prng_seed = jax.random.split(prng_seed, 8)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Better to replace 8 with jax.device_count(), no?

Copy link
Member

Choose a reason for hiding this comment

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

👍 agree

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this would indeed be a good idea (in case someone wants to open a PR for it, please feel free)

prathikr pushed a commit to prathikr/diffusers that referenced this pull request Oct 26, 2022
yoonseokjin pushed a commit to yoonseokjin/diffusers that referenced this pull request Dec 25, 2023
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