SD15OpenPoseControlNetModel
OpenPose-conditioned ControlNet pipeline built on Stable Diffusion 1.5.
Takes an input image and a text prompt. Human body keypoints and skeleton
structures are detected from the image using OpenposeDetector from
lllyasviel/Annotators, then fed as spatial conditioning into the
lllyasviel/sd-controlnet-openpose ControlNet backbone together with the
runwayml/stable-diffusion-v1-5 diffusion pipeline. This model is ideal
for generating images with specific human poses or body positions while
retaining full control over appearance via the text prompt.
Requires the controlnet_aux package (pip install controlnet_aux).
References
- [1] Zhang & Agrawala, "Adding Conditional Control to Text-to-Image Diffusion Models", ICCV 2023. https://arxiv.org/abs/2302.05543
- [2] https://huggingface.co/lllyasviel/sd-controlnet-openpose
Parameters
- num_inference_steps : integer, default=
20 - Number of denoising steps. Typical range: 20-30 for fast results, 40-50 for higher quality.
- controlnet_conditioning_scale : number, default=
1.0 - Weight of the ControlNet pose conditioning (range 0.0-2.0). At 1.0 the output closely follows the input pose. Lower values allow more creative freedom while preserving the general pose.
- guidance_scale : number, default=
7.5 - Classifier-Free Guidance (CFG) scale. Controls prompt adherence. Values 7-9 are typical for SD 1.5.
- device : string, default=
CPU - Hardware device for inference. GPU is strongly recommended for diffusion models. CPU inference is possible but very slow.
- gpu_memory_mode : string, default=
auto - How much of the model is kept on the GPU. 'auto' measures free VRAM when the model loads and picks the fastest option that fits. 'full' keeps everything on the GPU (fastest, most VRAM). 'model' moves one component (text encoder, denoiser, VAE) to the GPU at a time. 'sequential' streams the weights layer by layer: slowest, but runs large models on small GPUs. Ignored on CPU.
Methods
generate(self, input: Tuple[ForwardRef('Image.Image'), str]) -> List[Any]
SD15OpenPoseControlNetModelGenerate output from a generative model.
Parameters
- input : Tuple[Image.Image, str]
- Input image and text prompt.
Returns
- List[Any]
- Generated output images in a list.
component_dir(cls) -> pathlib.Path
DownloadableMixinReturn this component's own storage directory.
Returns
- pathlib.Path
<COMPONENT_PATH>/<ClassName>.
delete(cls) -> None
DownloadableMixinRemove the component's downloaded artifacts.
download(cls, report: Optional[Callable[[Optional[float], Optional[str]], NoneType]] = None) -> None
HFDownloadableMixinDownload all repos listed in hf_repos() into component_dir().
Parameters
- report : ProgressReporter, optional
- Callback invoked before each repo download with
report(None, "Downloading <repo_id>").Nonemeans no progress reporting.
get_credential(self, name: str)
ConfigObjectResolve a registered credential component by name.
Parameters
- name : str
- Credential component class name (e.g. "HuggingFaceCredential").
Returns
- BaseCredential
- An instance of the requested credential component.
get_metadata(cls) -> Dict[str, Any]
BaseGenerativeModelGet metadata values for the current generative model.
Returns
- Dict[str, Any]
- Dictionary indicating whether the model requires a download before use and the expected download size in bytes.
get_schema(cls) -> dict
ConfigObjectGenerates the component related Json Schema.
Returns
- dict
- Dictionary representing the Json Schema of the component.
hf_repos(cls) -> List[Union[Tuple[str, str], Tuple[str, str, List[str]]]]
HFDownloadableMixinReturn the repo entries this component needs.
Returns
- list of tuple
- Each entry is either
(repo_id, repo_type)or(repo_id, repo_type, allow_patterns).
is_downloaded(cls) -> bool
HFDownloadableMixinReturn whether all repo directories exist and are non-empty.
Returns
- bool
Truewhen every repo listed inhf_repos()has a non-empty local directory;Falseotherwise (including when the list is empty).
validate_and_transform(self, raw_data: dict) -> dict
ConfigObjectIt takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.
Parameters
- raw_data : dict
- A dictionary with the data provided by the user to initialize the model.
Returns
- dict
- A validated dictionary with the necessary objects.