Buckets:

mishig's picture
|
download
raw
6.41 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. -->
# Anima
Anima, Qwen3 metin kodlayıcı, T5-token metin koşullandırıcısı ve [AutoencoderKLQwenImage](/docs/diffusers/main/tr/api/models/autoencoderkl_qwenimage#diffusers.AutoencoderKLQwenImage) VAE'si ile [CosmosTransformer3DModel](/docs/diffusers/main/tr/api/models/cosmos_transformer3d#diffusers.CosmosTransformer3DModel)'i yeniden kullanan bir metinden görüntüye modelidir.
```python
import torch
from diffusers import ModularPipeline
pipe = ModularPipeline.from_pretrained("circlestone-labs/Anima-Base-v1.0-Diffusers")
pipe.load_components(dtype=torch.bfloat16)
pipe.to("cuda") # or "mps", "xpu", "cpu"
image = pipe(prompt="masterpiece, best quality, 1girl, solo, city lights").images[0]
```
## AnimaModularPipeline[[diffusers.AnimaModularPipeline]]
#### diffusers.AnimaModularPipeline[[diffusers.AnimaModularPipeline]]
```python
diffusers.AnimaModularPipeline(blocks: diffusers.modular_pipelines.modular_pipeline.ModularPipelineBlocks | None = None, pretrained_model_name_or_path: str | os.PathLike | None = None, components_manager: diffusers.modular_pipelines.components_manager.ComponentsManager | None = None, collection: str | None = None, workflow: str | None = None, modular_config_dict: dict[str, typing.Any] | None = None, config_dict: dict[str, typing.Any] | None = None, **kwargs)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/anima/modular_pipeline.py#L19)
Anima için bir ModularPipeline.
## AnimaAutoBlocks[[diffusers.AnimaAutoBlocks]]
#### diffusers.AnimaAutoBlocks[[diffusers.AnimaAutoBlocks]]
```python
diffusers.AnimaAutoBlocks()
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/anima/modular_blocks_anima.py#L312)
Anima kullanarak metinden görüntüye ve görüntüden görüntüye üretim için Otomatik Modüler pipeline.
Desteklenen iş akışları:
- `text2image`: `prompt` gerektirir
- `img2img`: `image` ve `prompt` gerektirir
Bileşenler: text_encoder (`Qwen3Model`) tokenizer (`Qwen2Tokenizer`) t5_tokenizer (`T5Tokenizer`) guider (`ClassifierFreeGuidance`) vae (`AutoencoderKLQwenImage`) image_processor (`VaeImageProcessor`) text_conditioner (`AnimaTextConditioner`) transformer (`CosmosTransformer3DModel`) scheduler (`FlowMatchEulerDiscreteScheduler`)
Inputs: prompt (`str`): The prompt or prompts to guide image generation. negative_prompt (`str`, *optional*): The prompt or prompts not to guide the image generation. max_sequence_length (`int`, *optional*, defaults to 512): Maximum sequence length for prompt encoding. image (`Image | list`, *optional*): Reference image(s) for denoising. Can be a single image or list of images. height (`int`, *optional*): The height in pixels of the generated image. width (`int`, *optional*): The width in pixels of the generated image. generator (`Generator`, *optional*): Torch generator for deterministic generation. num_images_per_prompt (`int`, *optional*, defaults to 1): The number of images to generate per prompt. image_latents (`Tensor`, *optional*): image latents used to guide the image generation. Can be generated from vae_encoder step. num_inference_steps (`int`): The number of denoising steps. sigmas (`list`, *optional*): Custom sigmas for the denoising process. strength (`float`, *optional*, defaults to 0.9): Strength for img2img/inpainting. latents (`Tensor`): Pre-generated noisy latents for image generation. **denoiser_input_fields (`None`, *optional*): The conditional model inputs for the Anima denoiser. output_type (`str`, *optional*, defaults to pil): Output format: 'pil', 'np', 'pt'.
Çıktılar: görüntüler (`list`): Oluşturulan görüntüler.
## AnimaTextConditioner[[diffusers.AnimaTextConditioner]]
#### diffusers.AnimaTextConditioner[[diffusers.AnimaTextConditioner]]
```python
diffusers.AnimaTextConditioner(source_dim: int = 1024, target_dim: int = 1024, model_dim: int = 1024, num_layers: int = 6, num_attention_heads: int = 16, mlp_ratio: float = 4.0, target_vocab_size: int = 32128, use_self_attention: bool = True, use_layer_norm: bool = False, min_sequence_length: int = 512)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/condition_embedders/condition_embedder_anima.py#L229)
Anima'nın Qwen3 gizli durumlarını ve T5 token kimliklerini Cosmos metin gömme değerlerine eşlemek için kullandığı metin koşullandırıcısı.
Anima, Cosmos Predict2 DiT'yi yeniden kullanır. Tek model-özel koşullandırma modülü, difüzyon döngüsünden önce öğrenilmiş T5 token gömme değerlerinden Qwen3 metin kodlayıcısının gizli durumlarına çapraz dikkat uygulayan bu LLM adaptörüdür. `target_dim`, koşullandırıcının çıktı boyutudur ve dönüştürücünün `text_embed_dim` değeriyle eşleşmelidir.
#### forward[[diffusers.AnimaTextConditioner.forward]]
```python
forward(source_hidden_states: Tensor, target_input_ids: Tensor, target_attention_mask: typing.Optional[torch.Tensor] = None, source_attention_mask: typing.Optional[torch.Tensor] = None)
```
[Kaynak](https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/condition_embedders/condition_embedder_anima.py#L285)
**Parametreler:**
source_hidden_states (`torch.Tensor`, şekli `(batch_size, source_sequence_length, source_dim)`) : Koşullandırılacak Qwen3 metin kodlayıcı gizli durumları.
target_input_ids (`torch.Tensor`, şekli `(batch_size, target_sequence_length)`) : Öğrenmiş sorgu jetonları olarak kullanılan T5 jeton kimlikleri.
target_attention_mask (`torch.Tensor`, *isteğe bağlı*) : Hedef T5 token kimlikleri için dikkat maskesi.
source_attention_mask (`torch.Tensor`, *isteğe bağlı*) : Kaynak Qwen3 gizli durumları için dikkat maskesi.
**Dönüş:** `torch.Tensor`
Cosmos dönüştürücüsü için metin koşullandırma gömme değerleri.

Xet Storage Details

Size:
6.41 kB
·
Xet hash:
7ef3e1d6336b3d64662b43053b67180be2896152d1b1909e3c3a98e3b670ca91

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