diffusers icon indicating copy to clipboard operation
diffusers copied to clipboard

How to convert Flax model to .ckpt ?

Open sneccc opened this issue 3 years ago • 6 comments

sneccc avatar Nov 12 '22 21:11 sneccc

I would like to know how to convert a ckpt for use with JAX and TPU in the flaxpipeline.

G-force78 avatar Nov 15 '22 10:11 G-force78

Hey @G-force78,

You need to first convert the .ckpt to a PyTorch diffusers checkpointhttps://github.com/huggingface/diffusers/blob/main/scripts/convert_original_stable_diffusion_to_diffusers.py: and then you can load it with:

flax_pipe, params = FlaxStableDiffusionPipeline.from_pretrained("/path/to/diffusers/folder", from_pt=True)

patrickvonplaten avatar Nov 18 '22 12:11 patrickvonplaten

To go from PyTorch => Flax I think there is an open PR here: https://github.com/huggingface/diffusers/pull/1241

We need some functionality for this. I think I can help with the PR next week

patrickvonplaten avatar Nov 18 '22 12:11 patrickvonplaten

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Dec 13 '22 15:12 github-actions[bot]

Is there any update with this?

Lime-Cakes avatar Dec 15 '22 17:12 Lime-Cakes

We currently sadly don't have the time to look into it. Would be great if someone from the community could try to take the lead here.

patrickvonplaten avatar Dec 19 '22 16:12 patrickvonplaten

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

github-actions[bot] avatar Jan 13 '23 15:01 github-actions[bot]