Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -53,14 +53,24 @@ Install the `diffusers` package from the following command:
|
|
| 53 |
git clone -b step1xedit_v1p2 https://github.com/Peyton-Chen/diffusers.git
|
| 54 |
cd diffusers
|
| 55 |
pip install -e .
|
|
|
|
|
|
|
| 56 |
```
|
| 57 |
Here is an example for using the `Step1X-Edit-v1p2` model to edit images:
|
| 58 |
```python
|
| 59 |
import torch
|
| 60 |
from diffusers import Step1XEditPipelineV1P2
|
| 61 |
from diffusers.utils import load_image
|
|
|
|
|
|
|
| 62 |
pipe = Step1XEditPipelineV1P2.from_pretrained("stepfun-ai/Step1X-Edit-v1p2", torch_dtype=torch.bfloat16)
|
| 63 |
pipe.to("cuda")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
print("=== processing image ===")
|
| 65 |
image = load_image("examples/0000.jpg").convert("RGB")
|
| 66 |
prompt = "add a ruby pendant on the girl's neck."
|
|
@@ -83,6 +93,8 @@ for image_idx in range(len(pipe_output.images)):
|
|
| 83 |
print(pipe_output.think_info[image_idx])
|
| 84 |
print(pipe_output.best_info[image_idx])
|
| 85 |
pipe_output.final_images[0].save(f"0001-final.jpg", lossless=True)
|
|
|
|
|
|
|
| 86 |
```
|
| 87 |
The results looks like:
|
| 88 |
<div align="center">
|
|
|
|
| 53 |
git clone -b step1xedit_v1p2 https://github.com/Peyton-Chen/diffusers.git
|
| 54 |
cd diffusers
|
| 55 |
pip install -e .
|
| 56 |
+
|
| 57 |
+
pip install RegionE # optional, for faster inference
|
| 58 |
```
|
| 59 |
Here is an example for using the `Step1X-Edit-v1p2` model to edit images:
|
| 60 |
```python
|
| 61 |
import torch
|
| 62 |
from diffusers import Step1XEditPipelineV1P2
|
| 63 |
from diffusers.utils import load_image
|
| 64 |
+
from RegionE import RegionEHelper
|
| 65 |
+
|
| 66 |
pipe = Step1XEditPipelineV1P2.from_pretrained("stepfun-ai/Step1X-Edit-v1p2", torch_dtype=torch.bfloat16)
|
| 67 |
pipe.to("cuda")
|
| 68 |
+
|
| 69 |
+
# Import the RegionEHelper, optional, for faster inference
|
| 70 |
+
regionehelper = RegionEHelper(pipe)
|
| 71 |
+
regionehelper.set_params() # default hyperparameter
|
| 72 |
+
regionehelper.enable()
|
| 73 |
+
|
| 74 |
print("=== processing image ===")
|
| 75 |
image = load_image("examples/0000.jpg").convert("RGB")
|
| 76 |
prompt = "add a ruby pendant on the girl's neck."
|
|
|
|
| 93 |
print(pipe_output.think_info[image_idx])
|
| 94 |
print(pipe_output.best_info[image_idx])
|
| 95 |
pipe_output.final_images[0].save(f"0001-final.jpg", lossless=True)
|
| 96 |
+
|
| 97 |
+
regionehelper.disable()
|
| 98 |
```
|
| 99 |
The results looks like:
|
| 100 |
<div align="center">
|