Buckets:

mishig's picture
|
download
raw
7.27 kB

Apache License, Version 2.0(「ライセンス」)の下でライセンスされています。

このファイルは、ライセンスに準拠した場合にのみ使用できます。

ライセンスのコピーは以下から入手できます

http://www.apache.org/licenses/LICENSE-2.0

適用される法律で要求される場合、または書面による合意がある場合を除き、ソフトウェア

ライセンスに基づき配布される本ソフトウェアは、「現状のまま」

明示的または黙示的を問わず、いかなる種類の保証や条件も付随しません。

権限を管理する特定の言語については、ライセンスを参照してください。

ライセンスの下での制限。-->

Anima

Anima は、CosmosTransformer3DModel を再利用するテキストから画像を生成するモデルであり、Qwen3 テキストエンコーダー、T5 トークンベースのテキストコンディショナー、および AutoencoderKLQwenImage VAE を使用します。

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]]

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)

ソース

Anima用のModularPipeline。

AnimaAutoBlocks[[diffusers.AnimaAutoBlocks]]

diffusers.AnimaAutoBlocks[[diffusers.AnimaAutoBlocks]]

diffusers.AnimaAutoBlocks()

ソース

Anima を使用したテキストから画像へ、および画像から画像への生成のための Auto Modular パイプライン。

サポートされているワークフロー:

  • text2image: prompt が必要です
  • img2img: image、prompt が必要です

コンポーネント: text_encoder (Qwen3Model) tokenizer (Qwen2Tokenizer) t5_tokenizer (T5Tokenizer) guider (ClassifierFreeGuidance) vae (AutoencoderKLQwenImage) image_processor (VaeImageProcessor) text_conditioner (AnimaTextConditioner) transformer (CosmosTransformer3DModel) scheduler (FlowMatchEulerDiscreteScheduler)

入力: prompt (str): 画像生成をガイドするためのプロンプトまたはプロンプトのリスト。 negative_prompt (str, 任意): 画像生成をガイドしないプロンプトまたはプロンプトのリスト。 max_sequence_length (int, 任意, デフォルトは 512): プロンプトエンコードの最大シーケンス長。 image (Image | list, 任意): デノイジング用の参照画像。単一の画像または画像のリストを指定できます。 height (int, 任意): 生成される画像の高さ(ピクセル単位)。 width (int, 任意): 生成される画像の幅(ピクセル単位)。 generator (Generator, 任意): 決定論的な生成のための Torch ジェネレーター。 num_images_per_prompt (int, 任意, デフォルトは 1): 1 つのプロンプトあたり生成する画像の数。 image_latents (Tensor, 任意): 画像生成をガイドするために使用される image latents。 vae_encoder ステップから生成できます。 num_inference_steps (int): デノイジングのステップ数。 sigmas (list, 任意): デノイジングプロセス用のカスタムシグマ。 strength (float, 任意, デフォルトは 0.9): img2img/インペインティングの強度。 latents (Tensor): 画像生成用の事前生成されたノイズ付き latents。 **denoiser_input_fields (None, 任意): Anima デノイザー用の条件付きモデルの入力。 output_type (str, 任意, デフォルトは pil): 出力形式: 'pil', 'np', 'pt'。

出力: 画像 (list): 生成された画像。

AnimaTextConditioner[[diffusers.AnimaTextConditioner]]

diffusers.AnimaTextConditioner[[diffusers.AnimaTextConditioner]]

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)

ソース

Anima が Qwen3 の隠れ状態と T5 のトークン ID を Cosmos のテキスト埋め込みにマッピングするために使用するテキストコンディショナー。

Anima は Cosmos Predict2 DiT を再利用します。モデル固有の条件付けモジュールは、この LLM アダプターのみです。このアダプターは、拡散ループの前に、学習された T5 トークン埋め込みから Qwen3 テキストエンコーダーの隠れ状態へクロスアテンションを行います。target_dim は条件付けモジュールの出力次元であり、transformer の text_embed_dim と一致する必要があります。

forward[[diffusers.AnimaTextConditioner.forward]]

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)

ソース

パラメータ:

source_hidden_states (torch.Tensor、shape (batch_size, source_sequence_length, source_dim)) : 条件付けに使用する Qwen3 テキストエンコーダーの隠れ状態。

target_input_ids (torch.Tensor、形状 (batch_size, target_sequence_length)) : 学習済みクエリトークンとして使用される T5 のトークン ID。

target_attention_mask (torch.Tensor, 任意) : ターゲットの T5 トークン ID 用のアテンションマスク。

source_attention_mask (torch.Tensor, 任意) : ソースの Qwen3 隠れ状態用のアテンションマスク。

戻り値: torch.Tensor

Cosmos transformer用のテキスト条件付け埋め込み。

Xet Storage Details

Size:
7.27 kB
·
Xet hash:
a29819ffc0593ab4649d8d9a21272657357b5be7f1ffc7233ad1de05fe045ee3

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