콘텐츠로 이동

AutoPipeline

AutoPipline은 이름이나 경로를 기반으로 비슷한 디퓨전 파이프라인 모델(가중치, 설정, 어휘 등)을 자동으로 불러옵니다. 이를 통해 사용자는 정확한 모델 아키텍처를 알지 못해도 모델을 쉽게 불러올 수 있습니다.

핵심 클래스

지원되는 파이프라인

  • 텍스트-투-이미지 변환 (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 참조

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:

  1. Compiles the PyTorch model into an optimized RBLN graph
  2. Configures the model for the specified NPU device
  3. Creates the necessary runtime objects if requested
  4. 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:

  1. Compiles the PyTorch model into an optimized RBLN graph
  2. Configures the model for the specified NPU device
  3. Creates the necessary runtime objects if requested
  4. 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:

  1. Compiles the PyTorch model into an optimized RBLN graph
  2. Configures the model for the specified NPU device
  3. Creates the necessary runtime objects if requested
  4. 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