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.
__init__(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, models_path: os.PathLike) -> None
Text2ImagePipeline class constructor. models_path (os.PathLike): Path to the folder with exported model files.
__init__(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, models_path: os.PathLike, device: str, **kwargs) -> None
Text2ImagePipeline class constructor. models_path (os.PathLike): 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.
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)Helper for pickle.
__reduce_ex__
(protocol, /)Helper for pickle.
__repr__
()Return repr(self).
__setattr__
(name, value, /)Implement setattr(self, name, value).
Size of object in memory, in bytes.
__str__
()Return str(self).
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
(scheduler, ...)reshape
(self, num_images_per_prompt, height, ...)set_generation_config
(self, generation_config)set_scheduler
(self, scheduler)stable_diffusion
(scheduler, clip_text_model, ...)stable_diffusion_xl
(scheduler, ...)- __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.
__init__(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, models_path: os.PathLike) -> None
Text2ImagePipeline class constructor. models_path (os.PathLike): Path to the folder with exported model files.
__init__(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, models_path: os.PathLike, device: str, **kwargs) -> None
Text2ImagePipeline class constructor. models_path (os.PathLike): 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) openvino._pyopenvino.Tensor #
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 #
- static latent_consistency_model(scheduler: openvino_genai.py_openvino_genai.Scheduler, clip_text_model: openvino_genai.py_openvino_genai.CLIPTextModel, unet: openvino_genai.py_openvino_genai.UNet2DConditionModel, vae: openvino_genai.py_openvino_genai.AutoencoderKL) openvino_genai.py_openvino_genai.Text2ImagePipeline #
- reshape(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, num_images_per_prompt: int, height: int, width: int, guidance_scale: float) None #
- set_generation_config(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, generation_config: openvino_genai.py_openvino_genai.ImageGenerationConfig) None #
- set_scheduler(self: openvino_genai.py_openvino_genai.Text2ImagePipeline, scheduler: openvino_genai.py_openvino_genai.Scheduler) None #
- static stable_diffusion(scheduler: openvino_genai.py_openvino_genai.Scheduler, clip_text_model: openvino_genai.py_openvino_genai.CLIPTextModel, unet: openvino_genai.py_openvino_genai.UNet2DConditionModel, vae: openvino_genai.py_openvino_genai.AutoencoderKL) openvino_genai.py_openvino_genai.Text2ImagePipeline #
- static stable_diffusion_xl(scheduler: openvino_genai.py_openvino_genai.Scheduler, clip_text_model: openvino_genai.py_openvino_genai.CLIPTextModel, clip_text_model_with_projection: openvino_genai.py_openvino_genai.CLIPTextModelWithProjection, unet: openvino_genai.py_openvino_genai.UNet2DConditionModel, vae: openvino_genai.py_openvino_genai.AutoencoderKL) openvino_genai.py_openvino_genai.Text2ImagePipeline #