Created
August 13, 2024 22:27
-
-
Save hvaara/bc8754b2aab6ef07a95c82c5e436f6d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import torch | |
| from diffusers import FluxPipeline | |
| DEVICE = "mps" | |
| SEED = 1 | |
| pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-schnell", torch_dtype=torch.bfloat16) | |
| pipe.to(DEVICE) | |
| prompts = [ | |
| "A cat holding a sign that says hello world", | |
| "a portal into a mythical forest on the wall of my small messy bedroom", | |
| ] | |
| for i, prompt in enumerate(prompts): | |
| image = pipe( | |
| prompt, | |
| guidance_scale=0.0, | |
| num_inference_steps=4, | |
| max_sequence_length=256, | |
| generator=torch.Generator(DEVICE).manual_seed(SEED), | |
| ).images[0] | |
| image.save(f"output_image_{SEED}_{prompt}_{DEVICE}.png") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment