Diffusers documentation

Kandinsky 5.0 Image

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

Kandinsky 5.0 Image

Kandinsky 5.0は、動画および画像の生成のための拡散モデルのファミリーです。

Kandinsky 5.0 Image Lite は軽量な画像生成モデル(6B パラメータ)です。

このモデルには、いくつかの重要な革新が導入されています。

  • 潜在拡散パイプラインとFlow Matchingによる訓練安定性の向上
  • Diffusion Transformer (DiT)を主要な生成バックボーンとし、テキスト埋め込みへのクロスアテンションを使用
  • Qwen2.5-VLとCLIPを用いたデュアルテキストエンコーディングによる包括的なテキスト理解
  • 効率的な画像エンコードとデコードのためのFlux VAE

元のコードベースはkandinskylab/Kandinsky-5で確認できます。

テキストから動画への変換用の公式モデルチェックポイント(事前学習済み、SFT、no-CFG、蒸留済みバリアントを含む)については、Hub上のKandinsky Lab組織を確認してください。

利用可能なモデル

Kandinsky 5.0 Image Lite:

model_id説明ユースケース
kandinskylab/Kandinsky-5.0-T2I-Lite-sft-Diffusers6B画像のSupervised Fine-Tunedモデル最高品質の生成
kandinskylab/Kandinsky-5.0-I2I-Lite-sft-Diffusers6B画像編集用のSupervised Fine-Tunedモデル最高品質の生成
kandinskylab/Kandinsky-5.0-T2I-Lite-pretrain-Diffusers6B画像ベース事前学習モデル研究とファインチューニング
kandinskylab/Kandinsky-5.0-I2I-Lite-pretrain-Diffusers6B画像編集ベース事前学習モデル研究とファインチューニング

使用例

基本的なテキストから画像への生成

import torch
from diffusers import Kandinsky5T2IPipeline

# Load the pipeline
model_id = "kandinskylab/Kandinsky-5.0-T2I-Lite-sft-Diffusers"
pipe = Kandinsky5T2IPipeline.from_pretrained(model_id)
_ = pipe.to(device='cuda',dtype=torch.bfloat16)  # or "mps", "xpu", "cpu"

# Generate image
prompt = "A fluffy, expressive cat wearing a bright red hat with a soft, slightly textured fabric. The hat should look cozy and well-fitted on the cat’s head. On the front of the hat, add clean, bold white text that reads “SWEET”, clearly visible and neatly centered. Ensure the overall lighting highlights the hat’s color and the cat’s fur details."

output = pipe(
    prompt=prompt,
    negative_prompt="",
    height=1024,
    width=1024,
    num_inference_steps=50,
    guidance_scale=3.5,
).image[0]

基本的なImage-to-Image生成

import torch
from diffusers import Kandinsky5I2IPipeline
from diffusers.utils import load_image 
# Load the pipeline
model_id = "kandinskylab/Kandinsky-5.0-I2I-Lite-sft-Diffusers"
pipe = Kandinsky5I2IPipeline.from_pretrained(model_id)

_ = pipe.to(device='cuda',dtype=torch.bfloat16)  # or "mps", "xpu", "cpu"
pipe.enable_model_cpu_offload()                                               # <--- Enable CPU offloading for single GPU inference

# Edit the input image
image = load_image(
    "https://huggingface.co/kandinsky-community/kandinsky-3/resolve/main/assets/title.jpg?download=true"
)

prompt = "Change the background from a winter night scene to a bright summer day. Place the character on a sandy beach with clear blue sky, soft sunlight, and gentle waves in the distance. Replace the winter clothing with a light short-sleeved T-shirt (in soft pastel colors) and casual shorts. Ensure the character’s fur reflects warm daylight instead of cold winter tones. Add small beach details such as seashells, footprints in the sand, and a few scattered beach toys nearby. Keep the oranges in the scene, but place them naturally on the sand."
negative_prompt = ""

output = pipe(
    image=image,
    prompt=prompt,
    negative_prompt=negative_prompt,
    guidance_scale=3.5,
).image[0]

Kandinsky5T2IPipeline

class diffusers.Kandinsky5T2IPipeline

< >

( transformer: Kandinsky5Transformer3DModelvae: AutoencoderKLtext_encoder: Qwen2_5_VLForConditionalGenerationtokenizer: Qwen2VLProcessortext_encoder_2: CLIPTextModeltokenizer_2: CLIPTokenizerscheduler: FlowMatchEulerDiscreteScheduler )

パラメータ

  • transformer (Kandinsky5Transformer3DModel) — エンコードされた画像潜在変数をノイズ除去するための条件付き Transformer。
  • vae (AutoencoderKL) — black-forest-labs/FLUX.1-dev (vae) の Variational Auto-Encoder モデル。動画を潜在表現にエンコードし、潜在表現からデコードするために使用します。
  • text_encoder (Qwen2_5_VLForConditionalGeneration) — 凍結されたテキストエンコーダー Qwen2.5-VL。
  • tokenizer (AutoProcessor) — Qwen2.5-VL用のトークナイザーです。
  • text_encoder_2 (CLIPTextModel) — 凍結された CLIP、具体的には clip-vit-large-patch14 バリアントです。
  • tokenizer_2 (CLIPTokenizer) — CLIP用のトークナイザー。
  • scheduler (FlowMatchEulerDiscreteScheduler) — transformer と組み合わせて、エンコードされた画像の潜在変数からノイズを除去するために使用するスケジューラ。

Kandinsky 5.0 を使用したテキストから画像を生成するための Pipeline。

このモデルは DiffusionPipeline を継承しています。すべてのパイプラインに実装されている汎用的なメソッド(ダウンロード、保存、特定のデバイスでの実行など)については、スーパークラスのドキュメントを参照してください。

__call__

< >

( prompt: str | list[str] = Nonenegative_prompt: str | list[str] | None = Noneheight: int = 1024width: int = 1024num_inference_steps: int = 50guidance_scale: float = 3.5num_images_per_prompt: int | None = 1generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = Nonelatents: typing.Optional[torch.Tensor] = Noneprompt_embeds_qwen: typing.Optional[torch.Tensor] = Noneprompt_embeds_clip: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds_qwen: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds_clip: typing.Optional[torch.Tensor] = Noneprompt_cu_seqlens: typing.Optional[torch.Tensor] = Nonenegative_prompt_cu_seqlens: typing.Optional[torch.Tensor] = Noneoutput_type: str | None = 'pil'return_dict: bool = Truecallback_on_step_end: typing.Optional[typing.Callable[[int, int, NoneType], diffusers.callbacks.PipelineCallback | diffusers.callbacks.MultiPipelineCallbacks]] = Nonecallback_on_step_end_tensor_inputs: list = ['latents']max_sequence_length: int = 512 ) → ~KandinskyImagePipelineOutput or tuple

パラメータ

  • prompt (str または list[str]、省略可) — 画像生成をガイドするためのプロンプトです。定義されていない場合は、代わりに prompt_embeds を渡してください。
  • negative_prompt (str または list[str]、任意) — 画像生成時に回避するプロンプトです。未定義の場合は、代わりにnegative_prompt_embedsを渡してください。guidance を使用していない場合(guidance_scale < 1)は無視されます。
  • height (int、デフォルト値は 1024) — 生成される画像の高さ(ピクセル単位)。
  • width (int、デフォルト値は1024) — 生成される画像の幅(ピクセル単位)。
  • num_inference_steps (int、デフォルトは 50) — デノイジングのステップ数です。
  • guidance_scale (float、デフォルトは5.0) — classifier-free guidanceで定義されるガイダンススケール。
  • num_images_per_prompt (int、任意、デフォルトは 1) — プロンプトごとに生成する画像の数。
  • generator (torch.Generator または list[torch.Generator]、省略可) — 生成を決定論的にするための torch ジェネレーター。
  • latents (torch.Tensor, 任意) — 事前生成されたノイズ付き潜在変数。
  • prompt_embeds_qwen (torch.Tensor, 任意) — 事前生成済みの Qwen テキスト埋め込み。
  • prompt_embeds_clip (torch.Tensor、任意) — 事前生成された CLIP テキスト埋め込み。
  • negative_prompt_embeds_qwen (torch.Tensor, 任意) — 事前に生成された Qwen のネガティブテキスト埋め込み。
  • negative_prompt_embeds_clip (torch.Tensor, 任意) — 事前生成された CLIP のネガティブテキスト埋め込み。
  • prompt_cu_seqlens (torch.Tensor, 任意) — Qwen の正のプロンプト用の事前生成済み累積シーケンス長です。
  • negative_prompt_cu_seqlens (torch.Tensor、省略可) — Qwen のネガティブプロンプト用の事前生成済み累積シーケンス長です。
  • output_type (str、任意、デフォルトは"pil") — 生成された画像の出力形式です。
  • return_dict (bool、省略可、デフォルトはTrue) — KandinskyImagePipelineOutputを返すかどうかを指定します。
  • callback_on_step_end (Callable、PipelineCallback、MultiPipelineCallbacks、省略可) — 各デノイジングステップの終了時に呼び出される関数です。
  • callback_on_step_end_tensor_inputs (List, 省略可) — callback_on_step_end 関数へのテンソル入力の一覧です。
  • max_sequence_length (int、デフォルトは512) — テキストエンコードにおける最大シーケンス長です。

戻り値

~KandinskyImagePipelineOutput または tuple

return_dict が True の場合、KandinskyImagePipelineOutput が返され、それ以外の場合は tuple が返されます。このとき、最初の要素は生成された画像のリストです。

テキストから画像を生成するための pipeline の呼び出し関数。

例:

>>> import torch
>>> from diffusers import Kandinsky5T2IPipeline

>>> # Available models:
>>> # kandinskylab/Kandinsky-5.0-T2I-Lite-sft-Diffusers
>>> # kandinskylab/Kandinsky-5.0-T2I-Lite-pretrain-Diffusers

>>> model_id = "kandinskylab/Kandinsky-5.0-T2I-Lite-sft-Diffusers"
>>> pipe = Kandinsky5T2IPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
>>> pipe = pipe.to("cuda")

>>> prompt = "A cat and a dog baking a cake together in a kitchen."

>>> output = pipe(
...     prompt=prompt,
...     negative_prompt="",
...     height=1024,
...     width=1024,
...     num_inference_steps=50,
...     guidance_scale=3.5,
... ).frames[0]

check_inputs

< >

( promptnegative_promptheightwidthprompt_embeds_qwen = Noneprompt_embeds_clip = Nonenegative_prompt_embeds_qwen = Nonenegative_prompt_embeds_clip = Noneprompt_cu_seqlens = Nonenegative_prompt_cu_seqlens = Nonecallback_on_step_end_tensor_inputs = Nonemax_sequence_length = None )

パラメータ

  • prompt — 入力プロンプト
  • negative_prompt — ガイダンス用のネガティブプロンプト
  • height — 画像の高さ
  • width — 画像の幅
  • prompt_embeds_qwen — 事前計算済みの Qwen プロンプト埋め込み
  • prompt_embeds_clip — 事前計算済みの CLIP プロンプト埋め込み
  • negative_prompt_embeds_qwen — 事前計算済みの Qwen 負プロンプト埋め込み
  • negative_prompt_embeds_clip — 事前計算済みのCLIPネガティブプロンプト埋め込み
  • prompt_cu_seqlens — Qwen の正のプロンプト用の事前計算済み累積シーケンス長
  • negative_prompt_cu_seqlens — Qwenのネガティブプロンプト用の事前計算済み累積シーケンス長
  • callback_on_step_end_tensor_inputs — コールバックのテンソル入力

例外

ValueError

  • ValueError — 入力が無効な場合

パイプラインの入力パラメータを検証します。

encode_prompt

< >

( prompt: str | list[str]num_images_per_prompt: int = 1max_sequence_length: int = 512device: typing.Optional[torch.device] = Nonedtype: typing.Optional[torch.dtype] = None ) → tuple[torch.Tensor, torch.Tensor, torch.Tensor]

パラメータ

  • prompt (str または list[str]) — エンコードするプロンプト。
  • num_images_per_prompt (int、任意、デフォルトは 1) — プロンプトごとに生成する画像の数。
  • max_sequence_length (int、任意、デフォルト値は 512)— テキストエンコーディング用の最大シーケンス長です。1024 未満である必要があります。
  • device (torch.device、省略可) — Torch のデバイスです。
  • dtype (torch.dtype、省略可) — Torch の dtype です。

戻り値

tuple[torch.Tensor, torch.Tensor, torch.Tensor]

  • 形状が (batch_size * num_images_per_prompt, sequence_length, embedding_dim) の Qwen テキスト埋め込み
  • 形状が (batch_size * num_images_per_prompt, clip_embedding_dim) の CLIP のプーリング済み埋め込み
  • Qwen の埋め込みにおける累積シーケンス長(cu_seqlens)で、形状は (batch_size * num_images_per_prompt + 1,) です

単一のプロンプト(正または負)をテキストエンコーダーの隠れ状態にエンコードします。

このメソッドは、Qwen2.5-VLとCLIPのテキストエンコーダーの埋め込みを組み合わせることで、画像生成のための包括的なテキスト表現を作成します。

prepare_latents

< >

( batch_size: intnum_channels_latents: int = 16height: int = 1024width: int = 1024dtype: typing.Optional[torch.dtype] = Nonedevice: typing.Optional[torch.device] = Nonegenerator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = Nonelatents: typing.Optional[torch.Tensor] = None ) → torch.Tensor

パラメータ

  • batch_size (int) — 生成する画像の数
  • num_channels_latents (int) — 潜在空間のチャネル数
  • height (int) — 生成画像の高さ
  • width (int) — 生成される画像の幅
  • dtype (torch.dtype) — 潜在変数に使用するデータ型
  • device (torch.device) — latents を作成するデバイス
  • generator (torch.Generator) — 乱数生成器
  • latents (torch.Tensor) — 使用する既存の潜在変数

戻り値

torch.Tensor

準備済みの潜在テンソル

テキストから画像を生成するための初期潜在変数を準備します。

このメソッドは、ランダムなノイズの潜在変数を作成します

Kandinsky5I2IPipeline

class diffusers.Kandinsky5I2IPipeline

< >

( transformer: Kandinsky5Transformer3DModelvae: AutoencoderKLtext_encoder: Qwen2_5_VLForConditionalGenerationtokenizer: Qwen2VLProcessortext_encoder_2: CLIPTextModeltokenizer_2: CLIPTokenizerscheduler: FlowMatchEulerDiscreteScheduler )

パラメータ

  • transformer (Kandinsky5Transformer3DModel) — エンコードされた画像潜在変数をノイズ除去するための条件付き Transformer。
  • vae (AutoencoderKL) — black-forest-labs/FLUX.1-dev (vae) の Variational Auto-Encoder モデル。動画を潜在表現にエンコードし、潜在表現からデコードするために使用します。
  • text_encoder (Qwen2_5_VLForConditionalGeneration) — 凍結されたテキストエンコーダー Qwen2.5-VL。
  • tokenizer (AutoProcessor) — Qwen2.5-VL用のトークナイザーです。
  • text_encoder_2 (CLIPTextModel) — 凍結された CLIP、具体的には clip-vit-large-patch14 バリアントです。
  • tokenizer_2 (CLIPTokenizer) — CLIP用のトークナイザー。
  • scheduler (FlowMatchEulerDiscreteScheduler) — transformer と組み合わせて、エンコードされた画像の潜在変数からノイズを除去するために使用するスケジューラ。

Kandinsky 5.0 を使用した画像から画像への生成を行う Pipeline。

このモデルは DiffusionPipeline を継承しています。すべてのパイプラインに実装されている汎用的なメソッド(ダウンロード、保存、特定のデバイスでの実行など)については、スーパークラスのドキュメントを参照してください。

__call__

< >

( image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]prompt: str | list[str] = Nonenegative_prompt: str | list[str] | None = Noneheight: int | None = Nonewidth: int | None = Nonenum_inference_steps: int = 50guidance_scale: float = 3.5num_images_per_prompt: int | None = 1generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = Nonelatents: typing.Optional[torch.Tensor] = Noneprompt_embeds_qwen: typing.Optional[torch.Tensor] = Noneprompt_embeds_clip: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds_qwen: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds_clip: typing.Optional[torch.Tensor] = Noneprompt_cu_seqlens: typing.Optional[torch.Tensor] = Nonenegative_prompt_cu_seqlens: typing.Optional[torch.Tensor] = Noneoutput_type: str | None = 'pil'return_dict: bool = Truecallback_on_step_end: typing.Optional[typing.Callable[[int, int, NoneType], diffusers.callbacks.PipelineCallback | diffusers.callbacks.MultiPipelineCallbacks]] = Nonecallback_on_step_end_tensor_inputs: list = ['latents']max_sequence_length: int = 1024 ) → ~KandinskyImagePipelineOutput or tuple

パラメータ

  • image (PipelineImageInput) — 生成を条件づけるための入力画像です。画像、画像のリスト、またはtorch.Tensorである必要があります。
  • prompt (str または list[str]、省略可) — 画像生成をガイドするためのプロンプトです。定義されていない場合は、代わりに prompt_embeds を渡してください。
  • negative_prompt (str または list[str]、任意) — 画像生成時に回避するプロンプトです。未定義の場合は、代わりにnegative_prompt_embedsを渡してください。guidance を使用していない場合(guidance_scale < 1)は無視されます。
  • height (int) — 生成される画像の高さ(ピクセル単位)。
  • width (int) — 生成される画像の幅(ピクセル単位)。
  • num_inference_steps (int、デフォルトは 50) — デノイジングのステップ数です。
  • guidance_scale (float、デフォルトは5.0) — classifier-free guidanceで定義されるガイダンススケール。
  • num_images_per_prompt (int、任意、デフォルトは 1) — プロンプトごとに生成する画像の数。
  • generator (torch.Generator または list[torch.Generator]、省略可) — 生成を決定論的にするための torch ジェネレーター。
  • latents (torch.Tensor, 任意) — 事前生成されたノイズ付き潜在変数。
  • prompt_embeds_qwen (torch.Tensor, 任意) — 事前生成済みの Qwen テキスト埋め込み。
  • prompt_embeds_clip (torch.Tensor、任意) — 事前生成された CLIP テキスト埋め込み。
  • negative_prompt_embeds_qwen (torch.Tensor, 任意) — 事前に生成された Qwen のネガティブテキスト埋め込み。
  • negative_prompt_embeds_clip (torch.Tensor, 任意) — 事前生成された CLIP のネガティブテキスト埋め込み。
  • prompt_cu_seqlens (torch.Tensor, 任意) — Qwen の正のプロンプト用の事前生成済み累積シーケンス長です。
  • negative_prompt_cu_seqlens (torch.Tensor、省略可) — Qwen のネガティブプロンプト用の事前生成済み累積シーケンス長です。
  • output_type (str、任意、デフォルトは"pil") — 生成された画像の出力形式です。
  • return_dict (bool、省略可、デフォルトはTrue) — KandinskyImagePipelineOutputを返すかどうかを指定します。
  • callback_on_step_end (Callable、PipelineCallback、MultiPipelineCallbacks、省略可) — 各デノイジングステップの終了時に呼び出される関数です。
  • callback_on_step_end_tensor_inputs (List, 省略可) — callback_on_step_end 関数へのテンソル入力の一覧です。
  • max_sequence_length (int、デフォルトは 1024) — テキストおよび画像の qwen エンコーディングにおける最大シーケンス長です。1024 未満である必要があります。

戻り値

~KandinskyImagePipelineOutput または tuple

return_dict が True の場合、KandinskyImagePipelineOutput が返され、それ以外の場合は tuple が返されます。このとき、最初の要素は生成された画像のリストです。

画像から画像への生成を行う pipeline の呼び出し関数です。

例:

>>> import torch
>>> from diffusers import Kandinsky5I2IPipeline

>>> # Available models:
>>> # kandinskylab/Kandinsky-5.0-I2I-Lite-sft-Diffusers
>>> # kandinskylab/Kandinsky-5.0-I2I-Lite-pretrain-Diffusers

>>> model_id = "kandinskylab/Kandinsky-5.0-I2I-Lite-sft-Diffusers"
>>> pipe = Kandinsky5I2IPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
>>> pipe = pipe.to("cuda")

>>> prompt = "A cat and a dog baking a cake together in a kitchen."

>>> output = pipe(
...     prompt=prompt,
...     negative_prompt="",
...     height=1024,
...     width=1024,
...     num_inference_steps=50,
...     guidance_scale=3.5,
... ).frames[0]

check_inputs

< >

( promptnegative_promptimageheightwidthprompt_embeds_qwen = Noneprompt_embeds_clip = Nonenegative_prompt_embeds_qwen = Nonenegative_prompt_embeds_clip = Noneprompt_cu_seqlens = Nonenegative_prompt_cu_seqlens = Nonecallback_on_step_end_tensor_inputs = Nonemax_sequence_length = None )

パラメータ

  • prompt — 入力プロンプト
  • negative_prompt — ガイダンス用のネガティブプロンプト
  • image — 条件付け用の入力画像
  • height — 画像の高さ
  • width — 画像の幅
  • prompt_embeds_qwen — 事前計算済みの Qwen プロンプト埋め込み
  • prompt_embeds_clip — 事前計算済みの CLIP プロンプト埋め込み
  • negative_prompt_embeds_qwen — 事前計算済みの Qwen 負プロンプト埋め込み
  • negative_prompt_embeds_clip — 事前計算済みのCLIPネガティブプロンプト埋め込み
  • prompt_cu_seqlens — Qwen の正のプロンプト用の事前計算済み累積シーケンス長
  • negative_prompt_cu_seqlens — Qwenのネガティブプロンプト用の事前計算済み累積シーケンス長
  • callback_on_step_end_tensor_inputs — コールバックのテンソル入力

例外

ValueError

  • ValueError — 入力が無効な場合

パイプラインの入力パラメータを検証します。

encode_prompt

< >

( prompt: str | list[str]image: Tensornum_images_per_prompt: int = 1max_sequence_length: int = 1024device: typing.Optional[torch.device] = Nonedtype: typing.Optional[torch.dtype] = None ) → tuple[torch.Tensor, torch.Tensor, torch.Tensor]

パラメータ

  • prompt (str または list[str]) — エンコードするプロンプト。
  • num_images_per_prompt (int、任意、デフォルトは 1) — プロンプトごとに生成する画像の数。
  • max_sequence_length (int、任意、デフォルト値は 1024) — テキストエンコーディング用の最大シーケンス長。1024 未満である必要があります
  • device (torch.device、省略可) — Torch のデバイスです。
  • dtype (torch.dtype、省略可) — Torch の dtype です。

戻り値

tuple[torch.Tensor, torch.Tensor, torch.Tensor]

  • 形状が (batch_size * num_images_per_prompt, sequence_length, embedding_dim) の Qwen テキスト埋め込み
  • 形状が (batch_size * num_images_per_prompt, clip_embedding_dim) の CLIP のプーリング済み埋め込み
  • Qwen の埋め込みにおける累積シーケンス長(cu_seqlens)で、形状は (batch_size * num_images_per_prompt + 1,) です

単一のプロンプト(正または負)をテキストエンコーダーの隠れ状態にエンコードします。

このメソッドは、Qwen2.5-VLとCLIPのテキストエンコーダーの埋め込みを組み合わせることで、画像生成のための包括的なテキスト表現を作成します。

prepare_latents

< >

( image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]batch_size: intnum_channels_latents: int = 16height: int = 1024width: int = 1024dtype: typing.Optional[torch.dtype] = Nonedevice: typing.Optional[torch.device] = Nonegenerator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = Nonelatents: typing.Optional[torch.Tensor] = None ) → torch.Tensor

パラメータ

  • image (PipelineImageInput) — 生成を条件づけるための入力画像
  • batch_size (int) — 生成する画像の数
  • num_channels_latents (int) — 潜在空間のチャネル数
  • height (int) — 生成画像の高さ
  • width (int) — 生成される画像の幅
  • dtype (torch.dtype) — 潜在変数に使用するデータ型
  • device (torch.device) — latents を作成するデバイス
  • generator (torch.Generator) — 乱数生成器
  • latents (torch.Tensor) — 使用する既存の潜在変数

戻り値

torch.Tensor

エンコードされた画像を含む準備済みの潜在テンソル

画像から画像への生成のために、初期の潜在変数を準備します。

このメソッドは、エンコードされた画像付きのランダムなノイズ潜在変数を作成します。

引用

@misc{kandinsky2025,
    author = {Alexander Belykh and Alexander Varlamov and Alexey Letunovskiy and Anastasia Aliaskina and Anastasia Maltseva and Anastasiia Kargapoltseva and Andrey Shutkin and Anna Averchenkova and Anna Dmitrienko and Bulat Akhmatov and Denis Dimitrov and Denis Koposov and Denis Parkhomenko and Dmitrii and Ilya Vasiliev and Ivan Kirillov and Julia Agafonova and Kirill Chernyshev and Kormilitsyn Semen and Lev Novitskiy and Maria Kovaleva and Mikhail Mamaev and Mikhailov and Nikita Kiselev and Nikita Osterov and Nikolai Gerasimenko and Nikolai Vaulin and Olga Kim and Olga Vdovchenko and Polina Gavrilova and Polina Mikhailova and Tatiana Nikulina and Viacheslav Vasilev and Vladimir Arkhipkin and Vladimir Korviakov and Vladimir Polovnikov and Yury Kolabushin},
    title = {Kandinsky 5.0: A family of diffusion models for Video & Image generation},
    howpublished = {\url{https://github.com/kandinskylab/Kandinsky-5}},
    year = 2025
}
Update on GitHub