You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromdiffusersimportFlaxStableDiffusionPipelinefromjaximportpmapimportnumpyasnpimportjaxfromflax.jax_utilsimportreplicatefromflax.training.common_utilsimportshardpipeline, params=FlaxStableDiffusionPipeline.from_pretrained("hf-internal-testing/tiny-stable-diffusion-pipe")
# or# pipeline = FlaxStableDiffusionPipeline.from_pretrained("hf-internal-testing/tiny-stable-diffusion-pipe", from_pt=True)# ideally test both#pipeline.save_pretrained("./tiny-stable-diffusion-pipe", params=params)# should also workprompt="A cinematic film still of Morgan Freeman starring as Jimi Hendrix, portrait, 40mm lens, shallow depth of field, close up, split lighting, cinematic"prng_seed=jax.random.PRNGKey(0)
num_inference_steps=4num_samples=jax.device_count()
prompt=num_samples* [prompt]
prompt_ids=pipeline.prepare_inputs(prompt)
# first try debug mode# sample = pipeline(prompt_ids, params, prng_seed, num_inference_steps, debug=True)# next we go to TPUv2-8p_sample=pmap(pipeline.__call__, static_broadcasted_argnums=(3,))
# shard inputs and rngparams=replicate(params)
prng_seed=jax.random.split(prng_seed, 8)
prompt_ids=shard(prompt_ids)
images=p_sample(prompt_ids, params, prng_seed, num_inference_steps).imagesimages_pil=pipeline.numpy_to_pil(np.asarray(images.reshape((num_samples,) +images.shape[-3:])))
importipdb; ipdb.set_trace()
print("works!")
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.
Activity
[-]Fast Debugging[/-][+][Debugging] Stable Diffusion[/+]patrickvonplaten commentedon Sep 20, 2022
@pcuenca @kashif @patil-suraj @mishig25 this could be useful
github-actions commentedon Oct 21, 2022
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.
Don't do nchw-to-nhwc transpose for stable diffusion models (huggingf…
maliozer commentedon Feb 7, 2024
how to debug the pipeline itself, breakpoint does not work to stop process @patrickvonplaten
pcuenca commentedon Feb 7, 2024
I think it should. Did you make sure to use
jit = Falsewhile developing?jqliu09 commentedon May 20, 2024
Sorry, but could I ask where should I set this command?