openvino_genai.Text2ImagePipeline#

class openvino_genai.Text2ImagePipeline#

Bases: pybind11_object

This class is used for generation with text-to-image models.

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, models_path: os.PathLike) -> None

    Text2ImagePipeline class constructor. models_path (str): Path to the folder with exported model files.

  2. __init__(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, models_path: os.PathLike, device: str, **kwargs) -> None

    Text2ImagePipeline class constructor. models_path (str): Path with exported model files. device (str): Device to run the model on (e.g., CPU, GPU). kwargs: Text2ImagePipeline properties

Methods

__delattr__(name, /)

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__(value, /)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__init__(*args, **kwargs)

Overloaded function.

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(**kwargs)

__reduce__()

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

compile(self, device, **kwargs)

Compiles the model.

generate(self, prompt, **kwargs)

Generates images for text-to-image models.

get_generation_config(self)

latent_consistency_model(self, arg0, arg1, arg2)

reshape(self, arg0, arg1, arg2, arg3)

set_generation_config(self, arg0)

set_scheduler(self, arg0)

stable_diffusion(self, arg0, arg1, arg2)

stable_diffusion_xl(self, arg0, arg1, arg2, arg3)

__class__#

alias of pybind11_type

__delattr__(name, /)#

Implement delattr(self, name).

__dir__()#

Default dir() implementation.

__eq__(value, /)#

Return self==value.

__format__(format_spec, /)#

Default object formatter.

__ge__(value, /)#

Return self>=value.

__getattribute__(name, /)#

Return getattr(self, name).

__gt__(value, /)#

Return self>value.

__hash__()#

Return hash(self).

__init__(*args, **kwargs)#

Overloaded function.

  1. __init__(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, models_path: os.PathLike) -> None

    Text2ImagePipeline class constructor. models_path (str): Path to the folder with exported model files.

  2. __init__(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, models_path: os.PathLike, device: str, **kwargs) -> None

    Text2ImagePipeline class constructor. models_path (str): Path with exported model files. device (str): Device to run the model on (e.g., CPU, GPU). kwargs: Text2ImagePipeline properties

__init_subclass__()#

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__(value, /)#

Return self<=value.

__lt__(value, /)#

Return self<value.

__ne__(value, /)#

Return self!=value.

__new__(**kwargs)#
__reduce__()#

Helper for pickle.

__reduce_ex__(protocol, /)#

Helper for pickle.

__repr__()#

Return repr(self).

__setattr__(name, value, /)#

Implement setattr(self, name, value).

__sizeof__()#

Size of object in memory, in bytes.

__str__()#

Return str(self).

__subclasshook__()#

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

compile(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, device: str, **kwargs) None#

Compiles the model. device (str): Device to run the model on (e.g., CPU, GPU). kwargs: Device properties.

generate(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, prompt: str, **kwargs) object#

Generates images for text-to-image models.

Parameters:
  • prompt (str) – input prompt

  • kwargs – arbitrary keyword arguments with keys corresponding to generate params.

Expected parameters list: prompt_2: str - second prompt, prompt_3: str - third prompt, negative_prompt: str - negative prompt, negative_prompt_2: str - second negative prompt, negative_prompt_3: str - third negative prompt, num_images_per_prompt: int - number of images, that should be generated per prompt, guidance_scale: float - guidance scale, generation_config: GenerationConfig, height: int - height of resulting images, width: int - width of resulting images, num_inference_steps: int - number of inference steps, generator: openvino_genai.CppStdGenerator or class inherited from openvino_genai.Generator - random generator adapters: LoRA adapters strength: strength for image to image generation. 1.0f means initial image is fully noised

Returns:

ov.Tensor with resulting images

Return type:

ov.Tensor

get_generation_config(self: openvino_genai.py_openvino_genai.Text2ImagePipeline) openvino_genai.py_openvino_genai.ImageGenerationConfig#
latent_consistency_model(self: ov::genai::Scheduler, arg0: openvino_genai.py_openvino_genai.CLIPTextModel, arg1: openvino_genai.py_openvino_genai.UNet2DConditionModel, arg2: openvino_genai.py_openvino_genai.AutoencoderKL) openvino_genai.py_openvino_genai.Text2ImagePipeline#
reshape(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, arg0: int, arg1: int, arg2: int, arg3: float) None#
set_generation_config(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, arg0: openvino_genai.py_openvino_genai.ImageGenerationConfig) None#
set_scheduler(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, arg0: ov::genai::Scheduler) None#
stable_diffusion(self: ov::genai::Scheduler, arg0: openvino_genai.py_openvino_genai.CLIPTextModel, arg1: openvino_genai.py_openvino_genai.UNet2DConditionModel, arg2: openvino_genai.py_openvino_genai.AutoencoderKL) openvino_genai.py_openvino_genai.Text2ImagePipeline#
stable_diffusion_xl(self: ov::genai::Scheduler, arg0: openvino_genai.py_openvino_genai.CLIPTextModel, arg1: openvino_genai.py_openvino_genai.CLIPTextModelWithProjection, arg2: openvino_genai.py_openvino_genai.UNet2DConditionModel, arg3: openvino_genai.py_openvino_genai.AutoencoderKL) openvino_genai.py_openvino_genai.Text2ImagePipeline#