Instructions to use jwengr/stable-diffusion-2-gray-inpaint-to-rgb with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use jwengr/stable-diffusion-2-gray-inpaint-to-rgb 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("jwengr/stable-diffusion-2-gray-inpaint-to-rgb", 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 folder using huggingface_hub
Browse files- modeling_sd_gray_inpaint.py +1 -1
- modeling_seresvae.py +1 -1
modeling_sd_gray_inpaint.py
CHANGED
|
@@ -54,7 +54,7 @@ class SDGrayInpaintModel(PreTrainedModel):
|
|
| 54 |
generator = torch.Generator()
|
| 55 |
generator.manual_seed(seed)
|
| 56 |
if input_type=='pil':
|
| 57 |
-
images_gray_masked = self.image_processor.
|
| 58 |
elif input_type=='pt':
|
| 59 |
images_gray_masked=images_gray_masked
|
| 60 |
else:
|
|
|
|
| 54 |
generator = torch.Generator()
|
| 55 |
generator.manual_seed(seed)
|
| 56 |
if input_type=='pil':
|
| 57 |
+
images_gray_masked = self.image_processor.preprocess(images_gray_masked, height=self.height, width=self.width).float()
|
| 58 |
elif input_type=='pt':
|
| 59 |
images_gray_masked=images_gray_masked
|
| 60 |
else:
|
modeling_seresvae.py
CHANGED
|
@@ -53,7 +53,7 @@ class SeResVaeModel(PreTrainedModel):
|
|
| 53 |
|
| 54 |
def forward(self, images_gray, input_type='pil', output_type='pil'):
|
| 55 |
if input_type=='pil':
|
| 56 |
-
images_gray = self.image_processor.
|
| 57 |
elif input_type=='pt':
|
| 58 |
images_gray=images_gray
|
| 59 |
else:
|
|
|
|
| 53 |
|
| 54 |
def forward(self, images_gray, input_type='pil', output_type='pil'):
|
| 55 |
if input_type=='pil':
|
| 56 |
+
images_gray = self.image_processor.preprocess(images_gray, height=self.height, width=self.width).float()
|
| 57 |
elif input_type=='pt':
|
| 58 |
images_gray=images_gray
|
| 59 |
else:
|