Diffusers documentation
Cosmos
Cosmos
NVIDIA による Physical AI 向け Cosmos World Foundation Model プラットフォーム
Physical AI は、まずデジタル上で訓練される必要があります。そのためには、自分自身のデジタルツインであるポリシーモデルと、世界のデジタルツインであるワールドモデルが必要です。本論文では、Physical AI のセットアップ向けにカスタマイズされたワールドモデルの構築を支援するために、Cosmos World Foundation Model Platform を紹介します。ワールドファウンデーションモデルは、下流アプリケーション向けのカスタマイズされたワールドモデルにファインチューニングできる汎用的なワールドモデルとして位置づけられます。当プラットフォームは、動画キュレーションパイプライン、事前訓練済みのワールドファウンデーションモデル、事前訓練済みワールドファウンデーションモデルのポストトレーニングの例、および動画トークナイザをカバーしています。Physical AI の構築者が社会の最も重要な課題を解決できるよう支援するため、当プラットフォームはオープンソースとして、モデルは寛容なライセンスの下でオープンウェイトとして、https://github.com/NVIDIA/Cosmos 経由で提供しています。
スケジューラーのトレードオフ、すなわち速度と品質のバランスをどのように探求するかを学ぶには、ガイドを必ずご確認ください。また、同じコンポーネントを複数のパイプラインに効率的に読み込む方法については、パイプライン間でコンポーネントを再利用するセクションを参照してください。
基本的な使用方法
import torch
from diffusers import Cosmos2_5_PredictBasePipeline
from diffusers.utils import export_to_video
model_id = "nvidia/Cosmos-Predict2.5-2B"
pipe = Cosmos2_5_PredictBasePipeline.from_pretrained(
model_id, revision="diffusers/base/post-trained", dtype=torch.bfloat16
)
pipe.to("cuda") # or "mps", "xpu", "cpu"
prompt = "As the red light shifts to green, the red bus at the intersection begins to move forward, its headlights cutting through the falling snow. The snowy tire tracks deepen as the vehicle inches ahead, casting fresh lines onto the slushy road. Around it, streetlights glow warmer, illuminating the drifting flakes and wet reflections on the asphalt. Other cars behind start to edge forward, their beams joining the scene. The stillness of the urban street transitions into motion as the quiet snowfall is punctuated by the slow advance of traffic through the frosty city corridor."
negative_prompt = "The video captures a series of frames showing ugly scenes, static with no motion, motion blur, over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, jerky movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. Overall, the video is of poor quality."
output = pipe(
image=None,
video=None,
prompt=prompt,
negative_prompt=negative_prompt,
num_frames=93,
generator=torch.Generator().manual_seed(1),
).frames[0]
export_to_video(output, "text2world.mp4", fps=16)Cosmos2_5_TransferPipeline
class diffusers.Cosmos2_5_TransferPipeline
< source >( text_encoder: Qwen2_5_VLForConditionalGenerationtokenizer: AutoTokenizertransformer: CosmosTransformer3DModelvae: AutoencoderKLWanscheduler: UniPCMultistepSchedulercontrolnet: CosmosControlNetModelsafety_checker: typing.Optional[diffusers.pipelines.cosmos.pipeline_cosmos2_5_transfer.CosmosSafetyChecker] = None )
パラメータ
- text_encoder (
Qwen2_5_VLForConditionalGeneration) — 凍結されたテキストエンコーダーです。Cosmos Transfer2.5 は Qwen2.5 VL エンコーダーを使用しています。 - tokenizer (
AutoTokenizer) — Qwen2.5 VL エンコーダーに関連付けられた Tokenizer。 - transformer (CosmosTransformer3DModel) — エンコードされた画像の潜在変数をノイズ除去するための条件付き Transformer。
- scheduler (UniPCMultistepScheduler) —
transformerと組み合わせて、エンコードされた画像の潜在変数からノイズを除去するために使用するスケジューラ。 - vae (AutoencoderKLWan) — 潜在表現へのエンコードとデコードを行う、動画用の変分オートエンコーダ (VAE) モデル。
- controlnet (
CosmosControlNetModel) — 制御入力に基づいて生成を条件付けするために使用される ControlNet。
Cosmos Transfer2.5用のパイプライン。自己回帰推論をサポートしています。
このモデルは DiffusionPipeline を継承しています。すべてのパイプラインに実装されている汎用的なメソッド(ダウンロード、保存、特定のデバイスでの実行など)については、スーパークラスのドキュメントを参照してください。
__call__
< source >( controls: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor], typing.List[typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]]]controls_conditioning_scale: typing.Union[float, typing.List[float]] = 1.0prompt: typing.Union[str, typing.List[str], NoneType] = Nonenegative_prompt: typing.Union[str, typing.List[str]] = 'The video captures a series of frames showing ugly scenes, static with no motion, motion blur, over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, jerky movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. Overall, the video is of poor quality.'height: int = 704width: typing.Optional[int] = Nonenum_frames: typing.Optional[int] = Nonenum_frames_per_chunk: int = 93num_inference_steps: int = 36guidance_scale: float = 3.0num_videos_per_prompt: int = 1generator: typing.Union[torch.Generator, typing.List[torch.Generator], NoneType] = Nonelatents: typing.Optional[torch.Tensor] = Noneprompt_embeds: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds: typing.Optional[torch.Tensor] = Noneoutput_type: typing.Optional[str] = 'pil'return_dict: bool = Truecallback_on_step_end: typing.Union[typing.Callable[[int, int, typing.Dict], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = Nonecallback_on_step_end_tensor_inputs: typing.List[str] = ['latents']max_sequence_length: int = 512conditional_frame_timestep: float = 0.1num_ar_conditional_frames: typing.Optional[int] = 1num_ar_latent_conditional_frames: typing.Optional[int] = None ) → ~CosmosPipelineOutput or tuple
パラメータ
- controls (
PipelineImageInput、List[PipelineImageInput]) — ControlNet が使用するコントロール画像または動画の入力です。 - controls_conditioning_scale (
floatまたはList[float]、任意、デフォルトは1.0) — ControlNet の出力に対するスケール係数です。単一の float を指定すると、すべての control block にブロードキャストされます。 - prompt (
strまたはList[str]、任意) — 生成をガイドするためのプロンプトです。prompt_embedsが指定されない場合は必須です。 - negative_prompt (
strまたはList[str]、省略可) — 画像生成をガイドしないプロンプトです。未定義の場合、代わりにnegative_prompt_embedsを渡す必要があります。ガイダンスを使用していない場合は無視されます(guidance_scaleが1以下の場合に無視されます)。 - height (
int, デフォルトは704) — 生成される画像の高さ(ピクセル単位)。 - width (
int, 任意) — 生成される画像の幅(ピクセル単位)です。指定しない場合、入力画像のアスペクト比と指定された高さに基づいて決定されます。 - num_frames (
int, 任意) — 出力フレーム数。デフォルトはNoneで、入力controlsと同じ数のフレームを出力します。 - num_frames_per_chunk (
int、任意、デフォルトは93) — オートレグレッシブなチャンクごとに生成されるフレーム数です。総フレーム数がこの値を超えると、スライディングウィンドウ方式を用いて、生成が複数のチャンクに分割されます。 - num_inference_steps (
int、デフォルトは36) — デノイジングのステップ数です。ステップ数を増やすと、推論速度が遅くなる代わりに、通常はより高品質な画像が得られます。 - guidance_scale (
float、デフォルト値は3.0) — Classifier-Free Diffusion Guidance で定義されているガイダンススケールです。guidance_scaleは、Imagen Paper の数式 2 のwとして定義されています。guidance_scale > 1を設定することで、ガイダンススケールが有効になります。 - num_videos_per_prompt (
int、省略可能、デフォルト値は 1)— プロンプトごとに生成する画像の数。 - generator (
torch.GeneratorまたはList[torch.Generator]、省略可) — 生成を決定論的にするためのtorch.Generator。 - latents (
torch.Tensor, 任意) — ガウス分布からサンプリングされた事前生成されたノイズ付き潜変数で、入力として使用されます。異なるプロンプトで同じ生成を調整するために使用できます。指定されない場合、指定されたランダムgeneratorを使用してサンプリングを行い、潜変数テンソルが生成されます。 - prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたテキスト埋め込み。テキスト入力の調整、例えばプロンプトの重み付けなどを容易に行うために使用できます。指定されない場合、prompt入力引数からテキスト埋め込みが生成されます。 - negative_prompt_embeds (
torch.FloatTensor, 任意) — 事前に生成されたネガティブテキストの埋め込み。PixArt-Sigma の場合、このネガティブプロンプトは "" である必要があります。指定されない場合、negative_prompt入力引数から negative_prompt_embeds が生成されます。 - output_type (
str、任意、デフォルトは"pil") — 生成された画像の出力形式です。PIL.Imageまたはnp.arrayから選択します。 - return_dict (
bool、任意、デフォルトはTrue) —CosmosPipelineOutputを返すか、プレーンなタプルを返すかを指定します。 - callback_on_step_end (
Callable、PipelineCallback、MultiPipelineCallbacks、省略可) — 推論中の各デノイジングステップの終了時に呼び出される関数、またはPipelineCallbackまたはMultiPipelineCallbacksのサブクラスです。引数は以下の通りです:callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)。callback_kwargsには、callback_on_step_end_tensor_inputsで指定されたすべてのテンソルのリストが含まれます。 - callback_on_step_end_tensor_inputs (
List, 任意) —callback_on_step_end関数へのテンソル入力の一覧です。リストで指定されたテンソルは、callback_kwargs引数として渡されます。パイプラインクラスの._callback_tensor_inputs属性にリストされている変数のみを含めることができます。 - max_sequence_length (
int、デフォルトは512) — プロンプトに含まれるトークンの最大数です。プロンプトがこの長さを超える場合は切り詰められ、短い場合はパディングが適用されます。 - conditional_frame_timestep (
float、任意、デフォルト値は 0.1) — デノイジング中の条件付きフレームに使用されるタイムステップの値です。[0, 1]の範囲内である必要があります。 - num_ar_conditional_frames (
int, 省略可, デフォルト値は1) — 自動回帰推論において、後続の推論ループ(つまり2チャンク目以降)で条件付けを行うフレーム数。num_ar_latent_conditional_framesがNone.これは、オートレグレッシブ推論が実行される場合、つまり controls のフレーム数が num_frames_per_chunk より大きい場合にのみ使用されます。
- num_ar_latent_conditional_frames (
int, 省略可) — 自己回帰推論において、後続の推論ループ(つまり 2 チャンク目以降)で条件付けに使用する潜在フレームの数。num_ar_conditional_framesがNone.これは、オートレグレッシブ推論が実行される場合、つまり controls のフレーム数が num_frames_per_chunk より大きい場合にのみ使用されます。
戻り値
~CosmosPipelineOutput または tuple
return_dict が True の場合、CosmosPipelineOutput が返され、それ以外の場合は tuple が返されます。この tuple の最初の要素は生成された画像のリストであり、2番目の要素は、対応する生成画像に「not-safe-for-work」(nsfw)コンテンツが含まれているかどうかを示す bool のリストです。
controls は ControlNet による条件付けを駆動します。コントロールは事前処理済み(例:エッジマップが事前計算済み)であると仮定されます。
Setting num_frames will restrict the total number of frames output, if not provided or assigned to None
(default) then the number of output frames will match the input controls.
Auto-regressive inference はサポートされており、そのため各 denoising ループでは num_frames_per_chunk フレームのスライディングウィンドウが使用されます。さらに、Auto-regressive inference を実行する場合、直前の num_ar_latent_conditional_frames または num_ar_conditional_frames が、以降の denoising 推論ループの条件付けに使用されます。
例:
>>> import cv2
>>> import numpy as np
>>> from PIL import Image
>>> import torch
>>> from diffusers import Cosmos2_5_TransferPipeline, AutoModel
>>> from diffusers.utils import export_to_video, load_video
>>> model_id = "nvidia/Cosmos-Transfer2.5-2B"
>>> # Load a Transfer2.5 controlnet variant (edge, depth, seg, or blur)
>>> controlnet = AutoModel.from_pretrained(
... model_id, revision="diffusers/controlnet/general/edge", torch_dtype=torch.bfloat16
... )
>>> pipe = Cosmos2_5_TransferPipeline.from_pretrained(
... model_id, controlnet=controlnet, revision="diffusers/general", torch_dtype=torch.bfloat16
... )
>>> pipe = pipe.to("cuda")
>>> # Video2World with edge control: Generate video guided by edge maps extracted from input video.
>>> prompt = (
... "The video is a demonstration of robotic manipulation, likely in a laboratory or testing environment. It"
... "features two robotic arms interacting with a piece of blue fabric. The setting is a room with a beige"
... "couch in the background, providing a neutral backdrop for the robotic activity. The robotic arms are"
... "positioned on either side of the fabric, which is placed on a yellow cushion. The left robotic arm is"
... "white with a black gripper, while the right arm is black with a more complex, articulated gripper. At the"
... "beginning, the fabric is laid out on the cushion. The left robotic arm approaches the fabric, its gripper"
... "opening and closing as it positions itself. The right arm remains stationary initially, poised to assist."
... "As the video progresses, the left arm grips the fabric, lifting it slightly off the cushion. The right arm"
... "then moves in, its gripper adjusting to grasp the opposite side of the fabric. Both arms work in"
... "coordination, lifting and holding the fabric between them. The fabric is manipulated with precision,"
... "showcasing the dexterity and control of the robotic arms. The camera remains static throughout, focusing"
... "on the interaction between the robotic arms and the fabric, allowing viewers to observe the detailed"
... "movements and coordination involved in the task."
... )
>>> negative_prompt = (
... "The video captures a series of frames showing ugly scenes, static with no motion, motion blur, "
... "over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, "
... "underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, jerky "
... "movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, "
... "fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. "
... "Overall, the video is of poor quality."
... )
>>> input_video = load_video(
... "https://github.com/nvidia-cosmos/cosmos-transfer2.5/raw/refs/heads/main/assets/robot_example/robot_input.mp4"
... )
>>> num_frames = 93
>>> # Extract edge maps from the input video using Canny edge detection
>>> edge_maps = [
... cv2.Canny(cv2.cvtColor(np.array(frame.convert("RGB")), cv2.COLOR_RGB2BGR), 100, 200)
... for frame in input_video[:num_frames]
... ]
>>> edge_maps = np.stack(edge_maps)[None] # (T, H, W) -> (1, T, H, W)
>>> controls = torch.from_numpy(edge_maps).expand(3, -1, -1, -1) # (1, T, H, W) -> (3, T, H, W)
>>> controls = [Image.fromarray(x.numpy()) for x in controls.permute(1, 2, 3, 0)]
>>> export_to_video(controls, "edge_controlled_video_edge.mp4", fps=30)
>>> # Transfer inference with controls.
>>> video = pipe(
... controls=controls,
... controls_conditioning_scale=1.0,
... prompt=prompt,
... negative_prompt=negative_prompt,
... num_frames=num_frames,
... ).frames[0]
>>> export_to_video(video, "edge_controlled_video.mp4", fps=30)encode_prompt
< source >( prompt: typing.Union[str, typing.List[str]]negative_prompt: typing.Union[str, typing.List[str], NoneType] = Nonedo_classifier_free_guidance: bool = Truenum_videos_per_prompt: int = 1prompt_embeds: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds: typing.Optional[torch.Tensor] = Nonemax_sequence_length: int = 512device: typing.Optional[torch.device] = Nonedtype: typing.Optional[torch.dtype] = None )
パラメータ
- prompt (
strまたはList[str]、省略可) — エンコードするプロンプト - negative_prompt (
strまたはList[str]、任意) — 画像生成をガイドしないプロンプトです。未定義の場合、代わりにnegative_prompt_embedsを渡す必要があります。ガイダンスを使用していない場合は無視されます(guidance_scaleが1未満の場合は無視されます)。 - do_classifier_free_guidance (
bool、任意、デフォルトはTrue) — classifier free guidance を使用するかどうかを指定します。 - num_videos_per_prompt (
int、任意、デフォルトは 1) — プロンプトごとに生成する動画の数を指定します。結果の埋め込みを配置する torch デバイス - prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたテキスト埋め込み。テキスト入力の調整、例えばプロンプトの重み付けなどを容易に行うために使用できます。指定されない場合、prompt入力引数からテキスト埋め込みが生成されます。 - negative_prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたネガティブなテキスト埋め込みです。テキスト入力の調整、例えばプロンプトの重み付けなどを簡単に実行できます。指定されない場合、negative_prompt入力引数から negative_prompt_embeds が生成されます。 - device — (
torch.device、任意): torch デバイス - dtype — (
torch.dtype、省略可): torch の dtype
プロンプトをテキストエンコーダーの隠れ状態にエンコードします。
Cosmos2_5_PredictBasePipeline
class diffusers.Cosmos2_5_PredictBasePipeline
< source >( text_encoder: Qwen2_5_VLForConditionalGenerationtokenizer: AutoTokenizertransformer: CosmosTransformer3DModelvae: AutoencoderKLWanscheduler: UniPCMultistepSchedulersafety_checker: CosmosSafetyChecker = None )
パラメータ
- text_encoder (
Qwen2_5_VLForConditionalGeneration) — 凍結されたテキストエンコーダー。Cosmos Predict2.5 は Qwen2.5 VL エンコーダーを使用します。 - tokenizer (
AutoTokenizer) — Qwen2.5 VL エンコーダーに関連付けられた Tokenizer。 - transformer (CosmosTransformer3DModel) — エンコードされた画像の潜在変数をノイズ除去するための条件付き Transformer。
- scheduler (UniPCMultistepScheduler) —
transformerと組み合わせて、エンコードされた画像の潜在変数からノイズを除去するために使用するスケジューラ。 - vae (AutoencoderKLWan) — 潜在表現へのエンコードとデコードを行う、動画用の変分オートエンコーダ (VAE) モデル。
Cosmos Predict2.5ベースモデル用のパイプライン。
このモデルは DiffusionPipeline を継承しています。すべてのパイプラインに実装されている汎用的なメソッド(ダウンロード、保存、特定のデバイスでの実行など)については、スーパークラスのドキュメントを参照してください。
__call__
< source >( image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor], NoneType] = Nonevideo: list[typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]] | None = Noneprompt: str | list[str] | None = Nonenegative_prompt: str | list[str] | None = Noneheight: int = 704width: int = 1280num_frames: int = 93num_inference_steps: int = 36guidance_scale: float = 7.0num_videos_per_prompt: int | None = 1generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = Nonelatents: typing.Optional[torch.Tensor] = Noneprompt_embeds: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds: 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 = 512conditional_frame_timestep: float = 0.0001num_latent_conditional_frames: int = 2 ) → ~CosmosPipelineOutput or tuple
パラメータ
- image (
PIL.Image.Image、np.ndarray、torch.Tensor、省略可) — Image2World の条件付けに使用する単一の画像を指定します。videoが指定されている場合は、Noneである必要があります。 - video (
list[PIL.Image.Image]、np.ndarray、torch.Tensor、省略可) — Video2World の条件付けに使用する任意の入力動画。imageが指定されている場合は、Noneである必要があります。 - prompt (
strまたはlist[str]、省略可) — 生成をガイドするためのプロンプトです。prompt_embedsが指定されていない場合は必須です。 - negative_prompt (
strまたはlist[str]、省略可) — 画像生成をガイドしないプロンプトです。未定義の場合、代わりにnegative_prompt_embedsを渡す必要があります。ガイダンスを使用していない場合は無視されます(guidance_scaleが1以下の場合に無視されます)。 - height (
int, デフォルトは704) — 生成される画像の高さ(ピクセル単位)。 - width (
int、デフォルトは1280) — 生成される画像の幅(ピクセル単位)。 - num_frames (
int、デフォルトは93) — 出力フレーム数。ワールド(動画)生成には93を使用し、単一のフレームを返す場合は1に設定します。 - num_inference_steps (
int、デフォルトは35) — デノイジングのステップ数です。デノイジングのステップ数を増やすと、推論速度が遅くなる代わりに、通常はより高品質な画像が得られます。 - guidance_scale (
float、デフォルトは7.0) — Classifier-Free Diffusion Guidance で定義されているガイダンススケールです。guidance_scaleは、Imagen Paper の数式 2 のwとして定義されています。guidance_scale > 1を設定することで、ガイダンススケールが有効になります。 - num_videos_per_prompt (
int、省略可能、デフォルト値は 1)— プロンプトごとに生成する画像の数。 - generator (
torch.Generatorまたはlist[torch.Generator]、省略可) — 生成を決定論的にするためのtorch.Generator。 - latents (
torch.Tensor, 任意) — ガウス分布からサンプリングされた事前生成されたノイズ付き latents。画像生成のインプットとして使用します。異なるプロンプトで同じ生成を調整するために使用できます。指定されない場合、指定されたランダムgeneratorを用いてサンプリングを行い、latents テンソルが生成されます。 - prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたテキスト埋め込み。テキスト入力の調整、例えばプロンプトの重み付けなどを容易に行うために使用できます。指定されない場合、prompt入力引数からテキスト埋め込みが生成されます。 - negative_prompt_embeds (
torch.FloatTensor, 任意) — 事前に生成されたネガティブテキストの埋め込み。PixArt-Sigma の場合、このネガティブプロンプトは "" である必要があります。指定されない場合、negative_prompt入力引数から negative_prompt_embeds が生成されます。 - output_type (
str、任意、デフォルトは"pil") — 生成された画像の出力形式です。PIL.Imageまたはnp.arrayから選択します。 - return_dict (
bool、任意、デフォルトはTrue) —CosmosPipelineOutputを返すか、プレーンなタプルを返すかを指定します。 - callback_on_step_end (
Callable、PipelineCallback、MultiPipelineCallbacks、省略可) — 推論中の各デノイジングステップの終了時に呼び出される関数、またはPipelineCallbackまたはMultiPipelineCallbacksのサブクラスです。引数は以下の通りです:callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)。callback_kwargsには、callback_on_step_end_tensor_inputsで指定されたすべてのテンソルのリストが含まれます。 - callback_on_step_end_tensor_inputs (
List, 任意) —callback_on_step_end関数へのテンソル入力の一覧です。リストで指定されたテンソルは、callback_kwargs引数として渡されます。パイプラインクラスの._callback_tensor_inputs属性にリストされている変数のみを含めることができます。 - max_sequence_length (
int、デフォルトは512) — プロンプトに含まれるトークンの最大数です。プロンプトがこの長さを超える場合は切り詰められ、短い場合はパディングが適用されます。 - num_latent_conditional_frames (
int、デフォルトは2) — Video2World の条件付けに使用する潜在条件フレームの数です。入力動画から抽出されるピクセルフレームの数は4 * (num_latent_conditional_frames - 1) + 1で計算されます。Image2World 同様の動作(単一フレームの条件付け)にする場合は 1 に設定してください。 - conditional_frame_timestep (
float、任意、デフォルト値は 0.0001) — デノイジング時に条件付きフレームに使用されるタイムステップの値です。
戻り値
~CosmosPipelineOutput または tuple
return_dict が True の場合、CosmosPipelineOutput が返され、それ以外の場合は tuple が返されます。この tuple の最初の要素は生成された画像のリストであり、2番目の要素は、対応する生成画像に「not-safe-for-work」(nsfw)コンテンツが含まれているかどうかを示す bool のリストです。
生成用の pipeline への呼び出し関数。3つのモードをサポートします:
- Text2World:
image=None、video=None、promptが指定されています。ワールドクリップを生成します。 - Image2World:
imageが指定され、video=None、promptが指定されています。単一のフレームに対する条件です。 - Video2World:
videoが指定され、image=None、promptが指定されています。入力クリップに対する条件です。
num_frames=93(デフォルト)に設定するとワールド動画が生成され、num_frames=1に設定すると単一の画像フレームが生成されます(上記の「*2Image モード」)。
出力はoutput_typeに従います(例:"pil"の場合、プロンプトごとにnum_frames枚のPIL画像のリストを返します)。
例:
>>> import torch
>>> from diffusers import Cosmos2_5_PredictBasePipeline
>>> from diffusers.utils import export_to_video, load_image, load_video
>>> model_id = "nvidia/Cosmos-Predict2.5-2B"
>>> pipe = Cosmos2_5_PredictBasePipeline.from_pretrained(
... model_id, revision="diffusers/base/post-trained", torch_dtype=torch.bfloat16
... )
>>> pipe = pipe.to("cuda")
>>> # Common negative prompt reused across modes.
>>> negative_prompt = (
... "The video captures a series of frames showing ugly scenes, static with no motion, motion blur, "
... "over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, "
... "underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, jerky "
... "movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, "
... "fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. "
... "Overall, the video is of poor quality."
... )
>>> # Text2World: generate a 93-frame world video from text only.
>>> prompt = (
... "As the red light shifts to green, the red bus at the intersection begins to move forward, its headlights "
... "cutting through the falling snow. The snowy tire tracks deepen as the vehicle inches ahead, casting fresh "
... "lines onto the slushy road. Around it, streetlights glow warmer, illuminating the drifting flakes and wet "
... "reflections on the asphalt. Other cars behind start to edge forward, their beams joining the scene. "
... "The stillness of the urban street transitions into motion as the quiet snowfall is punctuated by the slow "
... "advance of traffic through the frosty city corridor."
... )
>>> video = pipe(
... image=None,
... video=None,
... prompt=prompt,
... negative_prompt=negative_prompt,
... num_frames=93,
... generator=torch.Generator().manual_seed(1),
... ).frames[0]
>>> export_to_video(video, "text2world.mp4", fps=16)
>>> # Image2World: condition on a single image and generate a 93-frame world video.
>>> prompt = (
... "A high-definition video captures the precision of robotic welding in an industrial setting. "
... "The first frame showcases a robotic arm, equipped with a welding torch, positioned over a large metal structure. "
... "The welding process is in full swing, with bright sparks and intense light illuminating the scene, creating a vivid "
... "display of blue and white hues. A significant amount of smoke billows around the welding area, partially obscuring "
... "the view but emphasizing the heat and activity. The background reveals parts of the workshop environment, including a "
... "ventilation system and various pieces of machinery, indicating a busy and functional industrial workspace. As the video "
... "progresses, the robotic arm maintains its steady position, continuing the welding process and moving to its left. "
... "The welding torch consistently emits sparks and light, and the smoke continues to rise, diffusing slightly as it moves upward. "
... "The metal surface beneath the torch shows ongoing signs of heating and melting. The scene retains its industrial ambiance, with "
... "the welding sparks and smoke dominating the visual field, underscoring the ongoing nature of the welding operation."
... )
>>> image = load_image(
... "https://media.githubusercontent.com/media/nvidia-cosmos/cosmos-predict2.5/refs/heads/main/assets/base/robot_welding.jpg"
... )
>>> video = pipe(
... image=image,
... video=None,
... prompt=prompt,
... negative_prompt=negative_prompt,
... num_frames=93,
... generator=torch.Generator().manual_seed(1),
... ).frames[0]
>>> export_to_video(video, "image2world.mp4", fps=16)
>>> # Video2World: condition on an input clip and predict a 93-frame world video.
>>> prompt = (
... "The video opens with an aerial view of a large-scale sand mining construction operation, showcasing extensive piles "
... "of brown sand meticulously arranged in parallel rows. A central water channel, fed by a water pipe, flows through the "
... "middle of these sand heaps, creating ripples and movement as it cascades down. The surrounding area features dense green "
... "vegetation on the left, contrasting with the sandy terrain, while a body of water is visible in the background on the right. "
... "As the video progresses, a piece of heavy machinery, likely a bulldozer, enters the frame from the right, moving slowly along "
... "the edge of the sand piles. This machinery's presence indicates ongoing construction work in the operation. The final frame "
... "captures the same scene, with the water continuing its flow and the bulldozer still in motion, maintaining the dynamic yet "
... "steady pace of the construction activity."
... )
>>> input_video = load_video(
... "https://github.com/nvidia-cosmos/cosmos-predict2.5/raw/refs/heads/main/assets/base/sand_mining.mp4"
... )
>>> video = pipe(
... image=None,
... video=input_video,
... prompt=prompt,
... negative_prompt=negative_prompt,
... num_frames=93,
... generator=torch.Generator().manual_seed(1),
... ).frames[0]
>>> export_to_video(video, "video2world.mp4", fps=16)
>>> # To produce an image instead of a world (video) clip, set num_frames=1 and
>>> # save the first frame: pipe(..., num_frames=1).frames[0][0].encode_prompt
< source >( prompt: str | list[str]negative_prompt: str | list[str] | None = Nonedo_classifier_free_guidance: bool = Truenum_videos_per_prompt: int = 1prompt_embeds: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds: typing.Optional[torch.Tensor] = Nonemax_sequence_length: int = 512device: typing.Optional[torch.device] = Nonedtype: typing.Optional[torch.dtype] = None )
パラメータ
- prompt (
strまたはlist[str]、省略可能) — エンコードするプロンプト - negative_prompt (
strまたはlist[str]、省略可) — 画像生成をガイドしないプロンプトです。未定義の場合、代わりにnegative_prompt_embedsを渡す必要があります。ガイダンスを使用していない場合は無視されます(guidance_scaleが1未満の場合は無視されます)。 - do_classifier_free_guidance (
bool、任意、デフォルトはTrue) — classifier free guidance を使用するかどうかを指定します。 - num_videos_per_prompt (
int、任意、デフォルトは 1) — プロンプトごとに生成する動画の数を指定します。結果の埋め込みを配置する torch デバイス - prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたテキスト埋め込み。テキスト入力の調整、例えばプロンプトの重み付けなどを容易に行うために使用できます。指定されない場合、prompt入力引数からテキスト埋め込みが生成されます。 - negative_prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたネガティブなテキスト埋め込みです。テキスト入力の調整、例えばプロンプトの重み付けなどを簡単に実行できます。指定されない場合、negative_prompt入力引数から negative_prompt_embeds が生成されます。 - device — (
torch.device、任意): torch デバイス - dtype — (
torch.dtype、省略可): torch の dtype
プロンプトをテキストエンコーダーの隠れ状態にエンコードします。
CosmosTextToWorldPipeline
class diffusers.CosmosTextToWorldPipeline
< source >( text_encoder: T5EncoderModeltokenizer: T5Tokenizertransformer: CosmosTransformer3DModelvae: AutoencoderKLCosmosscheduler: EDMEulerSchedulersafety_checker: CosmosSafetyChecker = None )
パラメータ
- text_encoder (
T5EncoderModel) — 凍結されたテキストエンコーダー。Cosmos は T5を使用しており、具体的には t5-11bバリアントです。 - tokenizer (
T5TokenizerFast) — T5Tokenizer クラスのトークナイザー。 - transformer (CosmosTransformer3DModel) — エンコードされた画像の潜在変数をノイズ除去するための条件付き Transformer。
- scheduler (FlowMatchEulerDiscreteScheduler) —
transformerと組み合わせて、エンコードされた画像の潜在変数からノイズを除去するために使用するスケジューラ。 - vae (AutoencoderKLCosmos) — 潜在表現へのエンコードとデコードを行う、動画用の変分オートエンコーダ (VAE) モデル。
Cosmos Predict1 を使用したテキストからワールド生成を行う Pipeline です。
このモデルは DiffusionPipeline を継承しています。すべてのパイプラインに実装されている汎用的なメソッド(ダウンロード、保存、特定のデバイスでの実行など)については、スーパークラスのドキュメントを参照してください。
__call__
< source >( prompt: str | list[str] = Nonenegative_prompt: str | list[str] | None = Noneheight: int = 704width: int = 1280num_frames: int = 121num_inference_steps: int = 36guidance_scale: float = 7.0fps: int = 30num_videos_per_prompt: int | None = 1generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = Nonelatents: typing.Optional[torch.Tensor] = Noneprompt_embeds: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds: typing.Optional[torch.Tensor] = Noneoutput_type: str | None = 'pil'return_dict: bool = Truecallback_on_step_end: typing.Union[typing.Callable[[int, int], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = Nonecallback_on_step_end_tensor_inputs: list = ['latents']max_sequence_length: int = 512 ) → ~CosmosPipelineOutput or tuple
パラメータ
- prompt (
strまたはlist[str]、省略可) — 画像生成をガイドするためのプロンプトです。未定義の場合、代わりにprompt_embedsを渡す必要があります。 - negative_prompt (
strまたはlist[str]、省略可) — 画像生成をガイドしないプロンプトです。未定義の場合、代わりにnegative_prompt_embedsを渡す必要があります。ガイダンスを使用していない場合は無視されます(guidance_scaleが1以下の場合に無視されます)。 - height (
int、デフォルト値は720) — 生成される画像の高さ(ピクセル単位)です。 - width (
int、デフォルトは1280) — 生成される画像の幅(ピクセル単位)。 - num_frames (
int、デフォルトは121) — 生成される動画のフレーム数です。 - num_inference_steps (
int、デフォルトは36) — デノイジングのステップ数です。ステップ数を増やすと、推論速度が遅くなる代わりに、通常はより高品質な画像が得られます。 - guidance_scale (
float、デフォルトは7.0) — Classifier-Free Diffusion Guidance で定義されているガイダンススケールです。guidance_scaleは、Imagen Paper の数式 2 のwとして定義されています。guidance_scale > 1を設定することで、ガイダンススケールが有効になります。 - fps (
int、デフォルトは30) — 生成される動画の毎秒のフレーム数です。 - num_videos_per_prompt (
int、省略可能、デフォルト値は 1)— プロンプトごとに生成する画像の数。 - generator (
torch.Generatorまたはlist[torch.Generator]、省略可) — 生成を決定論的にするためのtorch.Generator。 - latents (
torch.Tensor, 任意) — ガウス分布からサンプリングされた事前生成されたノイズ付き latents。画像生成のインプットとして使用します。異なるプロンプトで同じ生成を調整するために使用できます。指定されない場合、指定されたランダムgeneratorを用いてサンプリングを行い、latents テンソルが生成されます。 - prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたテキスト埋め込み。テキスト入力の調整、例えばプロンプトの重み付けなどを容易に行うために使用できます。指定されない場合、prompt入力引数からテキスト埋め込みが生成されます。 - negative_prompt_embeds (
torch.FloatTensor, 任意) — 事前に生成されたネガティブテキストの埋め込み。PixArt-Sigma の場合、このネガティブプロンプトは "" である必要があります。指定されない場合、negative_prompt入力引数から negative_prompt_embeds が生成されます。 - output_type (
str、任意、デフォルトは"pil") — 生成された画像の出力形式です。PIL.Imageまたはnp.arrayから選択します。 - return_dict (
bool、任意、デフォルトはTrue) —CosmosPipelineOutputを返すか、プレーンなタプルを返すかを指定します。 - callback_on_step_end (
Callable、PipelineCallback、MultiPipelineCallbacks、省略可) — 推論中の各デノイジングステップの終了時に呼び出される関数、またはPipelineCallbackまたはMultiPipelineCallbacksのサブクラスです。引数は以下の通りです:callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)。callback_kwargsには、callback_on_step_end_tensor_inputsで指定されたすべてのテンソルのリストが含まれます。 - callback_on_step_end_tensor_inputs (
list、任意) —callback_on_step_end関数へのテンソル入力の一覧です。このリストで指定されたテンソルは、callback_kwargs引数として渡されます。パイプラインクラスの._callback_tensor_inputs属性にリストされている変数のみを、このリストに含めることができます。 - max_sequence_length (
int、デフォルトは512) — プロンプトに含まれるトークンの最大数です。プロンプトがこの長さを超える場合は切り詰められ、短い場合はパディングが適用されます。
戻り値
~CosmosPipelineOutput または tuple
return_dict が True の場合、CosmosPipelineOutput が返され、それ以外の場合は tuple が返されます。この tuple の最初の要素は生成された画像のリストであり、2番目の要素は、対応する生成画像に「not-safe-for-work」(nsfw)コンテンツが含まれているかどうかを示す bool のリストです。
生成用の pipeline への呼び出し関数。
例:
>>> import torch
>>> from diffusers import CosmosTextToWorldPipeline
>>> from diffusers.utils import export_to_video
>>> model_id = "nvidia/Cosmos-1.0-Diffusion-7B-Text2World"
>>> pipe = CosmosTextToWorldPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
>>> pipe.to("cuda")
>>> prompt = "A sleek, humanoid robot stands in a vast warehouse filled with neatly stacked cardboard boxes on industrial shelves. The robot's metallic body gleams under the bright, even lighting, highlighting its futuristic design and intricate joints. A glowing blue light emanates from its chest, adding a touch of advanced technology. The background is dominated by rows of boxes, suggesting a highly organized storage system. The floor is lined with wooden pallets, enhancing the industrial setting. The camera remains static, capturing the robot's poised stance amidst the orderly environment, with a shallow depth of field that keeps the focus on the robot while subtly blurring the background for a cinematic effect."
>>> output = pipe(prompt=prompt).frames[0]
>>> export_to_video(output, "output.mp4", fps=30)encode_prompt
< source >( prompt: str | list[str]negative_prompt: str | list[str] | None = Nonedo_classifier_free_guidance: bool = Truenum_videos_per_prompt: int = 1prompt_embeds: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds: typing.Optional[torch.Tensor] = Nonemax_sequence_length: int = 512device: typing.Optional[torch.device] = Nonedtype: typing.Optional[torch.dtype] = None )
パラメータ
- prompt (
strまたはlist[str]、省略可能) — エンコードするプロンプト - negative_prompt (
strまたはlist[str]、省略可) — 画像生成をガイドしないプロンプトです。未定義の場合、代わりにnegative_prompt_embedsを渡す必要があります。ガイダンスを使用していない場合は無視されます(guidance_scaleが1未満の場合は無視されます)。 - do_classifier_free_guidance (
bool、任意、デフォルトはTrue) — classifier free guidance を使用するかどうかを指定します。 - num_videos_per_prompt (
int、任意、デフォルトは 1) — プロンプトごとに生成する動画の数を指定します。結果の埋め込みを配置する torch デバイス - prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたテキスト埋め込み。テキスト入力の調整、例えばプロンプトの重み付けなどを容易に行うために使用できます。指定されない場合、prompt入力引数からテキスト埋め込みが生成されます。 - negative_prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたネガティブなテキスト埋め込みです。テキスト入力の調整、例えばプロンプトの重み付けなどを簡単に実行できます。指定されない場合、negative_prompt入力引数から negative_prompt_embeds が生成されます。 - device — (
torch.device、任意): torch デバイス - dtype — (
torch.dtype、省略可): torch の dtype
プロンプトをテキストエンコーダーの隠れ状態にエンコードします。
CosmosVideoToWorldPipeline
クラス diffusers.CosmosVideoToWorldPipeline
< source >( text_encoder: T5EncoderModeltokenizer: T5Tokenizertransformer: CosmosTransformer3DModelvae: AutoencoderKLCosmosscheduler: EDMEulerSchedulersafety_checker: CosmosSafetyChecker = None )
パラメータ
- text_encoder (
T5EncoderModel) — 凍結されたテキストエンコーダー。Cosmos は T5を使用しており、具体的には t5-11bバリアントです。 - tokenizer (
T5TokenizerFast) — T5Tokenizer クラスのトークナイザー。 - transformer (CosmosTransformer3DModel) — エンコードされた画像の潜在変数をノイズ除去するための条件付き Transformer。
- scheduler (FlowMatchEulerDiscreteScheduler) —
transformerと組み合わせて、エンコードされた画像の潜在変数からノイズを除去するために使用するスケジューラ。 - vae (AutoencoderKLCosmos) — 潜在表現へのエンコードとデコードを行う、動画用の変分オートエンコーダ (VAE) モデル。
Cosmos Predict-1 を使用した画像からワールド、および動画からワールドへの生成を行う Pipeline です。
このモデルは DiffusionPipeline を継承しています。すべてのパイプラインに実装されている汎用的なメソッド(ダウンロード、保存、特定のデバイスでの実行など)については、スーパークラスのドキュメントを参照してください。
__call__
< source >( image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]] = Nonevideo: list = Noneprompt: str | list[str] = Nonenegative_prompt: str | list[str] | None = Noneheight: int = 704width: int = 1280num_frames: int = 121num_inference_steps: int = 36guidance_scale: float = 7.0input_frames_guidance: bool = Falseaugment_sigma: float = 0.001fps: int = 30num_videos_per_prompt: int | None = 1generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = Nonelatents: typing.Optional[torch.Tensor] = Noneprompt_embeds: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds: typing.Optional[torch.Tensor] = Noneoutput_type: str | None = 'pil'return_dict: bool = Truecallback_on_step_end: typing.Union[typing.Callable[[int, int], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = Nonecallback_on_step_end_tensor_inputs: list = ['latents']max_sequence_length: int = 512 ) → ~CosmosPipelineOutput or tuple
パラメータ
- image (
PIL.Image.Image、np.ndarray、torch.Tensor、任意) — 動画生成の条件付け入力として使用される画像。 - video (
list[PIL.Image.Image]、np.ndarray、torch.Tensor、任意) — 動画生成の条件付け入力として使用する動画です。 - prompt (
strまたはlist[str]、省略可) — 画像生成をガイドするためのプロンプトです。未定義の場合、代わりにprompt_embedsを渡す必要があります。 - negative_prompt (
strまたはlist[str]、省略可) — 画像生成をガイドしないプロンプトです。未定義の場合、代わりにnegative_prompt_embedsを渡す必要があります。ガイダンスを使用していない場合は無視されます(guidance_scaleが1以下の場合に無視されます)。 - height (
int、デフォルトは720) — 生成される画像の高さ(ピクセル単位)です。 - width (
int、デフォルトは1280) — 生成される画像の幅(ピクセル単位)。 - num_frames (
int、デフォルトは121) — 生成される動画のフレーム数です。 - num_inference_steps (
int、デフォルトは36) — デノイジングのステップ数です。ステップ数を増やすと、推論速度が遅くなる代わりに、通常はより高品質な画像が得られます。 - guidance_scale (
float、デフォルトは7.0) — Classifier-Free Diffusion Guidance で定義されているガイダンススケールです。guidance_scaleは、Imagen Paper の数式 2 のwとして定義されています。guidance_scale > 1を設定することで、ガイダンススケールが有効になります。 - input_frames_guidance (
bool、任意、デフォルトはFalse) — 条件付き入力フレームにガイダンスを適用するかどうかを指定します。 - augment_sigma (
float、省略可能、デフォルト値は 0.001) — デノイジング中に条件付き潜在変数を拡張するために使用される Sigma 値。 - fps (
int, デフォルトは30) — 生成される動画の毎秒フレーム数です。 - num_videos_per_prompt (
int、省略可能、デフォルト値は 1)— プロンプトごとに生成する画像の数。 - generator (
torch.Generatorまたはlist[torch.Generator]、省略可) — 生成を決定論的にするためのtorch.Generator。 - latents (
torch.Tensor, 任意) — ガウス分布からサンプリングされた事前生成されたノイズ付き latents。画像生成のインプットとして使用します。異なるプロンプトで同じ生成を調整するために使用できます。指定されない場合、指定されたランダムgeneratorを用いてサンプリングを行い、latents テンソルが生成されます。 - prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたテキスト埋め込み。テキスト入力の調整、例えばプロンプトの重み付けなどを容易に行うために使用できます。指定されない場合、prompt入力引数からテキスト埋め込みが生成されます。 - negative_prompt_embeds (
torch.FloatTensor, 任意) — 事前に生成されたネガティブテキストの埋め込み。PixArt-Sigma の場合、このネガティブプロンプトは "" である必要があります。指定されない場合、negative_prompt入力引数から negative_prompt_embeds が生成されます。 - output_type (
str、任意、デフォルトは"pil") — 生成された画像の出力形式です。PIL.Imageまたはnp.arrayから選択します。 - return_dict (
bool、任意、デフォルトはTrue) —CosmosPipelineOutputを返すか、プレーンなタプルを返すかを指定します。 - callback_on_step_end (
Callable、PipelineCallback、MultiPipelineCallbacks、省略可) — 推論中の各デノイジングステップの終了時に呼び出される関数、またはPipelineCallbackまたはMultiPipelineCallbacksのサブクラスです。引数は以下の通りです:callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)。callback_kwargsには、callback_on_step_end_tensor_inputsで指定されたすべてのテンソルのリストが含まれます。 - callback_on_step_end_tensor_inputs (
list、任意) —callback_on_step_end関数へのテンソル入力の一覧です。このリストで指定されたテンソルは、callback_kwargs引数として渡されます。パイプラインクラスの._callback_tensor_inputs属性にリストされている変数のみを、このリストに含めることができます。 - max_sequence_length (
int、デフォルトは512) — プロンプトに含まれるトークンの最大数です。プロンプトがこの長さを超える場合は切り詰められ、短い場合はパディングが適用されます。
戻り値
~CosmosPipelineOutput または tuple
return_dict が True の場合、CosmosPipelineOutput が返され、それ以外の場合は tuple が返されます。この tuple の最初の要素は生成された画像のリストであり、2番目の要素は、対応する生成画像に「not-safe-for-work」(nsfw)コンテンツが含まれているかどうかを示す bool のリストです。
生成用の pipeline への呼び出し関数。
例:
画像条件付け:
>>> import torch
>>> from diffusers import CosmosVideoToWorldPipeline
>>> from diffusers.utils import export_to_video, load_image
>>> model_id = "nvidia/Cosmos-1.0-Diffusion-7B-Video2World"
>>> pipe = CosmosVideoToWorldPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
>>> pipe.to("cuda")
>>> prompt = "The video depicts a long, straight highway stretching into the distance, flanked by metal guardrails. The road is divided into multiple lanes, with a few vehicles visible in the far distance. The surrounding landscape features dry, grassy fields on one side and rolling hills on the other. The sky is mostly clear with a few scattered clouds, suggesting a bright, sunny day."
>>> image = load_image(
... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cosmos/cosmos-video2world-input.jpg"
... )
>>> video = pipe(image=image, prompt=prompt).frames[0]
>>> export_to_video(video, "output.mp4", fps=30)Video conditioning:
>>> import torch
>>> from diffusers import CosmosVideoToWorldPipeline
>>> from diffusers.utils import export_to_video, load_video
>>> model_id = "nvidia/Cosmos-1.0-Diffusion-7B-Video2World"
>>> pipe = CosmosVideoToWorldPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
>>> pipe.transformer = torch.compile(pipe.transformer)
>>> pipe.to("cuda")
>>> prompt = "The video depicts a winding mountain road covered in snow, with a single vehicle traveling along it. The road is flanked by steep, rocky cliffs and sparse vegetation. The landscape is characterized by rugged terrain and a river visible in the distance. The scene captures the solitude and beauty of a winter drive through a mountainous region."
>>> video = load_video(
... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cosmos/cosmos-video2world-input-vid.mp4"
... )[
... :21
... ] # This example uses only the first 21 frames
>>> video = pipe(video=video, prompt=prompt).frames[0]
>>> export_to_video(video, "output.mp4", fps=30)encode_prompt
< source >( prompt: str | list[str]negative_prompt: str | list[str] | None = Nonedo_classifier_free_guidance: bool = Truenum_videos_per_prompt: int = 1prompt_embeds: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds: typing.Optional[torch.Tensor] = Nonemax_sequence_length: int = 512device: typing.Optional[torch.device] = Nonedtype: typing.Optional[torch.dtype] = None )
パラメータ
- prompt (
strまたはlist[str]、省略可能) — エンコードするプロンプト - negative_prompt (
strまたはlist[str]、省略可) — 画像生成をガイドしないプロンプトです。未定義の場合、代わりにnegative_prompt_embedsを渡す必要があります。ガイダンスを使用していない場合は無視されます(guidance_scaleが1未満の場合は無視されます)。 - do_classifier_free_guidance (
bool、任意、デフォルトはTrue) — classifier free guidance を使用するかどうかを指定します。 - num_videos_per_prompt (
int、任意、デフォルトは 1) — プロンプトごとに生成する動画の数を指定します。結果の埋め込みを配置する torch デバイス - prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたテキスト埋め込み。テキスト入力の調整、例えばプロンプトの重み付けなどを容易に行うために使用できます。指定されない場合、prompt入力引数からテキスト埋め込みが生成されます。 - negative_prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたネガティブなテキスト埋め込みです。テキスト入力の調整、例えばプロンプトの重み付けなどを簡単に実行できます。指定されない場合、negative_prompt入力引数から negative_prompt_embeds が生成されます。 - device — (
torch.device、任意): torch デバイス - dtype — (
torch.dtype、省略可): torch の dtype
プロンプトをテキストエンコーダーの隠れ状態にエンコードします。
Cosmos2TextToImagePipeline
class diffusers.Cosmos2TextToImagePipeline
< source >( text_encoder: T5EncoderModeltokenizer: T5Tokenizertransformer: CosmosTransformer3DModelvae: AutoencoderKLWanscheduler: FlowMatchEulerDiscreteSchedulersafety_checker: CosmosSafetyChecker = None )
パラメータ
- text_encoder (
T5EncoderModel) — 凍結されたテキストエンコーダー。Cosmos は T5を使用しており、具体的には t5-11bバリアントです。 - tokenizer (
T5TokenizerFast) — T5Tokenizer クラスのトークナイザー。 - transformer (CosmosTransformer3DModel) — エンコードされた画像の潜在変数をノイズ除去するための条件付き Transformer。
- scheduler (FlowMatchEulerDiscreteScheduler) —
transformerと組み合わせて、エンコードされた画像の潜在変数からノイズを除去するために使用するスケジューラ。 - vae (AutoencoderKLWan) — 潜在表現へのエンコードとデコードを行う、動画用の変分オートエンコーダ (VAE) モデル。
Cosmos Predict2 を使用したテキストから画像を生成する Pipeline です。
このモデルは DiffusionPipeline を継承しています。すべてのパイプラインに実装されている汎用的なメソッド(ダウンロード、保存、特定のデバイスでの実行など)については、スーパークラスのドキュメントを参照してください。
__call__
< source >( prompt: str | list[str] = Nonenegative_prompt: str | list[str] | None = Noneheight: int = 768width: int = 1360num_inference_steps: int = 35guidance_scale: float = 7.0num_images_per_prompt: int | None = 1generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = Nonelatents: typing.Optional[torch.Tensor] = Noneprompt_embeds: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds: typing.Optional[torch.Tensor] = Noneoutput_type: str | None = 'pil'return_dict: bool = Truecallback_on_step_end: typing.Union[typing.Callable[[int, int], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = Nonecallback_on_step_end_tensor_inputs: list = ['latents']max_sequence_length: int = 512 ) → ~CosmosImagePipelineOutput or tuple
パラメータ
- prompt (
strまたはlist[str]、省略可) — 画像生成をガイドするためのプロンプトです。未定義の場合、代わりにprompt_embedsを渡す必要があります。 - negative_prompt (
strまたはlist[str]、省略可) — 画像生成をガイドしないプロンプトです。未定義の場合、代わりにnegative_prompt_embedsを渡す必要があります。ガイダンスを使用していない場合は無視されます(guidance_scaleが1以下の場合に無視されます)。 - height (
int、デフォルト値は768) — 生成される画像の高さ(ピクセル単位)。 - width (
int、デフォルトは1360) — 生成される画像の幅(ピクセル単位)。 - num_inference_steps (
int、デフォルトは35) — デノイジングのステップ数です。デノイジングのステップ数を増やすと、推論速度が遅くなる代わりに、通常はより高品質な画像が得られます。 - guidance_scale (
float、デフォルトは7.0) — Classifier-Free Diffusion Guidance で定義されているガイダンススケールです。guidance_scaleは、Imagen Paper の数式 2 のwとして定義されています。guidance_scale > 1を設定することで、ガイダンススケールが有効になります。 - num_images_per_prompt (
int、任意、デフォルトは 1) — プロンプトごとに生成する画像の数。 - generator (
torch.Generatorまたはlist[torch.Generator]、省略可) — 生成を決定論的にするためのtorch.Generator。 - latents (
torch.Tensor, 任意) — ガウス分布からサンプリングされた事前生成されたノイズ付き latents。画像生成のインプットとして使用します。異なるプロンプトで同じ生成を調整するために使用できます。指定されない場合、指定されたランダムgeneratorを用いてサンプリングを行い、latents テンソルが生成されます。 - prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたテキスト埋め込み。テキスト入力の調整、例えばプロンプトの重み付けなどを容易に行うために使用できます。指定されない場合、prompt入力引数からテキスト埋め込みが生成されます。 - negative_prompt_embeds (
torch.FloatTensor, 任意) — 事前に生成されたネガティブテキストの埋め込み。PixArt-Sigma の場合、このネガティブプロンプトは "" である必要があります。指定されない場合、negative_prompt入力引数から negative_prompt_embeds が生成されます。 - output_type (
str、任意、デフォルトは"pil") — 生成された画像の出力形式です。PIL.Imageまたはnp.arrayから選択します。 - return_dict (
bool、任意、デフォルトはTrue) —CosmosImagePipelineOutputを返すか、プレーンなタプルを返すかを指定します。 - callback_on_step_end (
Callable、PipelineCallback、MultiPipelineCallbacks、省略可) — 推論中の各デノイジングステップの終了時に呼び出される関数、またはPipelineCallbackまたはMultiPipelineCallbacksのサブクラスです。引数は以下の通りです:callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)。callback_kwargsには、callback_on_step_end_tensor_inputsで指定されたすべてのテンソルのリストが含まれます。 - callback_on_step_end_tensor_inputs (
list、任意) —callback_on_step_end関数へのテンソル入力の一覧です。このリストで指定されたテンソルは、callback_kwargs引数として渡されます。パイプラインクラスの._callback_tensor_inputs属性にリストされている変数のみを、このリストに含めることができます。 - max_sequence_length (
int、デフォルトは512) — プロンプトに含まれるトークンの最大数です。プロンプトがこの長さを超える場合は切り詰められ、短い場合はパディングが適用されます。
戻り値
~CosmosImagePipelineOutput または tuple
return_dict が True の場合、CosmosImagePipelineOutput が返され、それ以外の場合は tuple が返されます。この tuple の最初の要素は生成された画像のリストであり、2番目の要素は、対応する生成画像に「not-safe-for-work」(nsfw)コンテンツが含まれているかどうかを示す bool のリストです。
生成用の pipeline への呼び出し関数。
例:
>>> import torch
>>> from diffusers import Cosmos2TextToImagePipeline
>>> # Available checkpoints: nvidia/Cosmos-Predict2-2B-Text2Image, nvidia/Cosmos-Predict2-14B-Text2Image
>>> model_id = "nvidia/Cosmos-Predict2-2B-Text2Image"
>>> pipe = Cosmos2TextToImagePipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
>>> pipe.to("cuda")
>>> prompt = "A close-up shot captures a vibrant yellow scrubber vigorously working on a grimy plate, its bristles moving in circular motions to lift stubborn grease and food residue. The dish, once covered in remnants of a hearty meal, gradually reveals its original glossy surface. Suds form and bubble around the scrubber, creating a satisfying visual of cleanliness in progress. The sound of scrubbing fills the air, accompanied by the gentle clinking of the dish against the sink. As the scrubber continues its task, the dish transforms, gleaming under the bright kitchen lights, symbolizing the triumph of cleanliness over mess."
>>> negative_prompt = "The video captures a series of frames showing ugly scenes, static with no motion, motion blur, over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, jerky movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. Overall, the video is of poor quality."
>>> output = pipe(
... prompt=prompt, negative_prompt=negative_prompt, generator=torch.Generator().manual_seed(1)
... ).images[0]
>>> output.save("output.png")encode_prompt
< source >( prompt: str | list[str]negative_prompt: str | list[str] | None = Nonedo_classifier_free_guidance: bool = Truenum_images_per_prompt: int = 1prompt_embeds: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds: typing.Optional[torch.Tensor] = Nonemax_sequence_length: int = 512device: typing.Optional[torch.device] = Nonedtype: typing.Optional[torch.dtype] = None )
パラメータ
- prompt (
strまたはlist[str]、省略可能) — エンコードするプロンプト - negative_prompt (
strまたはlist[str]、省略可) — 画像生成をガイドしないプロンプトです。未定義の場合、代わりにnegative_prompt_embedsを渡す必要があります。ガイダンスを使用していない場合は無視されます(guidance_scaleが1未満の場合は無視されます)。 - do_classifier_free_guidance (
bool、任意、デフォルトはTrue) — classifier free guidance を使用するかどうかを指定します。 - num_images_per_prompt (
int、任意、デフォルトは 1) — プロンプトごとに生成する動画の数。結果の埋め込みを配置する torch デバイス - prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたテキスト埋め込み。テキスト入力の調整、例えばプロンプトの重み付けなどを容易に行うために使用できます。指定されない場合、prompt入力引数からテキスト埋め込みが生成されます。 - negative_prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたネガティブなテキスト埋め込みです。テキスト入力の調整、例えばプロンプトの重み付けなどを簡単に実行できます。指定されない場合、negative_prompt入力引数から negative_prompt_embeds が生成されます。 - device — (
torch.device、任意): torch デバイス - dtype — (
torch.dtype、省略可): torch の dtype
プロンプトをテキストエンコーダーの隠れ状態にエンコードします。
Cosmos2VideoToWorldPipeline
class diffusers.Cosmos2VideoToWorldPipeline
< source >( text_encoder: T5EncoderModeltokenizer: T5Tokenizertransformer: CosmosTransformer3DModelvae: AutoencoderKLWanscheduler: FlowMatchEulerDiscreteSchedulersafety_checker: CosmosSafetyChecker = None )
パラメータ
- text_encoder (
T5EncoderModel) — 凍結されたテキストエンコーダー。Cosmos は T5を使用しており、具体的には t5-11bバリアントです。 - tokenizer (
T5TokenizerFast) — T5Tokenizer クラスのトークナイザー。 - transformer (CosmosTransformer3DModel) — エンコードされた画像の潜在変数をノイズ除去するための条件付き Transformer。
- scheduler (FlowMatchEulerDiscreteScheduler) —
transformerと組み合わせて、エンコードされた画像の潜在変数からノイズを除去するために使用するスケジューラ。 - vae (AutoencoderKLWan) — 潜在表現へのエンコードとデコードを行う、動画用の変分オートエンコーダ (VAE) モデル。
Cosmos Predict2 を用いた、動画からワールドを生成するための Pipeline です。
このモデルは DiffusionPipeline を継承しています。すべてのパイプラインに実装されている汎用的なメソッド(ダウンロード、保存、特定のデバイスでの実行など)については、スーパークラスのドキュメントを参照してください。
__call__
< source >( image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]] = Nonevideo: list = Noneprompt: str | list[str] = Nonenegative_prompt: str | list[str] | None = Noneheight: int = 704width: int = 1280num_frames: int = 93num_inference_steps: int = 35guidance_scale: float = 7.0fps: int = 16num_videos_per_prompt: int | None = 1generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = Nonelatents: typing.Optional[torch.Tensor] = Noneprompt_embeds: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds: typing.Optional[torch.Tensor] = Noneoutput_type: str | None = 'pil'return_dict: bool = Truecallback_on_step_end: typing.Union[typing.Callable[[int, int], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = Nonecallback_on_step_end_tensor_inputs: list = ['latents']max_sequence_length: int = 512sigma_conditioning: float = 0.0001 ) → ~CosmosPipelineOutput or tuple
パラメータ
- image (
PIL.Image.Image、np.ndarray、torch.Tensor、任意) — 動画生成の条件付け入力として使用される画像。 - video (
list[PIL.Image.Image]、np.ndarray、torch.Tensor、任意) — 動画生成の条件付け入力として使用する動画です。 - prompt (
strまたはlist[str]、省略可) — 画像生成をガイドするためのプロンプトです。未定義の場合、代わりにprompt_embedsを渡す必要があります。 - negative_prompt (
strまたはlist[str]、省略可) — 画像生成をガイドしないプロンプトです。未定義の場合、代わりにnegative_prompt_embedsを渡す必要があります。ガイダンスを使用していない場合は無視されます(guidance_scaleが1以下の場合に無視されます)。 - height (
int, デフォルトは704) — 生成される画像の高さ(ピクセル単位)。 - width (
int、デフォルトは1280) — 生成される画像の幅(ピクセル単位)。 - num_frames (
int、デフォルトは93) — 生成される動画のフレーム数です。 - num_inference_steps (
int、デフォルトは35) — デノイジングのステップ数です。デノイジングのステップ数を増やすと、推論速度が遅くなる代わりに、通常はより高品質な画像が得られます。 - guidance_scale (
float、デフォルトは7.0) — Classifier-Free Diffusion Guidance で定義されているガイダンススケールです。guidance_scaleは、Imagen Paper の数式 2 のwとして定義されています。guidance_scale > 1を設定することで、ガイダンススケールが有効になります。 - fps (
int、デフォルトは16) — 生成される動画の秒あたりのフレーム数です。 - num_videos_per_prompt (
int、省略可能、デフォルト値は 1)— プロンプトごとに生成する画像の数。 - generator (
torch.Generatorまたはlist[torch.Generator]、省略可) — 生成を決定論的にするためのtorch.Generator。 - latents (
torch.Tensor, 任意) — ガウス分布からサンプリングされた事前生成されたノイズ付き latents。画像生成のインプットとして使用します。異なるプロンプトで同じ生成を調整するために使用できます。指定されない場合、指定されたランダムgeneratorを用いてサンプリングを行い、latents テンソルが生成されます。 - prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたテキスト埋め込み。テキスト入力の調整、例えばプロンプトの重み付けなどを容易に行うために使用できます。指定されない場合、prompt入力引数からテキスト埋め込みが生成されます。 - negative_prompt_embeds (
torch.FloatTensor, 任意) — 事前に生成されたネガティブテキストの埋め込み。PixArt-Sigma の場合、このネガティブプロンプトは "" である必要があります。指定されない場合、negative_prompt入力引数から negative_prompt_embeds が生成されます。 - output_type (
str、任意、デフォルトは"pil") — 生成された画像の出力形式です。PIL.Imageまたはnp.arrayから選択します。 - return_dict (
bool、任意、デフォルトはTrue) —CosmosPipelineOutputを返すか、プレーンなタプルを返すかを指定します。 - callback_on_step_end (
Callable、PipelineCallback、MultiPipelineCallbacks、省略可) — 推論中の各デノイジングステップの終了時に呼び出される関数、またはPipelineCallbackまたはMultiPipelineCallbacksのサブクラスです。引数は以下の通りです:callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)。callback_kwargsには、callback_on_step_end_tensor_inputsで指定されたすべてのテンソルのリストが含まれます。 - callback_on_step_end_tensor_inputs (
list、任意) —callback_on_step_end関数へのテンソル入力の一覧です。このリストで指定されたテンソルは、callback_kwargs引数として渡されます。パイプラインクラスの._callback_tensor_inputs属性にリストされている変数のみを、このリストに含めることができます。 - max_sequence_length (
int、デフォルトは512) — プロンプトに含まれるトークンの最大数です。プロンプトがこの長さを超える場合は切り詰められ、短い場合はパディングが適用されます。 - sigma_conditioning (
float、デフォルト値は0.0001) — 条件付け潜在変数のスケーリングに使用される sigma の値です。変更しないか、ゼロに近い小さな値に設定するのが望ましいです。
戻り値
~CosmosPipelineOutput または tuple
return_dict が True の場合、CosmosPipelineOutput が返され、それ以外の場合は tuple が返されます。この tuple の最初の要素は生成された画像のリストであり、2番目の要素は、対応する生成画像に「not-safe-for-work」(nsfw)コンテンツが含まれているかどうかを示す bool のリストです。
生成用の pipeline への呼び出し関数。
例:
>>> import torch
>>> from diffusers import Cosmos2VideoToWorldPipeline
>>> from diffusers.utils import export_to_video, load_image
>>> # Available checkpoints: nvidia/Cosmos-Predict2-2B-Video2World, nvidia/Cosmos-Predict2-14B-Video2World
>>> model_id = "nvidia/Cosmos-Predict2-2B-Video2World"
>>> pipe = Cosmos2VideoToWorldPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
>>> pipe.to("cuda")
>>> prompt = "A close-up shot captures a vibrant yellow scrubber vigorously working on a grimy plate, its bristles moving in circular motions to lift stubborn grease and food residue. The dish, once covered in remnants of a hearty meal, gradually reveals its original glossy surface. Suds form and bubble around the scrubber, creating a satisfying visual of cleanliness in progress. The sound of scrubbing fills the air, accompanied by the gentle clinking of the dish against the sink. As the scrubber continues its task, the dish transforms, gleaming under the bright kitchen lights, symbolizing the triumph of cleanliness over mess."
>>> negative_prompt = "The video captures a series of frames showing ugly scenes, static with no motion, motion blur, over-saturation, shaky footage, low resolution, grainy texture, pixelated images, poorly lit areas, underexposed and overexposed scenes, poor color balance, washed out colors, choppy sequences, jerky movements, low frame rate, artifacting, color banding, unnatural transitions, outdated special effects, fake elements, unconvincing visuals, poorly edited content, jump cuts, visual noise, and flickering. Overall, the video is of poor quality."
>>> image = load_image(
... "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/yellow-scrubber.png"
... )
>>> video = pipe(
... image=image, prompt=prompt, negative_prompt=negative_prompt, generator=torch.Generator().manual_seed(1)
... ).frames[0]
>>> export_to_video(video, "output.mp4", fps=16)encode_prompt
< source >( prompt: str | list[str]negative_prompt: str | list[str] | None = Nonedo_classifier_free_guidance: bool = Truenum_videos_per_prompt: int = 1prompt_embeds: typing.Optional[torch.Tensor] = Nonenegative_prompt_embeds: typing.Optional[torch.Tensor] = Nonemax_sequence_length: int = 512device: typing.Optional[torch.device] = Nonedtype: typing.Optional[torch.dtype] = None )
パラメータ
- prompt (
strまたはlist[str]、省略可能) — エンコードするプロンプト - negative_prompt (
strまたはlist[str]、省略可) — 画像生成をガイドしないプロンプトです。未定義の場合、代わりにnegative_prompt_embedsを渡す必要があります。ガイダンスを使用していない場合は無視されます(guidance_scaleが1未満の場合は無視されます)。 - do_classifier_free_guidance (
bool、任意、デフォルトはTrue) — classifier free guidance を使用するかどうかを指定します。 - num_videos_per_prompt (
int、任意、デフォルトは 1) — プロンプトごとに生成する動画の数を指定します。結果の埋め込みを配置する torch デバイス - prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたテキスト埋め込み。テキスト入力の調整、例えばプロンプトの重み付けなどを容易に行うために使用できます。指定されない場合、prompt入力引数からテキスト埋め込みが生成されます。 - negative_prompt_embeds (
torch.Tensor, 任意) — 事前に生成されたネガティブなテキスト埋め込みです。テキスト入力の調整、例えばプロンプトの重み付けなどを簡単に実行できます。指定されない場合、negative_prompt入力引数から negative_prompt_embeds が生成されます。 - device — (
torch.device、任意): torch デバイス - dtype — (
torch.dtype、省略可): torch の dtype
プロンプトをテキストエンコーダーの隠れ状態にエンコードします。
CosmosPipelineOutput
クラス diffusers.pipelines.cosmos.pipeline_output.CosmosPipelineOutput
< source >( frames: Tensor )
パラメータ
- frames (
torch.Tensor,np.ndarray, or list[list[PIL.Image.Image]]) — list of video outputs - It can be a nested list of lengthbatch_size,with each sub-list containing denoised PIL image sequences of lengthnum_frames.It can also be a NumPy array or Torch tensor of shape(batch_size, num_frames, channels, height, width).
Cosmos の any-to-world/動画パイプライン用の出力クラスです。
CosmosImagePipelineOutput
class diffusers.pipelines.cosmos.pipeline_output.CosmosImagePipelineOutput
< source >( images: list[PIL.Image.Image] | numpy.ndarray )
Cosmos any-to-image パイプライン用の出力クラスです。