Instructions to use jdopensource/JoyAI-Image-Edit-Diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use jdopensource/JoyAI-Image-Edit-Diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline from diffusers.utils import load_image # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("jdopensource/JoyAI-Image-Edit-Diffusers", dtype=torch.bfloat16, device_map="cuda") prompt = "Turn this cat into a dog" input_image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png") image = pipe(image=input_image, prompt=prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -27,26 +27,13 @@ JoyAI-Image-Edit is a multimodal foundation model specialized in instruction-gui
|
|
| 27 |
|
| 28 |
**Requirements**: Python >= 3.10, CUDA-capable GPU
|
| 29 |
|
| 30 |
-
###
|
| 31 |
-
|
| 32 |
-
| Package | Version | Purpose |
|
| 33 |
-
|---------|---------|---------|
|
| 34 |
-
| `torch` | >= 2.8 | PyTorch |
|
| 35 |
-
| `transformers` | >= 4.57.0, < 4.58.0 | Text encoder |
|
| 36 |
-
| `torchvison` | - |Image process|
|
| 37 |
-
|
| 38 |
-
### Install the [Pull Request](https://github.com/huggingface/diffusers/pull/13444]) of JoyAI-Image-Edit of diffusers
|
| 39 |
-
```bash
|
| 40 |
-
pip install git+https://github.com/huggingface/diffusers.git@refs/pull/13444/head
|
| 41 |
-
```
|
| 42 |
|
| 43 |
-
### Or install from this repo (PR will merge to diffusers main branch soon)
|
| 44 |
```bash
|
| 45 |
-
pip install torch
|
| 46 |
-
|
| 47 |
-
pip install git+https://github.com/Moran232/diffusers.git@joyimage_edit
|
| 48 |
```
|
| 49 |
-
|
| 50 |
### Running with Diffusers
|
| 51 |
```python
|
| 52 |
import torch
|
|
@@ -62,15 +49,13 @@ print("pipeline loaded")
|
|
| 62 |
|
| 63 |
img_path = "./test_images/input.png"
|
| 64 |
prompt = "Remove the construction structure from the top of the crane."
|
| 65 |
-
|
| 66 |
image = Image.open(img_path).convert("RGB")
|
| 67 |
-
prompts = [f"<|im_start|>user\n<image>\n{prompt}<|im_end|>\n"]
|
| 68 |
|
| 69 |
inputs = {
|
| 70 |
"image": image,
|
| 71 |
-
"prompt":
|
| 72 |
"generator": torch.manual_seed(0),
|
| 73 |
-
"num_inference_steps":
|
| 74 |
"guidance_scale": 4.0,
|
| 75 |
}
|
| 76 |
|
|
@@ -81,7 +66,6 @@ with torch.inference_mode():
|
|
| 81 |
image = output.images[0]
|
| 82 |
image.save("joyai_image_edit_output.png")
|
| 83 |
print("image saved.")
|
| 84 |
-
|
| 85 |
```
|
| 86 |
|
| 87 |
|
|
|
|
| 27 |
|
| 28 |
**Requirements**: Python >= 3.10, CUDA-capable GPU
|
| 29 |
|
| 30 |
+
### Install
|
| 31 |
+
Note: JoyImageEditPipeline will be included in the next official diffusers release (>0.38.0). Until then, install from source as shown above.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
|
|
|
| 33 |
```bash
|
| 34 |
+
pip install torch transformers torchvision
|
| 35 |
+
pip install git+https://github.com/huggingface/diffusers.git
|
|
|
|
| 36 |
```
|
|
|
|
| 37 |
### Running with Diffusers
|
| 38 |
```python
|
| 39 |
import torch
|
|
|
|
| 49 |
|
| 50 |
img_path = "./test_images/input.png"
|
| 51 |
prompt = "Remove the construction structure from the top of the crane."
|
|
|
|
| 52 |
image = Image.open(img_path).convert("RGB")
|
|
|
|
| 53 |
|
| 54 |
inputs = {
|
| 55 |
"image": image,
|
| 56 |
+
"prompt": prompt,
|
| 57 |
"generator": torch.manual_seed(0),
|
| 58 |
+
"num_inference_steps": 40,
|
| 59 |
"guidance_scale": 4.0,
|
| 60 |
}
|
| 61 |
|
|
|
|
| 66 |
image = output.images[0]
|
| 67 |
image.save("joyai_image_edit_output.png")
|
| 68 |
print("image saved.")
|
|
|
|
| 69 |
```
|
| 70 |
|
| 71 |
|