Update README.md
Browse files
README.md
CHANGED
@@ -21,11 +21,30 @@ You can [use the diffusers library to load the model](https://huggingface.co/Pru
|
|
21 |
To ensure that all optimizations are applied, use the pruna library to load the model using the following code:
|
22 |
|
23 |
```python
|
|
|
|
|
|
|
|
|
24 |
from pruna import PrunaModel
|
25 |
|
26 |
-
|
|
|
|
|
|
|
27 |
"PrunaAI/FLUX.1-Fill-dev-smashed"
|
28 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
```
|
30 |
|
31 |
After loading the model, you can use the inference methods of the original model. Take a look at the [documentation](https://pruna.readthedocs.io/en/latest/index.html) for more usage information.
|
|
|
21 |
To ensure that all optimizations are applied, use the pruna library to load the model using the following code:
|
22 |
|
23 |
```python
|
24 |
+
import torch
|
25 |
+
from diffusers import FluxFillPipeline
|
26 |
+
from diffusers.utils import load_image
|
27 |
+
|
28 |
from pruna import PrunaModel
|
29 |
|
30 |
+
image = load_image("https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/cup.png")
|
31 |
+
mask = load_image("https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/cup_mask.png")
|
32 |
+
|
33 |
+
pipe = PrunaModel.from_hub(
|
34 |
"PrunaAI/FLUX.1-Fill-dev-smashed"
|
35 |
)
|
36 |
+
image = pipe(
|
37 |
+
prompt="a white paper cup",
|
38 |
+
image=image,
|
39 |
+
mask_image=mask,
|
40 |
+
height=1632,
|
41 |
+
width=1232,
|
42 |
+
guidance_scale=30,
|
43 |
+
num_inference_steps=50,
|
44 |
+
max_sequence_length=512,
|
45 |
+
generator=torch.Generator("cpu").manual_seed(0)
|
46 |
+
).images[0]
|
47 |
+
image.save(f"flux-fill-dev.png")
|
48 |
```
|
49 |
|
50 |
After loading the model, you can use the inference methods of the original model. Take a look at the [documentation](https://pruna.readthedocs.io/en/latest/index.html) for more usage information.
|