AutoPipeline¶
The AutoPipline automatically retrieves relevant diffusers pipeline models, including the weights, configurations, and vocabularies, based on their names or paths. This feature allows users to easily load and use models without needing to know their exact model architecture.
Key Classes¶
RBLNAutoPipelineForText2Image
: AutoPipeline for models that generate images from texts.RBLNAutoPipelineForImage2Image
: AutoPipeline for models that generate images from images.RBLNAutoPipelineForInpainting
: AutoPipeline for inpainting.
Supported Pipelines¶
- Text2Image
Model | Model Architecture | AutoPipeline |
---|---|---|
Stable Diffusion | StableDiffusionPipeline | RBLNAutoPipelineForText2Image |
Stable Diffusion + LoRA | StableDiffusionPipeline | RBLNAutoModelForText2Image |
Stable Diffusion V3† | StableDiffusion3Pipeline | RBLNAutoPipelineForText2Image |
Stable Diffusion XL | StableDiffusionXLPipeline | RBLNAutoPipelineForText2Image |
Stable Diffusion XL + multi-LoRA | StableDiffusionXLPipeline | RBLNAutoModelForText2Image |
SDXL-turbo | StableDiffusionXLPipeline | RBLNAutoPipelineForText2Image |
Stable Diffusion + ControlNet | StableDiffusionControlNetPipeline | RBLNAutoPipelineForText2Image |
Stable Diffusion XL + ControlNet | StableDiffusionXLControlNetPipeline | RBLNAutoPipelineForText2Image |
Kandinsky V2.2 | KandinskyV22CombinedPipeline | RBLNAutoPipelineForText2Image |
- Image2Image
Model | Model Architecture | AutoPipeline |
---|---|---|
Stable Diffusion | StableDiffusionImg2ImgPipeline | RBLNAutoPipelineForImage2Image |
Stable Diffusion V3† | StableDiffusion3Img2ImgPipeline | RBLNAutoPipelineForImage2Image |
Stable Diffusion XL | StableDiffusionXLImg2ImgPipeline | RBLNAutoPipelineForImage2Image |
SDXL-turbo | StableDiffusionXLImg2ImgPipeline | RBLNAutoPipelineForImage2Image |
Stable Diffusion + ControlNet | StableDiffusionControlNetImg2ImgPipeline | RBLNAutoPipelineForImage2Image |
Stable Diffusion XL + ControlNet | StableDiffusionXLControlNetImg2ImgPipeline | RBLNAutoPipelineForImage2Image |
Kandinsky V2.2 | KandinskyV22Img2ImgCombinedPipeline | RBLNAutoPipelineForImage2Image |
- Inpainting
Model | Model Architecture | AutoPipeline |
---|---|---|
Stable Diffusion | StableDiffusionInpaintPipeline | RBLNAutoPipelineForInpainting |
Stable Diffusion V3† | StableDiffusion3InpaintPipeline | RBLNAutoPipelineForInpainting |
Stable Diffusion XL | StableDiffusionXLInpaintPipeline | RBLNAutoPipelineForInpainting |
Kandinsky V2.2 | KandinskyV22InpaintCombinedPipeline | RBLNAutoPipelineForInpainting |
API Reference¶
Classes¶
RBLNAutoPipelineForText2Image
¶
Bases: RBLNAutoPipelineBase
, AutoPipelineForText2Image
Text2Image AutoPipeline for RBLN NPUs.
Functions¶
from_pretrained(model_id, **kwargs)
classmethod
¶
The from_pretrained()
function is utilized in its standard form as in the HuggingFace transformers library.
User can use this function to load a pre-trained model from the HuggingFace library and convert it to a RBLN model to be run on RBLN NPUs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
The model id of the pre-trained model to be loaded. It can be downloaded from the HuggingFace model hub or a local path, or a model id of a compiled model using the RBLN Compiler. |
required | |
kwargs
|
Additional keyword arguments. Arguments with the prefix 'rbln_' are passed to rbln_config, while the remaining arguments are passed to the HuggingFace library. |
{}
|
Returns:
Type | Description |
---|---|
A RBLN model instance ready for inference on RBLN NPU devices. |
from_model(model, **kwargs)
classmethod
¶
Converts and compiles a pre-trained HuggingFace library model into a RBLN model. This method performs the actual model conversion and compilation process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
The PyTorch model to be compiled. The object must be an instance of the HuggingFace transformers PreTrainedModel class. |
required | |
kwargs
|
Additional keyword arguments. Arguments with the prefix 'rbln_' are passed to rbln_config, while the remaining arguments are passed to the HuggingFace library. |
{}
|
The method performs the following steps:
- Compiles the PyTorch model into an optimized RBLN graph
- Configures the model for the specified NPU device
- Creates the necessary runtime objects if requested
- Saves the compiled model and configurations
Returns:
Type | Description |
---|---|
A RBLN model instance ready for inference on RBLN NPU devices. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoPipelineForImage2Image
¶
Bases: RBLNAutoPipelineBase
, AutoPipelineForImage2Image
Image2Image AutoPipeline for RBLN NPUs.
Functions¶
from_pretrained(model_id, **kwargs)
classmethod
¶
The from_pretrained()
function is utilized in its standard form as in the HuggingFace transformers library.
User can use this function to load a pre-trained model from the HuggingFace library and convert it to a RBLN model to be run on RBLN NPUs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
The model id of the pre-trained model to be loaded. It can be downloaded from the HuggingFace model hub or a local path, or a model id of a compiled model using the RBLN Compiler. |
required | |
kwargs
|
Additional keyword arguments. Arguments with the prefix 'rbln_' are passed to rbln_config, while the remaining arguments are passed to the HuggingFace library. |
{}
|
Returns:
Type | Description |
---|---|
A RBLN model instance ready for inference on RBLN NPU devices. |
from_model(model, **kwargs)
classmethod
¶
Converts and compiles a pre-trained HuggingFace library model into a RBLN model. This method performs the actual model conversion and compilation process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
The PyTorch model to be compiled. The object must be an instance of the HuggingFace transformers PreTrainedModel class. |
required | |
kwargs
|
Additional keyword arguments. Arguments with the prefix 'rbln_' are passed to rbln_config, while the remaining arguments are passed to the HuggingFace library. |
{}
|
The method performs the following steps:
- Compiles the PyTorch model into an optimized RBLN graph
- Configures the model for the specified NPU device
- Creates the necessary runtime objects if requested
- Saves the compiled model and configurations
Returns:
Type | Description |
---|---|
A RBLN model instance ready for inference on RBLN NPU devices. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|
RBLNAutoPipelineForInpainting
¶
Bases: RBLNAutoPipelineBase
, AutoPipelineForInpainting
Inpainting AutoPipeline for RBLN NPUs.
Functions¶
from_pretrained(model_id, **kwargs)
classmethod
¶
The from_pretrained()
function is utilized in its standard form as in the HuggingFace transformers library.
User can use this function to load a pre-trained model from the HuggingFace library and convert it to a RBLN model to be run on RBLN NPUs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id
|
The model id of the pre-trained model to be loaded. It can be downloaded from the HuggingFace model hub or a local path, or a model id of a compiled model using the RBLN Compiler. |
required | |
kwargs
|
Additional keyword arguments. Arguments with the prefix 'rbln_' are passed to rbln_config, while the remaining arguments are passed to the HuggingFace library. |
{}
|
Returns:
Type | Description |
---|---|
A RBLN model instance ready for inference on RBLN NPU devices. |
from_model(model, **kwargs)
classmethod
¶
Converts and compiles a pre-trained HuggingFace library model into a RBLN model. This method performs the actual model conversion and compilation process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model
|
The PyTorch model to be compiled. The object must be an instance of the HuggingFace transformers PreTrainedModel class. |
required | |
kwargs
|
Additional keyword arguments. Arguments with the prefix 'rbln_' are passed to rbln_config, while the remaining arguments are passed to the HuggingFace library. |
{}
|
The method performs the following steps:
- Compiles the PyTorch model into an optimized RBLN graph
- Configures the model for the specified NPU device
- Creates the necessary runtime objects if requested
- Saves the compiled model and configurations
Returns:
Type | Description |
---|---|
A RBLN model instance ready for inference on RBLN NPU devices. |
register(rbln_cls, exist_ok=False)
staticmethod
¶
Register a new RBLN model class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rbln_cls
|
Type[RBLNBaseModel]
|
The RBLN model class to register. |
required |
exist_ok
|
bool
|
Whether to allow registering an already registered model. |
False
|