Stable Diffusion ControlNet¶
ControlNet integrates conditional control into standard Stable Diffusion models (like v1.5), enabling image generation guided by auxiliary inputs such as canny edges, depth maps, or human pose estimations. RBLN Optimum provides accelerated pipelines for these models on RBLN NPUs.
Supported NPU
Diffusers pipelines run on ATOM™ only. Rebel100™ does not support them yet.
Supported Pipelines¶
| Pipeline | Class | Description |
|---|---|---|
| Text-to-Image with ControlNet | RBLNStableDiffusionControlNetPipeline | Generate images from text prompts, guided by a control image. |
| Image-to-Image with ControlNet | RBLNStableDiffusionControlNetImg2ImgPipeline | Modify an existing image based on a text prompt and a control image. |
Important: Batch Size Configuration for Guidance Scale¶
Batch Size and Guidance Scale
Similar to standard Stable Diffusion, using ControlNet pipelines with a guidance scale > 1.0 (the default is 7.5) doubles the effective batch size of both the UNet and the ControlNet model during runtime.
Ensure the batch_size specified in the unet and controlnet sections of your RBLNStableDiffusionControlNetPipelineConfig matches the expected runtime batch size (typically 2 × the inference batch size if guidance_scale > 1.0).
Default Behavior¶
If you do not explicitly set batch sizes for unet and controlnet in the configuration, RBLN Optimum assumes guidance_scale > 1.0 and automatically sets their batch sizes to 2 × the pipeline's batch_size.
API Reference¶
RBLNStableDiffusionControlNetPipeline ¶
Bases: RBLNDiffusionMixin, StableDiffusionControlNetPipeline
RBLN-accelerated implementation of Stable Diffusion pipeline with ControlNet for guided text-to-image generation.
This pipeline compiles Stable Diffusion and ControlNet models to run efficiently on RBLN NPUs, enabling high-performance inference for generating images with precise structural control using conditioning inputs like edges, depth, or poses.
__call__(prompt=None, image=None, height=None, width=None, num_inference_steps=50, timesteps=None, guidance_scale=7.5, negative_prompt=None, num_images_per_prompt=1, eta=0.0, generator=None, latents=None, prompt_embeds=None, negative_prompt_embeds=None, ip_adapter_image=None, ip_adapter_image_embeds=None, output_type='pil', return_dict=True, cross_attention_kwargs=None, controlnet_conditioning_scale=1.0, guess_mode=False, control_guidance_start=0.0, control_guidance_end=1.0, clip_skip=None, callback_on_step_end=None, callback_on_step_end_tensor_inputs=None, **kwargs) ¶
The call function to the pipeline for generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt | `str` or `list[str]`, *optional* | The prompt or prompts to guide image generation. If not defined, you need to pass | None |
image | `torch.FloatTensor`, `PIL.Image.Image`, `np.ndarray`, `list[torch.FloatTensor]`, `list[PIL.Image.Image]`, `list[np.ndarray]`, `list[list[torch.FloatTensor]]`, `list[list[np.ndarray]]` or `list[list[PIL.Image.Image]]` | The ControlNet input condition to provide guidance to the | None |
height | `int`, *optional*, defaults to `self.unet.config.sample_size * self.vae_scale_factor` | The height in pixels of the generated image. | None |
width | `int`, *optional*, defaults to `self.unet.config.sample_size * self.vae_scale_factor` | The width in pixels of the generated image. | None |
num_inference_steps | `int`, *optional*, defaults to 50 | The number of denoising steps. More denoising steps usually lead to a higher quality image at the expense of slower inference. | 50 |
timesteps | `list[int]`, *optional* | Custom timesteps to use for the denoising process with schedulers which support a | None |
guidance_scale | `float`, *optional*, defaults to 7.5 | A higher guidance scale value encourages the model to generate images closely linked to the text | 7.5 |
negative_prompt | `str` or `list[str]`, *optional* | The prompt or prompts to guide what to not include in image generation. If not defined, you need to pass | None |
num_images_per_prompt | `int`, *optional*, defaults to 1 | The number of images to generate per prompt. | 1 |
eta | `float`, *optional*, defaults to 0.0 | Corresponds to parameter eta (η) from the DDIM paper. Only applies to the [ | 0.0 |
generator | `torch.Generator` or `list[torch.Generator]`, *optional* | A | None |
latents | `torch.FloatTensor`, *optional* | Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image generation. Can be used to tweak the same generation with different prompts. If not provided, a latents tensor is generated by sampling using the supplied random | None |
prompt_embeds | `torch.FloatTensor`, *optional* | Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not provided, text embeddings are generated from the | None |
negative_prompt_embeds | `torch.FloatTensor`, *optional* | Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not provided, | None |
ip_adapter_image | PipelineImageInput | None | ( | None |
ip_adapter_image_embeds | `list[torch.FloatTensor]`, *optional* | Pre-generated image embeddings for IP-Adapter. It should be a list of length same as number of IP-adapters. Each element should be a tensor of shape | None |
output_type | `str`, *optional*, defaults to `"pil"` | The output format of the generated image. Choose between | 'pil' |
return_dict | `bool`, *optional*, defaults to `True` | Whether or not to return a [ | True |
cross_attention_kwargs | `dict`, *optional* | A kwargs dictionary that if specified is passed along to the [ | None |
controlnet_conditioning_scale | `float` or `list[float]`, *optional*, defaults to 1.0 | The outputs of the ControlNet are multiplied by | 1.0 |
guess_mode | `bool`, *optional*, defaults to `False` | The ControlNet encoder tries to recognize the content of the input image even if you remove all prompts. A | False |
control_guidance_start | `float` or `list[float]`, *optional*, defaults to 0.0 | The percentage of total steps at which the ControlNet starts applying. | 0.0 |
control_guidance_end | `float` or `list[float]`, *optional*, defaults to 1.0 | The percentage of total steps at which the ControlNet stops applying. | 1.0 |
clip_skip | `int`, *optional* | Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that the output of the pre-final layer will be used for computing the prompt embeddings. | None |
callback_on_step_end | `Callable`, *optional* | A function that calls at the end of each denoising steps during the inference. The function is called with the following arguments: | None |
callback_on_step_end_tensor_inputs | `List`, *optional* | The list of tensor inputs for the | None |
Returns:
| Type | Description |
|---|---|
StableDiffusionPipelineOutput | tuple | [ |
from_pretrained(model_id, *, export=None, model_save_dir=None, rbln_config=None, lora_ids=None, lora_weights_names=None, lora_scales=None, **kwargs) classmethod ¶
Load a pretrained diffusion pipeline from a model checkpoint, with optional compilation for RBLN NPUs.
It supports various diffusion pipelines including Stable Diffusion, Kandinsky, ControlNet, and other diffusers-based models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_id | `str` | The model ID or path to the pretrained model to load. Can be either:
| required |
export | bool | None | If True, takes a PyTorch model from | None |
model_save_dir | str | PathLike[str] | None | Directory to save the compiled model artifacts. Only used when | None |
rbln_config | dict[str, Any] | RBLNModelConfig | None | Configuration options for RBLN compilation. Can include settings for specific submodules such as | None |
lora_ids | str | list[str] | None | LoRA adapter ID(s) to load and apply before compilation. LoRA weights are fused into the model weights during compilation. Only used when | None |
lora_weights_names | str | list[str] | None | Names of specific LoRA weight files to load, corresponding to lora_ids. Only used when | None |
lora_scales | float | list[float] | None | Scaling factor(s) to apply to the LoRA adapter(s). Only used when | None |
kwargs | Any | Additional arguments to pass to the underlying diffusion pipeline constructor or the RBLN compilation process. These may include parameters specific to individual submodules or the particular diffusion pipeline being used. | {} |
Returns:
| Type | Description |
|---|---|
Self | A compiled or loaded diffusion pipeline that can be used for inference on RBLN NPU. The returned object is an instance of the class that called this method, inheriting from RBLNDiffusionMixin. |
RBLNStableDiffusionControlNetImg2ImgPipeline ¶
Bases: RBLNDiffusionMixin, StableDiffusionControlNetImg2ImgPipeline
RBLN-accelerated implementation of Stable Diffusion pipeline with ControlNet for guided image-to-image generation.
This pipeline compiles Stable Diffusion and ControlNet models to run efficiently on RBLN NPUs, enabling high-performance inference for transforming input images with precise structural control and conditioning guidance.
__call__(prompt=None, image=None, control_image=None, height=None, width=None, strength=0.8, num_inference_steps=50, guidance_scale=7.5, negative_prompt=None, num_images_per_prompt=1, eta=0.0, generator=None, latents=None, prompt_embeds=None, negative_prompt_embeds=None, ip_adapter_image=None, ip_adapter_image_embeds=None, output_type='pil', return_dict=True, cross_attention_kwargs=None, controlnet_conditioning_scale=0.8, guess_mode=False, control_guidance_start=0.0, control_guidance_end=1.0, clip_skip=None, callback_on_step_end=None, callback_on_step_end_tensor_inputs=None, **kwargs) ¶
The call function to the pipeline for generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt | `str` or `list[str]`, *optional* | The prompt or prompts to guide image generation. If not defined, you need to pass | None |
image | `torch.FloatTensor`, `PIL.Image.Image`, `np.ndarray`, `list[torch.FloatTensor]`, `list[PIL.Image.Image]`, `list[np.ndarray]`, `list[list[torch.FloatTensor]]`, `list[list[np.ndarray]]` or `list[list[PIL.Image.Image]]` | The initial image to be used as the starting point for the image generation process. Can also accept image latents as | None |
control_image | `torch.FloatTensor`, `PIL.Image.Image`, `np.ndarray`, `list[torch.FloatTensor]`, `list[PIL.Image.Image]`, `list[np.ndarray]`, `list[list[torch.FloatTensor]]`, `list[list[np.ndarray]]` or `list[list[PIL.Image.Image]]` | The ControlNet input condition to provide guidance to the | None |
height | `int`, *optional*, defaults to `self.unet.config.sample_size * self.vae_scale_factor` | The height in pixels of the generated image. | None |
width | `int`, *optional*, defaults to `self.unet.config.sample_size * self.vae_scale_factor` | The width in pixels of the generated image. | None |
strength | `float`, *optional*, defaults to 0.8 | Indicates extent to transform the reference | 0.8 |
num_inference_steps | `int`, *optional*, defaults to 50 | The number of denoising steps. More denoising steps usually lead to a higher quality image at the expense of slower inference. | 50 |
guidance_scale | `float`, *optional*, defaults to 7.5 | A higher guidance scale value encourages the model to generate images closely linked to the text | 7.5 |
negative_prompt | `str` or `list[str]`, *optional* | The prompt or prompts to guide what to not include in image generation. If not defined, you need to pass | None |
num_images_per_prompt | `int`, *optional*, defaults to 1 | The number of images to generate per prompt. | 1 |
eta | `float`, *optional*, defaults to 0.0 | Corresponds to parameter eta (η) from the DDIM paper. Only applies to the [ | 0.0 |
generator | `torch.Generator` or `list[torch.Generator]`, *optional* | A | None |
latents | `torch.FloatTensor`, *optional* | Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image generation. Can be used to tweak the same generation with different prompts. If not provided, a latents tensor is generated by sampling using the supplied random | None |
prompt_embeds | `torch.FloatTensor`, *optional* | Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not provided, text embeddings are generated from the | None |
negative_prompt_embeds | `torch.FloatTensor`, *optional* | Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not provided, | None |
ip_adapter_image | PipelineImageInput | None | ( | None |
ip_adapter_image_embeds | `list[torch.FloatTensor]`, *optional* | Pre-generated image embeddings for IP-Adapter. It should be a list of length same as number of IP-adapters. Each element should be a tensor of shape | None |
output_type | `str`, *optional*, defaults to `"pil"` | The output format of the generated image. Choose between | 'pil' |
return_dict | `bool`, *optional*, defaults to `True` | Whether or not to return a [ | True |
cross_attention_kwargs | `dict`, *optional* | A kwargs dictionary that if specified is passed along to the [ | None |
controlnet_conditioning_scale | `float` or `list[float]`, *optional*, defaults to 1.0 | The outputs of the ControlNet are multiplied by | 0.8 |
guess_mode | `bool`, *optional*, defaults to `False` | The ControlNet encoder tries to recognize the content of the input image even if you remove all prompts. A | False |
control_guidance_start | `float` or `list[float]`, *optional*, defaults to 0.0 | The percentage of total steps at which the ControlNet starts applying. | 0.0 |
control_guidance_end | `float` or `list[float]`, *optional*, defaults to 1.0 | The percentage of total steps at which the ControlNet stops applying. | 1.0 |
clip_skip | `int`, *optional* | Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that the output of the pre-final layer will be used for computing the prompt embeddings. | None |
callback_on_step_end | `Callable`, *optional* | A function that calls at the end of each denoising steps during the inference. The function is called with the following arguments: | None |
callback_on_step_end_tensor_inputs | `List`, *optional* | The list of tensor inputs for the | None |
Returns:
| Type | Description |
|---|---|
StableDiffusionPipelineOutput | tuple | [ |
from_pretrained(model_id, *, export=None, model_save_dir=None, rbln_config=None, lora_ids=None, lora_weights_names=None, lora_scales=None, **kwargs) classmethod ¶
Load a pretrained diffusion pipeline from a model checkpoint, with optional compilation for RBLN NPUs.
It supports various diffusion pipelines including Stable Diffusion, Kandinsky, ControlNet, and other diffusers-based models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_id | `str` | The model ID or path to the pretrained model to load. Can be either:
| required |
export | bool | None | If True, takes a PyTorch model from | None |
model_save_dir | str | PathLike[str] | None | Directory to save the compiled model artifacts. Only used when | None |
rbln_config | dict[str, Any] | RBLNModelConfig | None | Configuration options for RBLN compilation. Can include settings for specific submodules such as | None |
lora_ids | str | list[str] | None | LoRA adapter ID(s) to load and apply before compilation. LoRA weights are fused into the model weights during compilation. Only used when | None |
lora_weights_names | str | list[str] | None | Names of specific LoRA weight files to load, corresponding to lora_ids. Only used when | None |
lora_scales | float | list[float] | None | Scaling factor(s) to apply to the LoRA adapter(s). Only used when | None |
kwargs | Any | Additional arguments to pass to the underlying diffusion pipeline constructor or the RBLN compilation process. These may include parameters specific to individual submodules or the particular diffusion pipeline being used. | {} |
Returns:
| Type | Description |
|---|---|
Self | A compiled or loaded diffusion pipeline that can be used for inference on RBLN NPU. The returned object is an instance of the class that called this method, inheriting from RBLNDiffusionMixin. |
RBLNStableDiffusionControlNetPipelineBaseConfig ¶
Bases: RBLNModelConfig
__init__(text_encoder=None, unet=None, vae=None, controlnet=None, *, batch_size=None, img_height=None, img_width=None, height=None, width=None, sample_size=None, image_size=None, guidance_scale=None, **kwargs) ¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text_encoder | RBLNCLIPTextModelConfig | None | Configuration for the text encoder component. Initialized as RBLNCLIPTextModelConfig if not provided. | None |
unet | RBLNUNet2DConditionModelConfig | None | Configuration for the UNet model component. Initialized as RBLNUNet2DConditionModelConfig if not provided. | None |
vae | RBLNAutoencoderKLConfig | None | Configuration for the VAE model component. Initialized as RBLNAutoencoderKLConfig if not provided. | None |
controlnet | RBLNControlNetModelConfig | None | Configuration for the ControlNet model component. Initialized as RBLNControlNetModelConfig if not provided. | None |
batch_size | int | None | Batch size for inference, applied to all submodules. | None |
img_height | int | None | Height of the generated images. | None |
img_width | int | None | Width of the generated images. | None |
height | int | None | Height of the generated images. | None |
width | int | None | Width of the generated images. | None |
sample_size | tuple[int, int] | None | Spatial dimensions for the UNet model. | None |
image_size | tuple[int, int] | None | Alternative way to specify image dimensions. Cannot be used together with img_height/img_width. | None |
guidance_scale | float | None | Scale for classifier-free guidance. | None |
kwargs | Any | Additional arguments passed to the parent RBLNModelConfig. | {} |
Raises:
| Type | Description |
|---|---|
ValueError | If both image_size and img_height/img_width are provided. |
Note
When guidance_scale > 1.0, the UNet batch size is automatically doubled to accommodate classifier-free guidance.
from_pretrained(path, rbln_config=None, return_unused_kwargs=False, **kwargs) classmethod ¶
Load a RBLNModelConfig from a path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the RBLNModelConfig file or directory containing the config file. | required |
rbln_config | dict[str, Any] | None | Additional configuration to override. | None |
return_unused_kwargs | bool | Whether to return unused kwargs. | False |
kwargs | Any | Additional keyword arguments to override configuration values. Keys starting with 'rbln_' will have the prefix removed and be used to update the configuration. | {} |
Returns:
| Name | Type | Description |
|---|---|---|
RBLNModelConfig | Self | tuple[Self, dict[str, Any]] | The loaded configuration instance. |
Note
This method loads the configuration from the specified path and applies any provided overrides. If the loaded configuration class doesn't match the expected class, a warning will be logged.
Examples:
initialize_submodule_config(submodule_config=None, force_kwargs=False, **kwargs) ¶
Build the config of a submodule from the parent's runtime options and kwargs.
Returns the submodule config instance when its class is known (an instance was passed, or cls_name was given), otherwise the merged kwargs dict for the model class to resolve later.
get_load_overrides() ¶
Extract the options that must cross the load boundary, for passing to from_pretrained.
Returns the explicitly-set runtime options (device, device_map, create_runtimes, activate_profiler, timeout) and the subclass-specific non-save attributes (load-behavior flags such as _load_visual_runtime, which are never serialized so they can only travel with the caller), recursively including submodules. Compile-time attributes are not included: when loading a compiled model they come from the artifact's rbln_config.json, and this dict is merged on top of it.
Returns:
| Type | Description |
|---|---|
dict[str, Any] | Dictionary of load overrides, keyed like the |
RBLNStableDiffusionControlNetPipelineConfig ¶
Bases: RBLNStableDiffusionControlNetPipelineBaseConfig
Configuration for Stable Diffusion ControlNet pipeline.
initialize_submodule_config(submodule_config=None, force_kwargs=False, **kwargs) ¶
Build the config of a submodule from the parent's runtime options and kwargs.
Returns the submodule config instance when its class is known (an instance was passed, or cls_name was given), otherwise the merged kwargs dict for the model class to resolve later.
__init__(text_encoder=None, unet=None, vae=None, controlnet=None, *, batch_size=None, img_height=None, img_width=None, height=None, width=None, sample_size=None, image_size=None, guidance_scale=None, **kwargs) ¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text_encoder | RBLNCLIPTextModelConfig | None | Configuration for the text encoder component. Initialized as RBLNCLIPTextModelConfig if not provided. | None |
unet | RBLNUNet2DConditionModelConfig | None | Configuration for the UNet model component. Initialized as RBLNUNet2DConditionModelConfig if not provided. | None |
vae | RBLNAutoencoderKLConfig | None | Configuration for the VAE model component. Initialized as RBLNAutoencoderKLConfig if not provided. | None |
controlnet | RBLNControlNetModelConfig | None | Configuration for the ControlNet model component. Initialized as RBLNControlNetModelConfig if not provided. | None |
batch_size | int | None | Batch size for inference, applied to all submodules. | None |
img_height | int | None | Height of the generated images. | None |
img_width | int | None | Width of the generated images. | None |
height | int | None | Height of the generated images. | None |
width | int | None | Width of the generated images. | None |
sample_size | tuple[int, int] | None | Spatial dimensions for the UNet model. | None |
image_size | tuple[int, int] | None | Alternative way to specify image dimensions. Cannot be used together with img_height/img_width. | None |
guidance_scale | float | None | Scale for classifier-free guidance. | None |
kwargs | Any | Additional arguments passed to the parent RBLNModelConfig. | {} |
Raises:
| Type | Description |
|---|---|
ValueError | If both image_size and img_height/img_width are provided. |
Note
When guidance_scale > 1.0, the UNet batch size is automatically doubled to accommodate classifier-free guidance.
get_load_overrides() ¶
Extract the options that must cross the load boundary, for passing to from_pretrained.
Returns the explicitly-set runtime options (device, device_map, create_runtimes, activate_profiler, timeout) and the subclass-specific non-save attributes (load-behavior flags such as _load_visual_runtime, which are never serialized so they can only travel with the caller), recursively including submodules. Compile-time attributes are not included: when loading a compiled model they come from the artifact's rbln_config.json, and this dict is merged on top of it.
Returns:
| Type | Description |
|---|---|
dict[str, Any] | Dictionary of load overrides, keyed like the |
from_pretrained(path, rbln_config=None, return_unused_kwargs=False, **kwargs) classmethod ¶
Load a RBLNModelConfig from a path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the RBLNModelConfig file or directory containing the config file. | required |
rbln_config | dict[str, Any] | None | Additional configuration to override. | None |
return_unused_kwargs | bool | Whether to return unused kwargs. | False |
kwargs | Any | Additional keyword arguments to override configuration values. Keys starting with 'rbln_' will have the prefix removed and be used to update the configuration. | {} |
Returns:
| Name | Type | Description |
|---|---|---|
RBLNModelConfig | Self | tuple[Self, dict[str, Any]] | The loaded configuration instance. |
Note
This method loads the configuration from the specified path and applies any provided overrides. If the loaded configuration class doesn't match the expected class, a warning will be logged.
Examples:
RBLNStableDiffusionControlNetImg2ImgPipelineConfig ¶
Bases: RBLNStableDiffusionControlNetPipelineBaseConfig
Configuration for Stable Diffusion ControlNet image-to-image pipeline.
initialize_submodule_config(submodule_config=None, force_kwargs=False, **kwargs) ¶
Build the config of a submodule from the parent's runtime options and kwargs.
Returns the submodule config instance when its class is known (an instance was passed, or cls_name was given), otherwise the merged kwargs dict for the model class to resolve later.
__init__(text_encoder=None, unet=None, vae=None, controlnet=None, *, batch_size=None, img_height=None, img_width=None, height=None, width=None, sample_size=None, image_size=None, guidance_scale=None, **kwargs) ¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text_encoder | RBLNCLIPTextModelConfig | None | Configuration for the text encoder component. Initialized as RBLNCLIPTextModelConfig if not provided. | None |
unet | RBLNUNet2DConditionModelConfig | None | Configuration for the UNet model component. Initialized as RBLNUNet2DConditionModelConfig if not provided. | None |
vae | RBLNAutoencoderKLConfig | None | Configuration for the VAE model component. Initialized as RBLNAutoencoderKLConfig if not provided. | None |
controlnet | RBLNControlNetModelConfig | None | Configuration for the ControlNet model component. Initialized as RBLNControlNetModelConfig if not provided. | None |
batch_size | int | None | Batch size for inference, applied to all submodules. | None |
img_height | int | None | Height of the generated images. | None |
img_width | int | None | Width of the generated images. | None |
height | int | None | Height of the generated images. | None |
width | int | None | Width of the generated images. | None |
sample_size | tuple[int, int] | None | Spatial dimensions for the UNet model. | None |
image_size | tuple[int, int] | None | Alternative way to specify image dimensions. Cannot be used together with img_height/img_width. | None |
guidance_scale | float | None | Scale for classifier-free guidance. | None |
kwargs | Any | Additional arguments passed to the parent RBLNModelConfig. | {} |
Raises:
| Type | Description |
|---|---|
ValueError | If both image_size and img_height/img_width are provided. |
Note
When guidance_scale > 1.0, the UNet batch size is automatically doubled to accommodate classifier-free guidance.
get_load_overrides() ¶
Extract the options that must cross the load boundary, for passing to from_pretrained.
Returns the explicitly-set runtime options (device, device_map, create_runtimes, activate_profiler, timeout) and the subclass-specific non-save attributes (load-behavior flags such as _load_visual_runtime, which are never serialized so they can only travel with the caller), recursively including submodules. Compile-time attributes are not included: when loading a compiled model they come from the artifact's rbln_config.json, and this dict is merged on top of it.
Returns:
| Type | Description |
|---|---|
dict[str, Any] | Dictionary of load overrides, keyed like the |
from_pretrained(path, rbln_config=None, return_unused_kwargs=False, **kwargs) classmethod ¶
Load a RBLNModelConfig from a path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path | str | Path to the RBLNModelConfig file or directory containing the config file. | required |
rbln_config | dict[str, Any] | None | Additional configuration to override. | None |
return_unused_kwargs | bool | Whether to return unused kwargs. | False |
kwargs | Any | Additional keyword arguments to override configuration values. Keys starting with 'rbln_' will have the prefix removed and be used to update the configuration. | {} |
Returns:
| Name | Type | Description |
|---|---|---|
RBLNModelConfig | Self | tuple[Self, dict[str, Any]] | The loaded configuration instance. |
Note
This method loads the configuration from the specified path and applies any provided overrides. If the loaded configuration class doesn't match the expected class, a warning will be logged.
Examples: