Instructions to use YiYiXu/modular-diffdiff-0704 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use YiYiXu/modular-diffdiff-0704 with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("YiYiXu/modular-diffdiff-0704", 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
File size: 1,269 Bytes
3304492 0aecace 3304492 0aecace f5d261f 3304492 34e7c7d 3304492 0aecace 3304492 0aecace 3304492 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | ---
license: apache-2.0
library_name: diffusers
---
test under this PR https://github.com/huggingface/diffusers/pull/11235
```python
from diffusers.modular_pipelines import ModularPipeline, ComponentsManager
import torch
from diffusers.utils import load_image
repo_id = "YiYiXu/modular-diffdiff"
components = ComponentsManager()
diffdiff_pipeline = ModularPipeline.from_pretrained(repo_id, trust_remote_code=True, component_manager=components, collection="diffdiff")
diffdiff_pipeline.load_componenets(torch_dtype=torch.float16)
components.enable_auto_cpu_offload()
image = load_image( "https://huggingface.co/datasets/OzzyGT/testing-resources/resolve/main/differential/20240329211129_4024911930.png?download=true")
mask = load_image("https://huggingface.co/datasets/OzzyGT/testing-resources/resolve/main/differential/gradient_mask.png?download=true")
prompt = "a green pear"
negative_prompt = "blurry"
image = diffdiff_pipeline(
prompt=prompt,
negative_prompt=negative_prompt,
num_inference_steps=25,
diffdiff_map=mask,
image=image,
output="images"
)[0]
image.save("yiyi_test_modular_remote_diffdiff_out.png")
```

|