Buckets:

mishig's picture
|
download
raw
6.78 kB

Apache License, Version 2.0("라이선스")에 따라 라이선스가 부여됩니다.

이 파일은 라이선스에 따라만 사용할 수 있습니다.

라이선스 사본은 다음에서 가져올 수 있습니다

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

적용 가능한 법률에 의해 요구되거나 서면으로 합의되지 않는 한, 소프트웨어

라이선스에 따라 배포되는 본 소프트웨어는 "있는 그대로"

명시적이든 묵시적이든 어떠한 종류의 보증이나 조건도 없이 제공됩니다.

권한을 관리하는 특정 언어에 대한 라이선스를 참조하세요

라이선스 하의 제한 사항. -->

Anima

Anima는 Qwen3 텍스트 인코더, T5-token 텍스트 컨디셔너, AutoencoderKLQwenImage VAE와 함께 CosmosTransformer3DModel을 재사용하는 텍스트-이미지 생성 모델입니다.

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)

Inputs: prompt (str): 이미지 생성을 안내할 프롬프트입니다. negative_prompt (str, 선택 사항): 이미지 생성을 안내하지 않을 프롬프트입니다. max_sequence_length (int, 선택 사항, 기본값 512): 프롬프트 인코딩을 위한 최대 시퀀스 길이입니다. image (Image | list, 선택 사항): 디노이징을 위한 참조 이미지입니다. 단일 이미지 또는 이미지 목록일 수 있습니다. height (int, 선택 사항): 생성된 이미지의 픽셀 단위 높이입니다. width (int, 선택 사항): 생성된 이미지의 픽셀 단위 너비입니다. generator (Generator, 선택 사항): 결정론적 생성을 위한 Torch generator입니다. num_images_per_prompt (int, 선택 사항, 기본값 1): 프롬프트당 생성할 이미지의 수입니다. image_latents (Tensor, 선택 사항): 이미지 생성을 안내하는 데 사용되는 이미지 latents입니다. vae_encoder 단계에서 생성할 수 있습니다. num_inference_steps (int): 디노이징 단계의 수입니다. sigmas (list, 선택 사항): 디노이징 프로세스를 위한 사용자 지정 sigmas입니다. strength (float, 선택 사항, 기본값 0.9): img2img/inpainting의 강도입니다. latents (Tensor): 이미지 생성을 위한 사전 생성된 노이즈 latents입니다. **denoiser_input_fields (None, 선택 사항): Anima denoiser의 조건부 모델 입력입니다. 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 어댑터이며, diffusion 루프 전에 학습된 T5 토큰 임베딩에서 Qwen3 텍스트 인코더의 hidden states로 cross-attention을 수행합니다. target_dim은 conditioner의 출력 차원이며 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 텍스트 인코더 hidden states.

target_input_ids (torch.Tensor, shape (batch_size, target_sequence_length)) : 학습된 쿼리 토큰으로 사용되는 T5 토큰 ID입니다.

target_attention_mask (torch.Tensor, 선택 사항) : 대상 T5 토큰 ID에 대한 어텐션 마스크입니다.

source_attention_mask (torch.Tensor, 선택 사항) : 소스 Qwen3 hidden states에 대한 attention mask입니다.

반환값: torch.Tensor

Cosmos transformer의 텍스트 조건화 임베딩.

Xet Storage Details

Size:
6.78 kB
·
Xet hash:
c480f354d30722c2a8f3fc9d31842f68c9ed5731f337eccd1fabc51583a122ef

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