Buckets:

mishig's picture
|
download
raw
87.6 kB
#
# Apache Lisansı, 2.0 Sürümü ("Lisans") altında lisanslanmıştır;
# bu dosyayı, Lisansa uygun olarak kullanabilirsiniz.
# Lisansın bir kopyasını şu adresten edinebilirsiniz
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Uygulanabilir yasa gerektirmedikçe veya yazılı olarak anlaşılmadıkça, yazılım
# Lisans kapsamında dağıtılan, "OLDUĞU GİBİ" esasına göre dağıtılır,
# HİÇBİR TÜR AÇIK VEYA ZIMMİ GARANTİ VEYA ŞART İÇERMEZ.
# İzinleri ve
# lisans kapsamındaki kısıtlamalar. -->
# Cosmos
NVIDIA tarafından geliştirilen [Fiziksel Yapay Zeka için Cosmos Dünya Temel Model Platformu](https://huggingface.co/papers/2501.03575).
*Physical AI'nin öncelikle dijital olarak eğitilmesi gerekir. Kendisinin dijital ikizi olan politika modeline ve dünyanın dijital ikizi olan dünya modeline ihtiyaç duyar. Bu makalede, geliştiricilerin Physical AI kurulumları için özel dünya modelleri oluşturmasına yardımcı olmak üzere Cosmos World Foundation Model Platformunu sunuyoruz. Bir dünya temel modelini, aşağı akış uygulamaları için özel dünya modellerine ince ayarlanabilen genel amaçlı bir dünya modeli olarak konumlandırıyoruz. Platformumuz, bir video kürasyon hattını, önceden eğitilmiş dünya temel modellerini, önceden eğitilmiş dünya temel modellerinin eğitim sonrası örneklerini ve video belirteçleyicilerini kapsamaktadır. Physical AI geliştiricilerinin toplumumuzun en kritik sorunlarını çözmelerine yardımcı olmak için platformumuzu açık kaynak, modellerimizi ise izin verici lisanslarla açık ağırlık olarak https://github.com/NVIDIA/Cosmos üzerinden erişilebilir kılıyoruz.*
> [!TIP]
> Scheduler'lar [kılavuzunu](../../using-diffusers/schedulers) inceleyerek scheduler hızı ve kalitesi arasındaki ödünleşimi nasıl keşfedebileceğinizi öğrenin ve aynı bileşenleri birden fazla pipeline'a nasıl verimli bir şekilde yükleyebileceğinizi öğrenmek için [pipeline'lar arasında bileşenleri yeniden kullanma](../../using-diffusers/loading#reusing-models-in-multiple-pipelines) bölümüne göz atın.
## Temel kullanım
```python
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[[diffusers.Cosmos2_5_TransferPipeline]]
#### diffusers.Cosmos2_5_TransferPipeline[[diffusers.Cosmos2_5_TransferPipeline]]
```python
diffusers.Cosmos2_5_TransferPipeline(text_encoder: Qwen2_5_VLForConditionalGeneration, tokenizer: AutoTokenizer, transformer: CosmosTransformer3DModel, vae: AutoencoderKLWan, scheduler: UniPCMultistepScheduler, controlnet: CosmosControlNetModel, safety_checker: typing.Optional[diffusers.pipelines.cosmos.pipeline_cosmos2_5_transfer.CosmosSafetyChecker] = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_5_transfer.py#L152)
**Parametreler:**
text_encoder (`Qwen2_5_VLForConditionalGeneration`) : Donmuş metin kodlayıcı. Cosmos Transfer2.5, [Qwen2.5 VL](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct) kodlayıcısını kullanır.
tokenizer (`AutoTokenizer`) : Qwen2.5 VL kodlayıcısıyla ilişkili tokenizer.
transformer ([CosmosTransformer3DModel](/docs/diffusers/main/tr/api/models/cosmos_transformer3d#diffusers.CosmosTransformer3DModel)) : Kodlanmış görüntü latentlerini gürültüden aramak için koşullu Transformer.
scheduler ([UniPCMultistepScheduler](/docs/diffusers/main/tr/api/schedulers/unipc#diffusers.UniPCMultistepScheduler)) : Kodlanmış görüntü latentlerini gürültüden arındırmak için `transformer` ile birlikte kullanılacak bir zamanlayıcı.
vae ([AutoencoderKLWan](/docs/diffusers/main/tr/api/models/autoencoder_kl_wan#diffusers.AutoencoderKLWan)) : Video'ları latent temsillere kodlamak ve latent temsillerden video'lara çözmek için kullanılan Varyasyonel Oto-Kodlayıcı (VAE) Modeli.
controlnet (`CosmosControlNetModel`) : Üretimi kontrol girdilerine göre koşullandırmak için kullanılan ControlNet.
Cosmos Transfer2.5 için otomatik regresif çıkarımı destekleyen Pipeline.
Bu model [DiffusionPipeline](/docs/diffusers/main/tr/api/pipelines/overview#diffusers.DiffusionPipeline) sınıfından devralınmıştır. Tüm pipeline'lar için uygulanan genel yöntemlerin (indirme, kaydetme, belirli bir cihazda çalıştırma vb.) belgelerini üst sınıfın dokümantasyonunda bulabilirsiniz.
#### __call__[[diffusers.Cosmos2_5_TransferPipeline.__call__]]
```python
__call__(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.0, prompt: typing.Union[str, typing.List[str], NoneType] = None, negative_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 = 704, width: typing.Optional[int] = None, num_frames: typing.Optional[int] = None, num_frames_per_chunk: int = 93, num_inference_steps: int = 36, guidance_scale: float = 3.0, num_videos_per_prompt: int = 1, generator: typing.Union[torch.Generator, typing.List[torch.Generator], NoneType] = None, latents: typing.Optional[torch.Tensor] = None, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, output_type: typing.Optional[str] = 'pil', return_dict: bool = True, callback_on_step_end: typing.Union[typing.Callable[[int, int, typing.Dict], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None, callback_on_step_end_tensor_inputs: typing.List[str] = ['latents'], max_sequence_length: int = 512, conditional_frame_timestep: float = 0.1, num_ar_conditional_frames: typing.Optional[int] = 1, num_ar_latent_conditional_frames: typing.Optional[int] = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_5_transfer.py#L569)
**Parametreler:**
controls (`PipelineImageInput`, `List[PipelineImageInput]`) : ControlNet tarafından kullanılan kontrol görüntüsü veya video girişi.
controls_conditioning_scale (`float` veya `List[float]`, *isteğe bağlı*, varsayılan `1.0`) : ControlNet çıktıları için ölçekleme çarpan(lar)ı. Tek bir float, tüm kontrol bloklarına yayılır.
prompt (`str` veya `List[str]`, *isteğe bağlı*) : Üretimi yönlendirmek için istem veya istemler. `prompt_embeds` sağlanmadıkça zorunludur.
negative_prompt (`str` veya `List[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmemek için kullanılan istem veya istemler. Tanımlanmamışsa bunun yerine `negative_prompt_embeds` parametresinin geçirilmesi gerekir. Yönlendirme kullanılmadığında (yani `guidance_scale` değeri `1`'den büyük olmadığında) yok sayılır.
height (`int`, varsayılan `704`) : Üretilen görüntünün piksel cinsinden yüksekliği.
width (`int`, *isteğe bağlı*) : Üretilen görüntünün piksel cinsinden genişliği. Sağlanmazsa, bu değer girdinin en-boy oranına ve sağlanan yüksekliğe göre belirlenir.
num_frames (`int`, *isteğe bağlı*) : Çıktı kare sayısı. Varsayılan olarak, girdi `controls` ile aynı sayıda kareyi çıkarmak için `None` olarak ayarlanır.
num_frames_per_chunk (`int`, *isteğe bağlı*, varsayılan `93`) : Her otoregresif parça için üretilen kare sayısı. Toplam kare sayısı bu değeri aştığında, üretim kayan pencere yaklaşımı kullanılarak birden fazla parçaya bölünür.
num_inference_steps (`int`, varsayılan `36`) : Gürültü azaltma adım sayısı. Daha fazla gürültü azaltma adımı, genellikle daha yavaş çıkarım pahasına daha yüksek kaliteli bir görüntüye yol açar.
guidance_scale (`float`, varsayılan `3.0`) : [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598)'de tanımlanan yönlendirme ölçeği. `guidance_scale`, [Imagen Paper](https://huggingface.co/papers/2205.11487)'deki 2. denklemindeki `w` olarak tanımlanır. `guidance_scale > 1` ayarlanarak yönlendirme ölçeği etkinleştirilir.
num_videos_per_prompt (`int`, *isteğe bağlı*, varsayılan 1) : Her istem için üretilecek görsel sayısı.
generator (`torch.Generator` veya `List[torch.Generator]`, *isteğe bağlı*) : Üretimi deterministik hale getirmek için bir [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html).
latents (`torch.Tensor`, *isteğe bağlı*) : Gaus dağılımından örneklenen, girdi olarak kullanılacak önceden oluşturulmuş gürültülü latentler. Farklı istemlerle aynı üretimi ayarlamak için kullanılabilir. Sağlanmazsa, sağlanan rastgele `generator` kullanılarak örneklem yoluyla bir latent tensörü oluşturulur.
prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, metin gömme değerleri `prompt` girdi argümanından oluşturulur.
negative_prompt_embeds (`torch.FloatTensor`, *isteğe bağlı*) : Önceden oluşturulmuş negatif metin gömme değerleri. PixArt-Sigma için bu negatif istem "" olmalıdır. Sağlanmazsa, negative_prompt_embeds, `negative_prompt` girdi argümanından oluşturulur.
output_type (`str`, *isteğe bağlı*, varsayılan `"pil"`) : Üretilen görüntünün çıktı biçimi. `PIL.Image` veya `np.array` arasında seçim yapın.
return_dict (`bool`, *isteğe bağlı*, varsayılan `True`) : Düz bir tuple yerine `CosmosPipelineOutput` döndürülüp döndürülmediğini belirtir.
callback_on_step_end (`Callable`, `PipelineCallback`, `MultiPipelineCallbacks`, *opsiyonel*) : Çıkarım sırasında her gürültü azaltma adımının sonunda çağrılan, `PipelineCallback` veya `MultiPipelineCallbacks` alt sınıfı olan bir fonksiyon. Aşağıdaki argümanlarla çağrılır: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. `callback_kwargs`, `callback_on_step_end_tensor_inputs` tarafından belirtildiği üzere tüm tensörlerin listesini içerecektir.
callback_on_step_end_tensor_inputs (`List`, *optional*) : The list of tensor inputs for the `callback_on_step_end` function. The tensors specified in the list will be passed as `callback_kwargs` argument. You will only be able to include variables listed in the `._callback_tensor_inputs` attribute of your pipeline class.
max_sequence_length (`int`, varsayılan `512`) : İstemdeki (prompt) maksimum token sayısı. İstem bu uzunluğu aşarsa kırpılır. İstem bu uzunluktan kısaysa dolgu (padding) uygulanır.
conditional_frame_timestep (`float`, *opsiyonel*, varsayılan 0.1) : Gürültüden arındırma sırasında koşullu kareler için kullanılan zaman adımı değeri. `[0, 1]` aralığında olmalıdır.
num_ar_conditional_frames (`int`, *opsiyonel*, varsayılan `1`) : Otoregresif çıkarım sırasında, ikinci parça ve sonrasındaki ardışık çıkarım döngülerinde koşullandırılacak kare sayısı. Yalnızca `num_ar_latent_conditional_frames` `None` ise kullanılır. Bu parametre yalnızca otoregresif çıkarım yapıldığında, yani kontrollerdeki kare sayısı num_frames_per_chunk değerinden büyük olduğunda kullanılır.
num_ar_latent_conditional_frames (`int`, *opsiyonel*) : Otoregresif çıkarım sırasında, ikinci parça ve sonrasındaki çıkarım döngülerinde koşullandırılacak gizli kare sayısı. Yalnızca `num_ar_conditional_frames` değeri `None` ise kullanılır. Bu parametre yalnızca otoregresif çıkarım yapıldığında, yani kontrollerdeki kare sayısı num_frames_per_chunk değerinden büyük olduğunda kullanılır.
**Dönüş:** `~CosmosPipelineOutput` veya `tuple`
`return_dict` `True` ise `CosmosPipelineOutput` döndürülür, aksi halde bir `tuple` döndürülür; bu yapının ilk öğesi üretilen görsellerin listesini, ikinci öğesi ise ilgili üretilen görselin "not-safe-for-work" (nsfw) içerip içermediğini gösteren `bool` değerlerinin listesini içerir.
`controls`, ControlNet üzerinden koşullandırmayı yönlendirir. Kontrollerin önceden işlenmiş olduğu varsayılır; örneğin kenar haritaları önceden hesaplanır.
`num_frames` parametresi ayarlanırsa toplam çıktı kare sayısı kısıtlanır; sağlanmazsa veya None olarak atanırsa (varsayılan) çıktı kare sayısı, girdi `controls` ile eşleşir.
Otomatik regresif çıkarım desteklenir ve bu nedenle her gürültü azaltma döngüsünde `num_frames_per_chunk` karelik kayan bir pencere kullanılır. Ayrıca, otomatik regresif çıkarım gerçekleştirildiğinde, bir sonraki gürültü azaltma çıkarım döngülerini koşullandırmak için önceki `num_ar_latent_conditional_frames` veya `num_ar_conditional_frames` kullanılır.
Örnekler:
```python
>>> 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[[diffusers.Cosmos2_5_TransferPipeline.encode_prompt]]
```python
encode_prompt(prompt: typing.Union[str, typing.List[str]], negative_prompt: typing.Union[str, typing.List[str], NoneType] = None, do_classifier_free_guidance: bool = True, num_videos_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 512, device: typing.Optional[torch.device] = None, dtype: typing.Optional[torch.dtype] = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_5_transfer.py#L296)
**Parametreler:**
prompt (`str` veya `List[str]`, *isteğe bağlı*) : kodlanacak istem
negative_prompt (`str` veya `List[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmemek için kullanılan istem veya istemler. Tanımlanmamışsa bunun yerine `negative_prompt_embeds` parametresinin geçirilmesi gerekir. Yönlendirme kullanılmadığında (yani `guidance_scale` değeri `1`'den küçükse) yok sayılır.
do_classifier_free_guidance (`bool`, *isteğe bağlı*, varsayılan `True`) : Sınıflandırıcı serbest yönlendirmenin (classifier free guidance) kullanılıp kullanılmayacağı.
num_videos_per_prompt (`int`, *opsiyonel*, varsayılan 1) : Her istem için oluşturulması gereken video sayısı. Sonuç gömme vektörlerinin yerleştirileceği torch cihazı
prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, metin gömme değerleri `prompt` girdi argümanından oluşturulur.
negative_prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş negatif metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, negative_prompt_embeds, `negative_prompt` girdi argümanından oluşturulur.
device : (`torch.device`, *isteğe bağlı*): torch cihazı
dtype : (`torch.dtype`, *isteğe bağlı*): torch dtype
İsteği metin kodlayıcı gizli durumlarına kodlar.
## Cosmos2_5_PredictBasePipeline[[diffusers.Cosmos2_5_PredictBasePipeline]]
#### diffusers.Cosmos2_5_PredictBasePipeline[[diffusers.Cosmos2_5_PredictBasePipeline]]
```python
diffusers.Cosmos2_5_PredictBasePipeline(text_encoder: Qwen2_5_VLForConditionalGeneration, tokenizer: AutoTokenizer, transformer: CosmosTransformer3DModel, vae: AutoencoderKLWan, scheduler: UniPCMultistepScheduler, safety_checker: CosmosSafetyChecker = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_5_predict.py#L185)
**Parametreler:**
text_encoder (`Qwen2_5_VLForConditionalGeneration`) : Donmuş metin kodlayıcı. Cosmos Predict2.5, [Qwen2.5 VL](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct) kodlayıcısını kullanır.
tokenizer (`AutoTokenizer`) : Qwen2.5 VL kodlayıcısıyla ilişkili tokenizer.
transformer ([CosmosTransformer3DModel](/docs/diffusers/main/tr/api/models/cosmos_transformer3d#diffusers.CosmosTransformer3DModel)) : Kodlanmış görüntü latentlerini gürültüden aramak için koşullu Transformer.
scheduler ([UniPCMultistepScheduler](/docs/diffusers/main/tr/api/schedulers/unipc#diffusers.UniPCMultistepScheduler)) : Kodlanmış görüntü latentlerini gürültüden arındırmak için `transformer` ile birlikte kullanılacak bir zamanlayıcı.
vae ([AutoencoderKLWan](/docs/diffusers/main/tr/api/models/autoencoder_kl_wan#diffusers.AutoencoderKLWan)) : Video'ları latent temsillere kodlamak ve latent temsillerden video'lara çözmek için kullanılan Varyasyonel Oto-Kodlayıcı (VAE) Modeli.
[Cosmos Predict2.5](https://github.com/nvidia-cosmos/cosmos-predict2.5) temel modeli için Pipeline.
Bu model [DiffusionPipeline](/docs/diffusers/main/tr/api/pipelines/overview#diffusers.DiffusionPipeline) sınıfından devralınmıştır. Tüm pipeline'lar için uygulanan genel yöntemlerin (indirme, kaydetme, belirli bir cihazda çalıştırma vb.) belgelerini üst sınıfın dokümantasyonunda bulabilirsiniz.
#### __call__[[diffusers.Cosmos2_5_PredictBasePipeline.__call__]]
```python
__call__(image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor], NoneType] = None, video: list[typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]] | None = None, prompt: str | list[str] | None = None, negative_prompt: str | list[str] | None = None, height: int = 704, width: int = 1280, num_frames: int = 93, num_inference_steps: int = 36, guidance_scale: float = 7.0, num_videos_per_prompt: int | None = 1, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.Tensor] = None, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, output_type: str | None = 'pil', return_dict: bool = True, callback_on_step_end: typing.Optional[typing.Callable[[int, int, NoneType], diffusers.callbacks.PipelineCallback | diffusers.callbacks.MultiPipelineCallbacks]] = None, callback_on_step_end_tensor_inputs: list = ['latents'], max_sequence_length: int = 512, conditional_frame_timestep: float = 0.0001, num_latent_conditional_frames: int = 2)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_5_predict.py#L544)
**Parametreler:**
image (`PIL.Image.Image`, `np.ndarray`, `torch.Tensor`, *opsiyonel*) : Image2World koşullandırması için isteğe bağlı tek görüntü. `video` sağlandığında `None` olmalıdır.
video (`list[PIL.Image.Image]`, `np.ndarray`, `torch.Tensor`, *isteğe bağlı*) : Video2World koşullandırması için isteğe bağlı giriş videosu. `image` sağlandığında `None` olmalıdır.
prompt (`str` veya `list[str]`, *isteğe bağlı*) : Üretimi yönlendirmek için istem veya istemler. `prompt_embeds` sağlanmadıkça zorunludur.
negative_prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmemek için kullanılan istem veya istemler. Tanımlanmazsa, bunun yerine `negative_prompt_embeds` parametresinin geçirilmesi gerekir. Yönlendirme kullanılmadığında (yani `guidance_scale` değeri `1`'den büyük olmadığında) yok sayılır.
height (`int`, varsayılan `704`) : Üretilen görüntünün piksel cinsinden yüksekliği.
width (`int`, varsayılan `1280`) : Üretilen görüntünün piksel cinsinden genişliği.
num_frames (`int`, varsayılan `93`) : Çıktı kare sayısı. Dünya (video) üretimi için `93` kullanın; tek bir kare döndürmek için `1` olarak ayarlayın.
num_inference_steps (`int`, varsayılan `35`) : Gürültü azaltma adım sayısı. Daha fazla gürültü azaltma adımı, genellikle daha yavaş çıkarım pahasına daha yüksek kaliteli bir görüntüye yol açar.
guidance_scale (`float`, varsayılan `7.0`) : [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598)'de tanımlanan yönlendirme ölçeği. `guidance_scale`, [Imagen Paper](https://huggingface.co/papers/2205.11487)'daki 2. denklemindeki `w` olarak tanımlanır. `guidance_scale > 1` ayarlanarak yönlendirme ölçeği etkinleştirilir.
num_videos_per_prompt (`int`, *isteğe bağlı*, varsayılan 1) : Her istem için üretilecek görsel sayısı.
generator (`torch.Generator` veya `list[torch.Generator]`, *isteğe bağlı*) : Üretimi deterministik hale getirmek için bir [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html).
latents (`torch.Tensor`, *isteğe bağlı*) : Görsel üretimi için girdi olarak kullanılacak, Gauss dağılımından örneklenen önceden oluşturulmuş gürültülü latensler. Farklı istemlerle aynı üretimi ayarlamak için kullanılabilir. Sağlanmazsa, sağlanan rastgele `generator` kullanılarak örneklem yoluyla bir latens tensörü oluşturulur.
prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, metin gömme değerleri `prompt` girdi argümanından oluşturulur.
negative_prompt_embeds (`torch.FloatTensor`, *isteğe bağlı*) : Önceden oluşturulmuş negatif metin gömme değerleri. PixArt-Sigma için bu negatif istem "" olmalıdır. Sağlanmazsa, negative_prompt_embeds, `negative_prompt` girdi argümanından oluşturulur.
output_type (`str`, *isteğe bağlı*, varsayılan `"pil"`) : Üretilen görüntünün çıktı biçimi. `PIL.Image` veya `np.array` arasında seçim yapın.
return_dict (`bool`, *isteğe bağlı*, varsayılan `True`) : Düz bir tuple yerine `CosmosPipelineOutput` döndürülüp döndürülmediğini belirtir.
callback_on_step_end (`Callable`, `PipelineCallback`, `MultiPipelineCallbacks`, *opsiyonel*) : Çıkarım sırasında her gürültü azaltma adımının sonunda çağrılan, `PipelineCallback` veya `MultiPipelineCallbacks` alt sınıfı olan bir fonksiyon. Aşağıdaki argümanlarla çağrılır: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. `callback_kwargs`, `callback_on_step_end_tensor_inputs` tarafından belirtildiği üzere tüm tensörlerin listesini içerecektir.
callback_on_step_end_tensor_inputs (`List`, *optional*) : The list of tensor inputs for the `callback_on_step_end` function. The tensors specified in the list will be passed as `callback_kwargs` argument. You will only be able to include variables listed in the `._callback_tensor_inputs` attribute of your pipeline class.
max_sequence_length (`int`, varsayılan `512`) : İstemdeki (prompt) maksimum token sayısı. İstem bu uzunluğu aşarsa kırpılır. İstem bu uzunluktan kısaysa dolgu (padding) uygulanır.
num_latent_conditional_frames (`int`, varsayılan `2`) : Video2World koşullandırması için kullanılacak gizli koşullu kare sayısı. Girdi videosundan çıkarılan piksel kare sayısı `4 * (num_latent_conditional_frames - 1) + 1` olarak hesaplanır. Image2World benzeri davranış (tek kare koşullandırma) için 1 olarak ayarlayın.
conditional_frame_timestep (`float`, *opsiyonel*, varsayılan 0.0001) : Gürültüden arındırma sırasında koşullu kareler için kullanılan zaman adımı değeri.
**Dönüş:** `~CosmosPipelineOutput` veya `tuple`
`return_dict` `True` ise `CosmosPipelineOutput` döndürülür, aksi halde bir `tuple` döndürülür; bu yapının ilk öğesi üretilen görsellerin listesini, ikinci öğesi ise ilgili üretilen görselin "not-safe-for-work" (nsfw) içerip içermediğini gösteren `bool` değerlerinin listesini içerir.
Üretim için pipeline çağrı fonksiyonu. Üç modu destekler:
- **Text2World**: `image=None`, `video=None`, `prompt` sağlandı. Bir dünya klipleri oluşturur.
- **Image2World**: `image` sağlandı, `video=None`, `prompt` sağlandı. Tek bir kare üzerinde koşullar.
- **Video2World**: `video` sağlandı, `image=None`, `prompt` sağlandı. Girdi klipte koşullar.
Dünya videosu üretmek için `num_frames=93` (varsayılan) değerini ayarlayın veya tek bir görüntü karesi üretmek için `num_frames=1` değerini ayarlayın (yukarıdaki "*2Image modu").
Çıktılar `output_type` (ör. `"pil"` her istem için `num_frames` adet PIL görüntüsünün listesini döndürür) ile uyumludur.
Örnekler:
```python
>>> 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[[diffusers.Cosmos2_5_PredictBasePipeline.encode_prompt]]
```python
encode_prompt(prompt: str | list[str], negative_prompt: str | list[str] | None = None, do_classifier_free_guidance: bool = True, num_videos_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 512, device: typing.Optional[torch.device] = None, dtype: typing.Optional[torch.dtype] = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_5_predict.py#L324)
**Parametreler:**
prompt (`str` veya `list[str]`, *isteğe bağlı*) : kodlanacak istem
negative_prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmemek için kullanılan istem veya istemler. Tanımlanmazsa, bunun yerine `negative_prompt_embeds` parametresinin geçirilmesi gerekir. Yönlendirme kullanılmadığında (yani `guidance_scale` değeri `1`'den küçükse) yok sayılır.
do_classifier_free_guidance (`bool`, *isteğe bağlı*, varsayılan `True`) : Sınıflandırıcı serbest yönlendirmenin (classifier free guidance) kullanılıp kullanılmayacağı.
num_videos_per_prompt (`int`, *opsiyonel*, varsayılan 1) : Her istem için oluşturulması gereken video sayısı. Sonuç gömme vektörlerinin yerleştirileceği torch cihazı
prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, metin gömme değerleri `prompt` girdi argümanından oluşturulur.
negative_prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş negatif metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, negative_prompt_embeds, `negative_prompt` girdi argümanından oluşturulur.
device : (`torch.device`, *isteğe bağlı*): torch cihazı
dtype : (`torch.dtype`, *isteğe bağlı*): torch dtype
İsteği metin kodlayıcı gizli durumlarına kodlar.
## CosmosTextToWorldPipeline[[diffusers.CosmosTextToWorldPipeline]]
#### diffusers.CosmosTextToWorldPipeline[[diffusers.CosmosTextToWorldPipeline]]
```python
diffusers.CosmosTextToWorldPipeline(text_encoder: T5EncoderModel, tokenizer: T5Tokenizer, transformer: CosmosTransformer3DModel, vae: AutoencoderKLCosmos, scheduler: EDMEulerScheduler, safety_checker: CosmosSafetyChecker = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos_text2world.py#L140)
**Parametreler:**
text_encoder (`T5EncoderModel`) : Donmuş metin kodlayıcı. Cosmos [T5](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel) kullanır; özellikle [t5-11b](https://huggingface.co/google-t5/t5-11b) varyantı.
tokenizer (`T5TokenizerFast`) : [T5Tokenizer](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Tokenizer) sınıfının tokenizer'ı.
transformer ([CosmosTransformer3DModel](/docs/diffusers/main/tr/api/models/cosmos_transformer3d#diffusers.CosmosTransformer3DModel)) : Kodlanmış görüntü latentlerini gürültüden aramak için koşullu Transformer.
scheduler ([FlowMatchEulerDiscreteScheduler](/docs/diffusers/main/tr/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler)) : Kodlanmış görüntü latentlerini gürültüden arındırmak için `transformer` ile birlikte kullanılacak bir zamanlayıcı.
vae ([AutoencoderKLCosmos](/docs/diffusers/main/tr/api/models/autoencoderkl_cosmos#diffusers.AutoencoderKLCosmos)) : Video'ları latent temsillere kodlamak ve latent temsillerden video'lara çözmek için kullanılan Varyasyonel Oto-Kodlayıcı (VAE) Modeli.
[Cosmos Predict1](https://github.com/nvidia-cosmos/cosmos-predict1) kullanılarak metinden dünya üretimi için pipeline.
Bu model [DiffusionPipeline](/docs/diffusers/main/tr/api/pipelines/overview#diffusers.DiffusionPipeline) sınıfından devralınmıştır. Tüm pipeline'lar için uygulanan genel yöntemlerin (indirme, kaydetme, belirli bir cihazda çalıştırma vb.) belgelerini üst sınıfın dokümantasyonunda bulabilirsiniz.
#### __call__[[diffusers.CosmosTextToWorldPipeline.__call__]]
```python
__call__(prompt: str | list[str] = None, negative_prompt: str | list[str] | None = None, height: int = 704, width: int = 1280, num_frames: int = 121, num_inference_steps: int = 36, guidance_scale: float = 7.0, fps: int = 30, num_videos_per_prompt: int | None = 1, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.Tensor] = None, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, output_type: str | None = 'pil', return_dict: bool = True, callback_on_step_end: typing.Union[typing.Callable[[int, int], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None, callback_on_step_end_tensor_inputs: list = ['latents'], max_sequence_length: int = 512)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos_text2world.py#L401)
**Parametreler:**
prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmek için istem veya istemler. Tanımlanmamışsa, bunun yerine `prompt_embeds` geçirilmelidir.
negative_prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmemek için kullanılan istem veya istemler. Tanımlanmazsa, bunun yerine `negative_prompt_embeds` parametresinin geçirilmesi gerekir. Yönlendirme kullanılmadığında (yani `guidance_scale` değeri `1`'den büyük olmadığında) yok sayılır.
height (`int`, varsayılan `720`) : Üretilen görüntünün piksel cinsinden yüksekliği.
width (`int`, varsayılan `1280`) : Üretilen görüntünün piksel cinsinden genişliği.
num_frames (`int`, varsayılan `121`) : Üretilen videodaki kare sayısı.
num_inference_steps (`int`, varsayılan `36`) : Gürültü azaltma adım sayısı. Daha fazla gürültü azaltma adımı, genellikle daha yavaş çıkarım pahasına daha yüksek kaliteli bir görüntüye yol açar.
guidance_scale (`float`, varsayılan `7.0`) : [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598)'de tanımlanan yönlendirme ölçeği. `guidance_scale`, [Imagen Paper](https://huggingface.co/papers/2205.11487)'daki 2. denklemindeki `w` olarak tanımlanır. `guidance_scale > 1` ayarlanarak yönlendirme ölçeği etkinleştirilir.
fps (`int`, varsayılan `30`) : Üretilen videonun saniyede kare sayısı.
num_videos_per_prompt (`int`, *isteğe bağlı*, varsayılan 1) : Her istem için üretilecek görsel sayısı.
generator (`torch.Generator` veya `list[torch.Generator]`, *isteğe bağlı*) : Üretimi deterministik hale getirmek için bir [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html).
latents (`torch.Tensor`, *isteğe bağlı*) : Görsel üretimi için girdi olarak kullanılacak, Gauss dağılımından örneklenen önceden oluşturulmuş gürültülü latensler. Farklı istemlerle aynı üretimi ayarlamak için kullanılabilir. Sağlanmazsa, sağlanan rastgele `generator` kullanılarak örneklem yoluyla bir latens tensörü oluşturulur.
prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, metin gömme değerleri `prompt` girdi argümanından oluşturulur.
negative_prompt_embeds (`torch.FloatTensor`, *isteğe bağlı*) : Önceden oluşturulmuş negatif metin gömme değerleri. PixArt-Sigma için bu negatif istem "" olmalıdır. Sağlanmazsa, negative_prompt_embeds, `negative_prompt` girdi argümanından oluşturulur.
output_type (`str`, *isteğe bağlı*, varsayılan `"pil"`) : Üretilen görüntünün çıktı biçimi. `PIL.Image` veya `np.array` arasında seçim yapın.
return_dict (`bool`, *isteğe bağlı*, varsayılan `True`) : Düz bir tuple yerine `CosmosPipelineOutput` döndürülüp döndürülmediğini belirtir.
callback_on_step_end (`Callable`, `PipelineCallback`, `MultiPipelineCallbacks`, *opsiyonel*) : Çıkarım sırasında her gürültü azaltma adımının sonunda çağrılan, `PipelineCallback` veya `MultiPipelineCallbacks` alt sınıfı olan bir fonksiyon. Aşağıdaki argümanlarla çağrılır: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. `callback_kwargs`, `callback_on_step_end_tensor_inputs` tarafından belirtildiği üzere tüm tensörlerin listesini içerecektir.
callback_on_step_end_tensor_inputs (`list`, *isteğe bağlı*) : `callback_on_step_end` işlevi için girdi tensörlerinin listesi. Listede belirtilen tensörler, `callback_kwargs` argümanı olarak geçirilir. Yalnızca pipeline sınıfınızın `._callback_tensor_inputs` özniteliğinde listelenen değişkenleri dahil edebilirsiniz.
max_sequence_length (`int`, varsayılan `512`) : İstemdeki (prompt) maksimum token sayısı. İstem bu uzunluğu aşarsa kırpılır. İstem bu uzunluktan kısaysa dolgu (padding) uygulanır.
**Dönüş:** `~CosmosPipelineOutput` veya `tuple`
`return_dict` `True` ise `CosmosPipelineOutput` döndürülür, aksi halde bir `tuple` döndürülür; bu yapının ilk öğesi üretilen görsellerin listesini, ikinci öğesi ise ilgili üretilen görselin "not-safe-for-work" (nsfw) içerip içermediğini gösteren `bool` değerlerinin listesini içerir.
Üretim için pipeline'ın çağrı fonksiyonu.
Örnekler:
```python
>>> 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[[diffusers.CosmosTextToWorldPipeline.encode_prompt]]
```python
encode_prompt(prompt: str | list[str], negative_prompt: str | list[str] | None = None, do_classifier_free_guidance: bool = True, num_videos_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 512, device: typing.Optional[torch.device] = None, dtype: typing.Optional[torch.dtype] = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos_text2world.py#L239)
**Parametreler:**
prompt (`str` veya `list[str]`, *isteğe bağlı*) : kodlanacak istem
negative_prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmemek için kullanılan istem veya istemler. Tanımlanmazsa, bunun yerine `negative_prompt_embeds` parametresinin geçirilmesi gerekir. Yönlendirme kullanılmadığında (yani `guidance_scale` değeri `1`'den küçükse) yok sayılır.
do_classifier_free_guidance (`bool`, *isteğe bağlı*, varsayılan `True`) : Sınıflandırıcı serbest yönlendirmenin (classifier free guidance) kullanılıp kullanılmayacağı.
num_videos_per_prompt (`int`, *opsiyonel*, varsayılan 1) : Her istem için oluşturulması gereken video sayısı. Sonuç gömme vektörlerinin yerleştirileceği torch cihazı
prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, metin gömme değerleri `prompt` girdi argümanından oluşturulur.
negative_prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş negatif metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, negative_prompt_embeds, `negative_prompt` girdi argümanından oluşturulur.
device : (`torch.device`, *isteğe bağlı*): torch cihazı
dtype : (`torch.dtype`, *isteğe bağlı*): torch dtype
İsteği metin kodlayıcı gizli durumlarına kodlar.
## CosmosVideoToWorldPipeline[[diffusers.CosmosVideoToWorldPipeline]]
#### diffusers.CosmosVideoToWorldPipeline[[diffusers.CosmosVideoToWorldPipeline]]
```python
diffusers.CosmosVideoToWorldPipeline(text_encoder: T5EncoderModel, tokenizer: T5Tokenizer, transformer: CosmosTransformer3DModel, vae: AutoencoderKLCosmos, scheduler: EDMEulerScheduler, safety_checker: CosmosSafetyChecker = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos_video2world.py#L183)
**Parametreler:**
text_encoder (`T5EncoderModel`) : Donmuş metin kodlayıcı. Cosmos [T5](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel) kullanır; özellikle [t5-11b](https://huggingface.co/google-t5/t5-11b) varyantı.
tokenizer (`T5TokenizerFast`) : [T5Tokenizer](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Tokenizer) sınıfının tokenizer'ı.
transformer ([CosmosTransformer3DModel](/docs/diffusers/main/tr/api/models/cosmos_transformer3d#diffusers.CosmosTransformer3DModel)) : Kodlanmış görüntü latentlerini gürültüden aramak için koşullu Transformer.
scheduler ([FlowMatchEulerDiscreteScheduler](/docs/diffusers/main/tr/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler)) : Kodlanmış görüntü latentlerini gürültüden arındırmak için `transformer` ile birlikte kullanılacak bir zamanlayıcı.
vae ([AutoencoderKLCosmos](/docs/diffusers/main/tr/api/models/autoencoderkl_cosmos#diffusers.AutoencoderKLCosmos)) : Video'ları latent temsillere kodlamak ve latent temsillerden video'lara çözmek için kullanılan Varyasyonel Oto-Kodlayıcı (VAE) Modeli.
[Cosmos Predict-1](https://github.com/nvidia-cosmos/cosmos-predict1) kullanılarak görüntüden dünyaya ve videodan dünyaya üretim için pipeline.
Bu model [DiffusionPipeline](/docs/diffusers/main/tr/api/pipelines/overview#diffusers.DiffusionPipeline) sınıfından devralınmıştır. Tüm pipeline'lar için uygulanan genel yöntemlerin (indirme, kaydetme, belirli bir cihazda çalıştırma vb.) belgelerini üst sınıfın dokümantasyonunda bulabilirsiniz.
#### __call__[[diffusers.CosmosVideoToWorldPipeline.__call__]]
```python
__call__(image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]] = None, video: list = None, prompt: str | list[str] = None, negative_prompt: str | list[str] | None = None, height: int = 704, width: int = 1280, num_frames: int = 121, num_inference_steps: int = 36, guidance_scale: float = 7.0, input_frames_guidance: bool = False, augment_sigma: float = 0.001, fps: int = 30, num_videos_per_prompt: int | None = 1, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.Tensor] = None, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, output_type: str | None = 'pil', return_dict: bool = True, callback_on_step_end: typing.Union[typing.Callable[[int, int], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None, callback_on_step_end_tensor_inputs: list = ['latents'], max_sequence_length: int = 512)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos_video2world.py#L513)
**Parametreler:**
image (`PIL.Image.Image`, `np.ndarray`, `torch.Tensor`, *isteğe bağlı*) : Video üretimi için koşullandırma girdisi olarak kullanılacak görüntü.
video (`list[PIL.Image.Image]`, `np.ndarray`, `torch.Tensor`, *isteğe bağlı*) : Video üretimi için koşullandırma girdisi olarak kullanılacak video.
prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmek için istem veya istemler. Tanımlanmamışsa, bunun yerine `prompt_embeds` geçirilmelidir.
negative_prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmemek için kullanılan istem veya istemler. Tanımlanmazsa, bunun yerine `negative_prompt_embeds` parametresinin geçirilmesi gerekir. Yönlendirme kullanılmadığında (yani `guidance_scale` değeri `1`'den büyük olmadığında) yok sayılır.
height (`int`, varsayılan `720`) : Üretilen görüntünün piksel cinsinden yüksekliği.
width (`int`, varsayılan `1280`) : Üretilen görüntünün piksel cinsinden genişliği.
num_frames (`int`, varsayılan `121`) : Üretilen videodaki kare sayısı.
num_inference_steps (`int`, varsayılan `36`) : Gürültü azaltma adım sayısı. Daha fazla gürültü azaltma adımı, genellikle daha yavaş çıkarım pahasına daha yüksek kaliteli bir görüntüye yol açar.
guidance_scale (`float`, varsayılan `7.0`) : [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598)'de tanımlanan yönlendirme ölçeği. `guidance_scale`, [Imagen Paper](https://huggingface.co/papers/2205.11487)'daki 2. denklemindeki `w` olarak tanımlanır. `guidance_scale > 1` ayarlanarak yönlendirme ölçeği etkinleştirilir.
input_frames_guidance (`bool`, *isteğe bağlı*, varsayılan `False`) : Koşullu giriş karelerine rehberlik uygulanıp uygulanmayacağı.
augment_sigma (`float`, *opsiyonel*, varsayılan 0.001) : Gürültü azaltma sırasında koşullu latentleri artırmak için kullanılan Sigma değeri.
fps (`int`, varsayılan `30`) : Üretilen videonun saniyede kare sayısı.
num_videos_per_prompt (`int`, *isteğe bağlı*, varsayılan 1) : Her istem için üretilecek görsel sayısı.
generator (`torch.Generator` veya `list[torch.Generator]`, *isteğe bağlı*) : Üretimi deterministik hale getirmek için bir [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html).
latents (`torch.Tensor`, *isteğe bağlı*) : Görsel üretimi için girdi olarak kullanılacak, Gauss dağılımından örneklenen önceden oluşturulmuş gürültülü latensler. Farklı istemlerle aynı üretimi ayarlamak için kullanılabilir. Sağlanmazsa, sağlanan rastgele `generator` kullanılarak örneklem yoluyla bir latens tensörü oluşturulur.
prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, metin gömme değerleri `prompt` girdi argümanından oluşturulur.
negative_prompt_embeds (`torch.FloatTensor`, *isteğe bağlı*) : Önceden oluşturulmuş negatif metin gömme değerleri. PixArt-Sigma için bu negatif istem "" olmalıdır. Sağlanmazsa, negative_prompt_embeds, `negative_prompt` girdi argümanından oluşturulur.
output_type (`str`, *isteğe bağlı*, varsayılan `"pil"`) : Üretilen görüntünün çıktı biçimi. `PIL.Image` veya `np.array` arasında seçim yapın.
return_dict (`bool`, *isteğe bağlı*, varsayılan `True`) : Düz bir tuple yerine `CosmosPipelineOutput` döndürülüp döndürülmediğini belirtir.
callback_on_step_end (`Callable`, `PipelineCallback`, `MultiPipelineCallbacks`, *opsiyonel*) : Çıkarım sırasında her gürültü azaltma adımının sonunda çağrılan, `PipelineCallback` veya `MultiPipelineCallbacks` alt sınıfı olan bir fonksiyon. Aşağıdaki argümanlarla çağrılır: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. `callback_kwargs`, `callback_on_step_end_tensor_inputs` tarafından belirtildiği üzere tüm tensörlerin listesini içerecektir.
callback_on_step_end_tensor_inputs (`list`, *isteğe bağlı*) : `callback_on_step_end` işlevi için girdi tensörlerinin listesi. Listede belirtilen tensörler, `callback_kwargs` argümanı olarak geçirilir. Yalnızca pipeline sınıfınızın `._callback_tensor_inputs` özniteliğinde listelenen değişkenleri dahil edebilirsiniz.
max_sequence_length (`int`, varsayılan `512`) : İstemdeki (prompt) maksimum token sayısı. İstem bu uzunluğu aşarsa kırpılır. İstem bu uzunluktan kısaysa dolgu (padding) uygulanır.
**Dönüş:** `~CosmosPipelineOutput` veya `tuple`
`return_dict` `True` ise `CosmosPipelineOutput` döndürülür, aksi halde bir `tuple` döndürülür; bu yapının ilk öğesi üretilen görsellerin listesini, ikinci öğesi ise ilgili üretilen görselin "not-safe-for-work" (nsfw) içerip içermediğini gösteren `bool` değerlerinin listesini içerir.
Üretim için pipeline'ın çağrı fonksiyonu.
Örnekler:
Görsel koşullandırma:
```python
>>> 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 koşullandırma:
```python
>>> 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[[diffusers.CosmosVideoToWorldPipeline.encode_prompt]]
```python
encode_prompt(prompt: str | list[str], negative_prompt: str | list[str] | None = None, do_classifier_free_guidance: bool = True, num_videos_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 512, device: typing.Optional[torch.device] = None, dtype: typing.Optional[torch.dtype] = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos_video2world.py#L285)
**Parametreler:**
prompt (`str` veya `list[str]`, *isteğe bağlı*) : kodlanacak istem
negative_prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmemek için kullanılan istem veya istemler. Tanımlanmazsa, bunun yerine `negative_prompt_embeds` parametresinin geçirilmesi gerekir. Yönlendirme kullanılmadığında (yani `guidance_scale` değeri `1`'den küçükse) yok sayılır.
do_classifier_free_guidance (`bool`, *isteğe bağlı*, varsayılan `True`) : Sınıflandırıcı serbest yönlendirmenin (classifier free guidance) kullanılıp kullanılmayacağı.
num_videos_per_prompt (`int`, *opsiyonel*, varsayılan 1) : Her istem için oluşturulması gereken video sayısı. Sonuç gömme vektörlerinin yerleştirileceği torch cihazı
prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, metin gömme değerleri `prompt` girdi argümanından oluşturulur.
negative_prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş negatif metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, negative_prompt_embeds, `negative_prompt` girdi argümanından oluşturulur.
device : (`torch.device`, *isteğe bağlı*): torch cihazı
dtype : (`torch.dtype`, *isteğe bağlı*): torch dtype
İsteği metin kodlayıcı gizli durumlarına kodlar.
## Cosmos2TextToImagePipeline[[diffusers.Cosmos2TextToImagePipeline]]
#### diffusers.Cosmos2TextToImagePipeline[[diffusers.Cosmos2TextToImagePipeline]]
```python
diffusers.Cosmos2TextToImagePipeline(text_encoder: T5EncoderModel, tokenizer: T5Tokenizer, transformer: CosmosTransformer3DModel, vae: AutoencoderKLWan, scheduler: FlowMatchEulerDiscreteScheduler, safety_checker: CosmosSafetyChecker = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_text2image.py#L143)
**Parametreler:**
text_encoder (`T5EncoderModel`) : Donmuş metin kodlayıcı. Cosmos [T5](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel) kullanır; özellikle [t5-11b](https://huggingface.co/google-t5/t5-11b) varyantı.
tokenizer (`T5TokenizerFast`) : [T5Tokenizer](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Tokenizer) sınıfının tokenizer'ı.
transformer ([CosmosTransformer3DModel](/docs/diffusers/main/tr/api/models/cosmos_transformer3d#diffusers.CosmosTransformer3DModel)) : Kodlanmış görüntü latentlerini gürültüden aramak için koşullu Transformer.
scheduler ([FlowMatchEulerDiscreteScheduler](/docs/diffusers/main/tr/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler)) : Kodlanmış görüntü latentlerini gürültüden arındırmak için `transformer` ile birlikte kullanılacak bir zamanlayıcı.
vae ([AutoencoderKLWan](/docs/diffusers/main/tr/api/models/autoencoder_kl_wan#diffusers.AutoencoderKLWan)) : Video'ları latent temsillere kodlamak ve latent temsillerden video'lara çözmek için kullanılan Varyasyonel Oto-Kodlayıcı (VAE) Modeli.
[Cosmos Predict2](https://github.com/nvidia-cosmos/cosmos-predict2) kullanılarak metinden görüntüye üretim hattı.
Bu model [DiffusionPipeline](/docs/diffusers/main/tr/api/pipelines/overview#diffusers.DiffusionPipeline) sınıfından devralınmıştır. Tüm pipeline'lar için uygulanan genel yöntemlerin (indirme, kaydetme, belirli bir cihazda çalıştırma vb.) belgelerini üst sınıfın dokümantasyonunda bulabilirsiniz.
#### __call__[[diffusers.Cosmos2TextToImagePipeline.__call__]]
```python
__call__(prompt: str | list[str] = None, negative_prompt: str | list[str] | None = None, height: int = 768, width: int = 1360, num_inference_steps: int = 35, guidance_scale: float = 7.0, num_images_per_prompt: int | None = 1, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.Tensor] = None, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, output_type: str | None = 'pil', return_dict: bool = True, callback_on_step_end: typing.Union[typing.Callable[[int, int], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None, callback_on_step_end_tensor_inputs: list = ['latents'], max_sequence_length: int = 512)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_text2image.py#L417)
**Parametreler:**
prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmek için istem veya istemler. Tanımlanmamışsa, bunun yerine `prompt_embeds` geçirilmelidir.
negative_prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmemek için kullanılan istem veya istemler. Tanımlanmazsa, bunun yerine `negative_prompt_embeds` parametresinin geçirilmesi gerekir. Yönlendirme kullanılmadığında (yani `guidance_scale` değeri `1`'den büyük olmadığında) yok sayılır.
height (`int`, varsayılan `768`) : Üretilen görüntünün piksel cinsinden yüksekliği.
width (`int`, varsayılan `1360`) : Üretilen görüntünün piksel cinsinden genişliği.
num_inference_steps (`int`, varsayılan `35`) : Gürültü azaltma adım sayısı. Daha fazla gürültü azaltma adımı, genellikle daha yavaş çıkarım pahasına daha yüksek kaliteli bir görüntüye yol açar.
guidance_scale (`float`, varsayılan `7.0`) : [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598)'de tanımlanan yönlendirme ölçeği. `guidance_scale`, [Imagen Paper](https://huggingface.co/papers/2205.11487)'daki 2. denklemindeki `w` olarak tanımlanır. `guidance_scale > 1` ayarlanarak yönlendirme ölçeği etkinleştirilir.
num_images_per_prompt (`int`, *isteğe bağlı*, varsayılan 1) : Her istem için üretilecek görsel sayısı.
generator (`torch.Generator` veya `list[torch.Generator]`, *isteğe bağlı*) : Üretimi deterministik hale getirmek için bir [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html).
latents (`torch.Tensor`, *isteğe bağlı*) : Görsel üretimi için girdi olarak kullanılacak, Gauss dağılımından örneklenen önceden oluşturulmuş gürültülü latensler. Farklı istemlerle aynı üretimi ayarlamak için kullanılabilir. Sağlanmazsa, sağlanan rastgele `generator` kullanılarak örneklem yoluyla bir latens tensörü oluşturulur.
prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, metin gömme değerleri `prompt` girdi argümanından oluşturulur.
negative_prompt_embeds (`torch.FloatTensor`, *isteğe bağlı*) : Önceden oluşturulmuş negatif metin gömme değerleri. PixArt-Sigma için bu negatif istem "" olmalıdır. Sağlanmazsa, negative_prompt_embeds, `negative_prompt` girdi argümanından oluşturulur.
output_type (`str`, *isteğe bağlı*, varsayılan `"pil"`) : Üretilen görüntünün çıktı biçimi. `PIL.Image` veya `np.array` arasında seçim yapın.
return_dict (`bool`, *isteğe bağlı*, varsayılan `True`) : Düz bir tuple yerine `CosmosImagePipelineOutput` döndürülüp döndürülmemesi.
callback_on_step_end (`Callable`, `PipelineCallback`, `MultiPipelineCallbacks`, *opsiyonel*) : Çıkarım sırasında her gürültü azaltma adımının sonunda çağrılan, `PipelineCallback` veya `MultiPipelineCallbacks` alt sınıfı olan bir fonksiyon. Aşağıdaki argümanlarla çağrılır: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. `callback_kwargs`, `callback_on_step_end_tensor_inputs` tarafından belirtildiği üzere tüm tensörlerin listesini içerecektir.
callback_on_step_end_tensor_inputs (`list`, *isteğe bağlı*) : `callback_on_step_end` işlevi için girdi tensörlerinin listesi. Listede belirtilen tensörler, `callback_kwargs` argümanı olarak geçirilir. Yalnızca pipeline sınıfınızın `._callback_tensor_inputs` özniteliğinde listelenen değişkenleri dahil edebilirsiniz.
max_sequence_length (`int`, varsayılan `512`) : İstemdeki (prompt) maksimum token sayısı. İstem bu uzunluğu aşarsa kırpılır. İstem bu uzunluktan kısaysa dolgu (padding) uygulanır.
**Dönüş:** `~CosmosImagePipelineOutput` veya `tuple`
`return_dict` `True` ise `CosmosImagePipelineOutput` döndürülür, aksi takdirde bir `tuple` döndürülür; bu yapının ilk öğesi üretilen görsellerin listesini, ikinci öğesi ise ilgili üretilen görselin "not-safe-for-work" (nsfw) içerip içermediğini gösteren `bool` değerlerinin listesini içerir.
Üretim için pipeline'ın çağrı fonksiyonu.
Örnekler:
```python
>>> 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[[diffusers.Cosmos2TextToImagePipeline.encode_prompt]]
```python
encode_prompt(prompt: str | list[str], negative_prompt: str | list[str] | None = None, do_classifier_free_guidance: bool = True, num_images_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 512, device: typing.Optional[torch.device] = None, dtype: typing.Optional[torch.dtype] = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_text2image.py#L254)
**Parametreler:**
prompt (`str` veya `list[str]`, *isteğe bağlı*) : kodlanacak istem
negative_prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmemek için kullanılan istem veya istemler. Tanımlanmazsa, bunun yerine `negative_prompt_embeds` parametresinin geçirilmesi gerekir. Yönlendirme kullanılmadığında (yani `guidance_scale` değeri `1`'den küçükse) yok sayılır.
do_classifier_free_guidance (`bool`, *isteğe bağlı*, varsayılan `True`) : Sınıflandırıcı serbest yönlendirmenin (classifier free guidance) kullanılıp kullanılmayacağı.
num_images_per_prompt (`int`, *opsiyonel*, varsayılan 1) : Her istem için oluşturulması gereken video sayısı. Sonuç gömme vektörlerinin yerleştirileceği torch cihazı
prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, metin gömme değerleri `prompt` girdi argümanından oluşturulur.
negative_prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş negatif metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, negative_prompt_embeds, `negative_prompt` girdi argümanından oluşturulur.
device : (`torch.device`, *isteğe bağlı*): torch cihazı
dtype : (`torch.dtype`, *isteğe bağlı*): torch dtype
İsteği metin kodlayıcı gizli durumlarına kodlar.
## Cosmos2VideoToWorldPipeline[[diffusers.Cosmos2VideoToWorldPipeline]]
#### diffusers.Cosmos2VideoToWorldPipeline[[diffusers.Cosmos2VideoToWorldPipeline]]
```python
diffusers.Cosmos2VideoToWorldPipeline(text_encoder: T5EncoderModel, tokenizer: T5Tokenizer, transformer: CosmosTransformer3DModel, vae: AutoencoderKLWan, scheduler: FlowMatchEulerDiscreteScheduler, safety_checker: CosmosSafetyChecker = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_video2world.py#L162)
**Parametreler:**
text_encoder (`T5EncoderModel`) : Donmuş metin kodlayıcı. Cosmos [T5](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5EncoderModel) kullanır; özellikle [t5-11b](https://huggingface.co/google-t5/t5-11b) varyantı.
tokenizer (`T5TokenizerFast`) : [T5Tokenizer](https://huggingface.co/docs/transformers/model_doc/t5#transformers.T5Tokenizer) sınıfının tokenizer'ı.
transformer ([CosmosTransformer3DModel](/docs/diffusers/main/tr/api/models/cosmos_transformer3d#diffusers.CosmosTransformer3DModel)) : Kodlanmış görüntü latentlerini gürültüden aramak için koşullu Transformer.
scheduler ([FlowMatchEulerDiscreteScheduler](/docs/diffusers/main/tr/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler)) : Kodlanmış görüntü latentlerini gürültüden arındırmak için `transformer` ile birlikte kullanılacak bir zamanlayıcı.
vae ([AutoencoderKLWan](/docs/diffusers/main/tr/api/models/autoencoder_kl_wan#diffusers.AutoencoderKLWan)) : Video'ları latent temsillere kodlamak ve latent temsillerden video'lara çözmek için kullanılan Varyasyonel Oto-Kodlayıcı (VAE) Modeli.
[Cosmos Predict2](https://github.com/nvidia-cosmos/cosmos-predict2) kullanılarak video-dünya üretim hattı.
Bu model [DiffusionPipeline](/docs/diffusers/main/tr/api/pipelines/overview#diffusers.DiffusionPipeline) sınıfından devralınmıştır. Tüm pipeline'lar için uygulanan genel yöntemlerin (indirme, kaydetme, belirli bir cihazda çalıştırma vb.) belgelerini üst sınıfın dokümantasyonunda bulabilirsiniz.
#### __call__[[diffusers.Cosmos2VideoToWorldPipeline.__call__]]
```python
__call__(image: typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]] = None, video: list = None, prompt: str | list[str] = None, negative_prompt: str | list[str] | None = None, height: int = 704, width: int = 1280, num_frames: int = 93, num_inference_steps: int = 35, guidance_scale: float = 7.0, fps: int = 16, num_videos_per_prompt: int | None = 1, generator: typing.Union[torch.Generator, list[torch.Generator], NoneType] = None, latents: typing.Optional[torch.Tensor] = None, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, output_type: str | None = 'pil', return_dict: bool = True, callback_on_step_end: typing.Union[typing.Callable[[int, int], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None, callback_on_step_end_tensor_inputs: list = ['latents'], max_sequence_length: int = 512, sigma_conditioning: float = 0.0001)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_video2world.py#L485)
**Parametreler:**
image (`PIL.Image.Image`, `np.ndarray`, `torch.Tensor`, *isteğe bağlı*) : Video üretimi için koşullandırma girdisi olarak kullanılacak görüntü.
video (`list[PIL.Image.Image]`, `np.ndarray`, `torch.Tensor`, *isteğe bağlı*) : Video üretimi için koşullandırma girdisi olarak kullanılacak video.
prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmek için istem veya istemler. Tanımlanmamışsa, bunun yerine `prompt_embeds` geçirilmelidir.
negative_prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmemek için kullanılan istem veya istemler. Tanımlanmazsa, bunun yerine `negative_prompt_embeds` parametresinin geçirilmesi gerekir. Yönlendirme kullanılmadığında (yani `guidance_scale` değeri `1`'den büyük olmadığında) yok sayılır.
height (`int`, varsayılan `704`) : Üretilen görüntünün piksel cinsinden yüksekliği.
width (`int`, varsayılan `1280`) : Üretilen görüntünün piksel cinsinden genişliği.
num_frames (`int`, varsayılan `93`) : Üretilen videodaki kare sayısı.
num_inference_steps (`int`, varsayılan `35`) : Gürültü azaltma adım sayısı. Daha fazla gürültü azaltma adımı, genellikle daha yavaş çıkarım pahasına daha yüksek kaliteli bir görüntüye yol açar.
guidance_scale (`float`, varsayılan `7.0`) : [Classifier-Free Diffusion Guidance](https://huggingface.co/papers/2207.12598)'de tanımlanan yönlendirme ölçeği. `guidance_scale`, [Imagen Paper](https://huggingface.co/papers/2205.11487)'daki 2. denklemindeki `w` olarak tanımlanır. `guidance_scale > 1` ayarlanarak yönlendirme ölçeği etkinleştirilir.
fps (`int`, varsayılan `16`) : Üretilen videonun saniyedeki kare sayısı.
num_videos_per_prompt (`int`, *isteğe bağlı*, varsayılan 1) : Her istem için üretilecek görsel sayısı.
generator (`torch.Generator` veya `list[torch.Generator]`, *isteğe bağlı*) : Üretimi deterministik hale getirmek için bir [`torch.Generator`](https://pytorch.org/docs/stable/generated/torch.Generator.html).
latents (`torch.Tensor`, *isteğe bağlı*) : Görsel üretimi için girdi olarak kullanılacak, Gauss dağılımından örneklenen önceden oluşturulmuş gürültülü latensler. Farklı istemlerle aynı üretimi ayarlamak için kullanılabilir. Sağlanmazsa, sağlanan rastgele `generator` kullanılarak örneklem yoluyla bir latens tensörü oluşturulur.
prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, metin gömme değerleri `prompt` girdi argümanından oluşturulur.
negative_prompt_embeds (`torch.FloatTensor`, *isteğe bağlı*) : Önceden oluşturulmuş negatif metin gömme değerleri. PixArt-Sigma için bu negatif istem "" olmalıdır. Sağlanmazsa, negative_prompt_embeds, `negative_prompt` girdi argümanından oluşturulur.
output_type (`str`, *isteğe bağlı*, varsayılan `"pil"`) : Üretilen görüntünün çıktı biçimi. `PIL.Image` veya `np.array` arasında seçim yapın.
return_dict (`bool`, *isteğe bağlı*, varsayılan `True`) : Düz bir tuple yerine `CosmosPipelineOutput` döndürülüp döndürülmediğini belirtir.
callback_on_step_end (`Callable`, `PipelineCallback`, `MultiPipelineCallbacks`, *opsiyonel*) : Çıkarım sırasında her gürültü azaltma adımının sonunda çağrılan, `PipelineCallback` veya `MultiPipelineCallbacks` alt sınıfı olan bir fonksiyon. Aşağıdaki argümanlarla çağrılır: `callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)`. `callback_kwargs`, `callback_on_step_end_tensor_inputs` tarafından belirtildiği üzere tüm tensörlerin listesini içerecektir.
callback_on_step_end_tensor_inputs (`list`, *isteğe bağlı*) : `callback_on_step_end` işlevi için girdi tensörlerinin listesi. Listede belirtilen tensörler, `callback_kwargs` argümanı olarak geçirilir. Yalnızca pipeline sınıfınızın `._callback_tensor_inputs` özniteliğinde listelenen değişkenleri dahil edebilirsiniz.
max_sequence_length (`int`, varsayılan `512`) : İstemdeki (prompt) maksimum token sayısı. İstem bu uzunluğu aşarsa kırpılır. İstem bu uzunluktan kısaysa dolgu (padding) uygulanır.
sigma_conditioning (`float`, varsayılan `0.0001`) : Koşullama latentlerini ölçeklemek için kullanılan sigma değeri. İdeal olarak değiştirilmemeli veya sıfıra yakın küçük bir değere ayarlanmalıdır.
**Dönüş:** `~CosmosPipelineOutput` veya `tuple`
`return_dict` `True` ise `CosmosPipelineOutput` döndürülür, aksi halde bir `tuple` döndürülür; bu yapının ilk öğesi üretilen görsellerin listesini, ikinci öğesi ise ilgili üretilen görselin "not-safe-for-work" (nsfw) içerip içermediğini gösteren `bool` değerlerinin listesini içerir.
Üretim için pipeline'ın çağrı fonksiyonu.
Örnekler:
```python
>>> 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[[diffusers.Cosmos2VideoToWorldPipeline.encode_prompt]]
```python
encode_prompt(prompt: str | list[str], negative_prompt: str | list[str] | None = None, do_classifier_free_guidance: bool = True, num_videos_per_prompt: int = 1, prompt_embeds: typing.Optional[torch.Tensor] = None, negative_prompt_embeds: typing.Optional[torch.Tensor] = None, max_sequence_length: int = 512, device: typing.Optional[torch.device] = None, dtype: typing.Optional[torch.dtype] = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_cosmos2_video2world.py#L273)
**Parametreler:**
prompt (`str` veya `list[str]`, *isteğe bağlı*) : kodlanacak istem
negative_prompt (`str` veya `list[str]`, *isteğe bağlı*) : Görsel üretimi yönlendirmemek için kullanılan istem veya istemler. Tanımlanmazsa, bunun yerine `negative_prompt_embeds` parametresinin geçirilmesi gerekir. Yönlendirme kullanılmadığında (yani `guidance_scale` değeri `1`'den küçükse) yok sayılır.
do_classifier_free_guidance (`bool`, *isteğe bağlı*, varsayılan `True`) : Sınıflandırıcı serbest yönlendirmenin (classifier free guidance) kullanılıp kullanılmayacağı.
num_videos_per_prompt (`int`, *opsiyonel*, varsayılan 1) : Her istem için oluşturulması gereken video sayısı. Sonuç gömme vektörlerinin yerleştirileceği torch cihazı
prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, metin gömme değerleri `prompt` girdi argümanından oluşturulur.
negative_prompt_embeds (`torch.Tensor`, *isteğe bağlı*) : Ön oluşturulmuş negatif metin gömme değerleri. Metin girdilerini kolayca ayarlamak için kullanılabilir, *ör.* istem ağırlıklandırması. Sağlanmazsa, negative_prompt_embeds, `negative_prompt` girdi argümanından oluşturulur.
device : (`torch.device`, *isteğe bağlı*): torch cihazı
dtype : (`torch.dtype`, *isteğe bağlı*): torch dtype
İsteği metin kodlayıcı gizli durumlarına kodlar.
## CosmosPipelineOutput[[diffusers.pipelines.cosmos.pipeline_output.CosmosPipelineOutput]]
#### diffusers.pipelines.cosmos.pipeline_output.CosmosPipelineOutput[[diffusers.pipelines.cosmos.pipeline_output.CosmosPipelineOutput]]
```python
diffusers.pipelines.cosmos.pipeline_output.CosmosPipelineOutput(frames: Tensor)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_output.py#L14)
**Parametreler:**
frames (`torch.Tensor`, `np.ndarray` veya list[list[PIL.Image.Image]]) : video çıktıları listesi - `batch_size,` uzunluğunda iç içe geçmiş bir liste olabilir; her alt liste, `num_frames.` uzunluğunda gürültüsü azaltılmış PIL görüntü dizileri içerir. Ayrıca `(batch_size, num_frames, channels, height, width)` biçiminde bir NumPy dizi veya Torch tensörü de olabilir.
Cosmos any-to-world/video pipeline'leri için çıktı sınıfı.
## CosmosImagePipelineOutput[[diffusers.pipelines.cosmos.pipeline_output.CosmosImagePipelineOutput]]
#### diffusers.pipelines.cosmos.pipeline_output.CosmosImagePipelineOutput[[diffusers.pipelines.cosmos.pipeline_output.CosmosImagePipelineOutput]]
```python
diffusers.pipelines.cosmos.pipeline_output.CosmosImagePipelineOutput(images: list[PIL.Image.Image] | numpy.ndarray)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/cosmos/pipeline_output.py#L29)
**Parametreler:**
images (`list[PIL.Image.Image]` veya `np.ndarray`) : `batch_size` uzunluğunda gürültüsü azaltılmış PIL görselleri listesi veya `(batch_size, height, width, num_channels)` biçiminde numpy dizisi. PIL görselleri veya numpy dizisi, difüzyon hattının gürültüsü azaltılmış görsellerini temsil eder.
Cosmos any-to-image pipeline'leri için çıktı sınıfı.

Xet Storage Details

Size:
87.6 kB
·
Xet hash:
b6eb8501264015241167adaf1e2c3707b6b57308d8888a551872898e69581a03

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.