Instructions to use AbdulElahGwaith/diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use AbdulElahGwaith/diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("AbdulElahGwaith/diffusers", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Download tests/single_file/test_stable_diffusion_xl_instruct_pix2pix.py from AbdulElahGwaith/diffusers: direct link, hf CLI and curl.
- Browser
- Download file 1.48 kB
-
https://huggingface.co/AbdulElahGwaith/diffusers/resolve/main/tests/single_file/test_stable_diffusion_xl_instruct_pix2pix.py
- Command line
-
hf download hf://AbdulElahGwaith/diffusers/tests/single_file/test_stable_diffusion_xl_instruct_pix2pix.py
-
curl -L -o test_stable_diffusion_xl_instruct_pix2pix.py https://huggingface.co/AbdulElahGwaith/diffusers/resolve/main/tests/single_file/test_stable_diffusion_xl_instruct_pix2pix.py
1.48 kB
| import gc | |
| import torch | |
| from diffusers import StableDiffusionXLInstructPix2PixPipeline | |
| from ..testing_utils import ( | |
| backend_empty_cache, | |
| enable_full_determinism, | |
| require_torch_accelerator, | |
| slow, | |
| torch_device, | |
| ) | |
| enable_full_determinism() | |
| class StableDiffusionXLInstructPix2PixPipeline: | |
| pipeline_class = StableDiffusionXLInstructPix2PixPipeline | |
| ckpt_path = "https://huggingface.co/stabilityai/cosxl/blob/main/cosxl_edit.safetensors" | |
| original_config = None | |
| repo_id = "diffusers/sdxl-instructpix2pix-768" | |
| def setup_method(self): | |
| gc.collect() | |
| backend_empty_cache(torch_device) | |
| def teardown_method(self): | |
| gc.collect() | |
| backend_empty_cache(torch_device) | |
| def get_inputs(self, device, generator_device="cpu", dtype=torch.float32, seed=0): | |
| generator = torch.Generator(device=generator_device).manual_seed(seed) | |
| inputs = { | |
| "prompt": "a fantasy landscape, concept art, high resolution", | |
| "generator": generator, | |
| "num_inference_steps": 2, | |
| "strength": 0.75, | |
| "guidance_scale": 7.5, | |
| "output_type": "np", | |
| } | |
| return inputs | |
| def test_single_file_setting_cosxl_edit(self): | |
| # Default is PNDM for this checkpoint | |
| pipe = self.pipeline_class.from_single_file(self.ckpt_path, config=self.repo_id, is_cosxl_edit=True) | |
| assert pipe.is_cosxl_edit is True | |