InpaintingDiffusers
Python template · sinapsis_huggingface_diffusers.templates.inpainting_diffusers
Overview
This class implements a specific template for inpainting tasks using Hugging Face's diffusers. The `InpaintingDiffusers` class inherits from `ImageToImageDiffusers` and extends its capabilities to handle inpainting using bounding boxes to create masks or directly using segmentation masks.
Parameters to be used inside generation_params can be seen at HuggingFace documentation: https://huggingface.co/docs/diffusers/api/pipelines/stable_diffusion/inpaint
Capabilities
Capabilities: not setInstallation
Install the published package using pip or uv.
pip install sinapsis-huggingface-diffusers==1.0.0uv pip install sinapsis-huggingface-diffusers==1.0.0uv add sinapsis-huggingface-diffusers==1.0.0Configuration
Effective fields from the inspector schema, including nested Pydantic model fields.
Optional
Default: null
Required
Default: null
Optional
Default: null
Optional
Default: "stable-diffusion-v1-5/stable-diffusion-v1-5"
Optional
Default: "float16"
Radius of the surrounding area (in pixels) to include around the mask. If None, no dilation is applied. Defaults to None.
Optional
Default: null
Determines how the inpainting mask is generated. - "bbox": Generate masks based on bounding box annotations. - "mask": Use segmentation masks or polygons to generate the mask.
Required
Default: null
Optional
Default: "/home/ariel/.cache/sinapsis"
Optional
Default: false
Optional
Default: null
The width in pixels of the generated image.
Optional
Default: null
The height in pixels of the generated image.
Optional
Default: null
The text prompt(s) to guide image generation.
Optional
Default: null
Controls how much the prompt influences the output. Higher values mean stronger adherence. Defaults to 7.5.
Optional
Default: 7.5
Prompt(s) to guide the model away from generating certain things.
Optional
Default: null
The number of denoising steps. More steps typically result in higher quality but are slower. Defaults to 50.
Optional
Default: 50
The number of images to generate per prompt. Defaults to 1.
Optional
Default: 1
Optional
Default: false
If True, preserves the content outside the mask by blending the new content with the old content. Defaults to False.
Optional
Default: false
Configuration example
Example from the Python docstring:
agent:
name: my_test_agent
templates:
- template_name: InputTemplate
class_name: InputTemplate
attributes: {}
- template_name: InpaintingDiffusers
class_name: InpaintingDiffusers
template_input: InputTemplate
attributes:
model_path: '/path/to/diffusers/model'
model_cache_dir: /path/to/cache/dir
device: 'cuda'
torch_dtype: float16
enable_model_cpu_offload: false
generation_params: {}
overwrite_images: false
inpainting_mode: 'bbox'
dilation_radius: 2
preserve_outside_content: falseShow schema-based configuration skeleton
templates:
- template_name: "InpaintingDiffusers"
class_name: "InpaintingDiffusers"
attributes:
seed: null
device: "<required>"
model_path: "stable-diffusion-v1-5/stable-diffusion-v1-5"
torch_dtype: "float16"
dilation_radius: null
inpainting_mode: "<required>"
model_cache_dir: "/home/ariel/.cache/sinapsis"
overwrite_images: false
generation_params:
width: null
height: null
prompt: null
guidance_scale: 7.5
negative_prompt: null
num_inference_steps: 50
num_images_per_prompt: 1
enable_model_cpu_offload: false
preserve_outside_content: false
Inheritance
sinapsis_huggingface_diffusers.templates.image_to_image_diffusers.ImageToImageDiffusersEnvironment variables
Environment definitions belong to their canonical Python modules.
No directly related environment variables listed.