Buckets:
| # | |
| # Apache License, Version 2.0("라이선스")에 따라 라이선스가 부여됩니다. | |
| # 이 파일은 라이선스에 따라만 사용할 수 있습니다. | |
| # 라이선스 사본은 다음에서 가져올 수 있습니다 | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # 적용 가능한 법률에 의해 요구되거나 서면으로 합의되지 않는 한, 소프트웨어 | |
| # 라이선스에 따라 배포되는 본 소프트웨어는 "있는 그대로" | |
| # 명시적이든 묵시적이든 어떠한 종류의 보증이나 조건도 없이 제공됩니다. | |
| # 권한을 관리하는 특정 언어에 대한 라이선스를 참조하세요 | |
| # 라이선스 하의 제한 사항. --> | |
| # Wan-Animate-2 | |
| Alibaba Wan Team의 [Wan-Animate-2](https://github.com/Wan-Video/Wan2.2)는 구동 비디오의 움직임으로 참조 캐릭터 이미지를 애니메이션화합니다. 구동 비디오는 고정 길이의 세그먼트로 처리됩니다. 각 세그먼트는 모든 transformer 레이어에서 해당 구동 세그먼트의 K/V를 캐시에 저장하는 참조 추출 패스를 실행하고, 해당 캐시를 기준으로 디노이즈하며, 다음 세그먼트가 이전 세그먼트의 디코딩된 테일 프레임에 조건부 의존하기 때문에 루프 내에서 디코딩됩니다. | |
| 두 가지 프리셋이 제공됩니다. base 체크포인트는 classifier-free guidance를 사용하여 샘플링하고, distilled 체크포인트는 이를 사용하지 않고 몇 단계 만에 샘플링합니다(그 guider는 `guidance_scale=1.0`으로 고정되어 있습니다). | |
| ```python | |
| import torch | |
| from diffusers import ModularPipeline | |
| from diffusers.utils import export_to_video, load_image, load_video | |
| pipe = ModularPipeline.from_pretrained("Wan-AI/Wan2.2-Animate-2-14B-Diffusers") | |
| pipe.load_components(dtype=torch.bfloat16) | |
| # The transformer weights and the per-segment reference KV cache do not co-reside on one 80 GB | |
| # card at the default resolution, so stream the transformer's blocks. Compiling the blocks is | |
| # required as the in-context attention runs on the flex backend | |
| pipe.transformer.enable_group_offload( | |
| onload_device=torch.device("cuda"), | |
| offload_device=torch.device("cpu"), | |
| offload_type="block_level", | |
| use_stream=True, | |
| ) | |
| pipe.text_encoder.to("cuda") # or "mps", "xpu", "cpu" | |
| pipe.image_encoder.to("cuda") | |
| pipe.vae.to("cuda") | |
| pipe.transformer.compile_repeated_blocks(fullgraph=False) | |
| # The first demo from the official repository: https://github.com/Wan-Video/Wan-Animate-2 | |
| demo = "https://raw.githubusercontent.com/Wan-Video/Wan-Animate-2/main/examples/demo1" | |
| image = load_image(f"{demo}/reference.png") | |
| driving_video, driving_video_fps = load_video(f"{demo}/template.mp4", return_fps=True) | |
| prompt = "人物外观描述:一只银灰色虎斑纹的小猫,拥有圆润的脸庞、竖立的耳朵和巨大的圆形眼睛。它身穿一套深蓝色的制服套装,包括一件带有金色纽扣的西装外套和一条百褶裙。外套里面搭配着白色衬衫,领口处系着一个红色的蝴蝶结,袖口露出白色的衬衫边缘。背景描述:背景为纯白色,光线均匀明亮,无其他杂物或装饰。" | |
| videos = pipe( | |
| image=image, | |
| driving_video=driving_video, | |
| driving_video_fps=driving_video_fps, | |
| prompt=prompt, | |
| output="videos", | |
| ) | |
| export_to_video(videos[0], "output.mp4", fps=24) | |
| ``` | |
| 디스틸된 체크포인트의 경우 `Wan-AI/Wan2.2-Animate-2-14B-Distilled-Diffusers`도 동일한 방식으로 로드하면 됩니다. 그 외에는 변경 사항이 없습니다. 각 프리셋은 자체 샘플링 기본값을 포함하며(기본 체크포인트는 40단계, 디스틸된 체크포인트는 10단계), `guidance_scale` 인수는 어디에도 존재하지 않습니다. 가이던스는 파이프라인의 guider 구성 요소가 담당하며, 기본 프리셋의 경우 3.0의 classifier-free guidance를 사용하고 디스틸된 프리셋의 경우 비활성화되어 있습니다. | |
| `height`와 `width`(기본값 800, 640)는 생성된 비디오의 *영역*을 설정합니다. 실제 프레임 크기는 참조 이미지의 종횡비를 유지하며, 구동 프레임은 해당 크기에 맞게 letterbox 처리됩니다. 이미 대상 letterbox 크기에 해당하는 입력은 전처리 과정에서 변경되지 않고 그대로 통과하므로, 전처리를 파이프라인 외부에서 완전히 수행할 수도 있습니다. | |
| ## WanAnimate2ModularPipeline[[diffusers.WanAnimate2ModularPipeline]] | |
| #### diffusers.WanAnimate2ModularPipeline[[diffusers.WanAnimate2ModularPipeline]] | |
| ```python | |
| diffusers.WanAnimate2ModularPipeline(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) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/wan_animate_2/modular_pipeline.py#L23) | |
| Wan-Animate-2 캐릭터 애니메이션을 위한 ModularPipeline입니다. | |
| ## WanAnimate2DistilledModularPipeline[[diffusers.WanAnimate2DistilledModularPipeline]] | |
| #### diffusers.WanAnimate2DistilledModularPipeline[[diffusers.WanAnimate2DistilledModularPipeline]] | |
| ```python | |
| diffusers.WanAnimate2DistilledModularPipeline(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) | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/wan_animate_2/modular_pipeline.py#L62) | |
| Classifier-free guidance 없이 적은 단계로 샘플링하는 distilled Wan-Animate-2 모델용 ModularPipeline입니다. | |
| ## WanAnimate2Blocks[[diffusers.WanAnimate2Blocks]] | |
| #### diffusers.WanAnimate2Blocks[[diffusers.WanAnimate2Blocks]] | |
| ```python | |
| diffusers.WanAnimate2Blocks() | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/wan_animate_2/modular_blocks_wan_animate_2.py#L252) | |
| Wan-Animate-2 캐릭터 애니메이션을 위한 모듈형 파이프라인 블록: 참조 캐릭터 이미지와 구동 비디오를 입력하면, 구동 동작을 따르는 캐릭터의 비디오가 생성됩니다. | |
| 구성 요소: text_encoder (`UMT5EncoderModel`) tokenizer (`AutoTokenizer`) image_processor (`WanAnimate2VideoProcessor`) image_encoder (`CLIPVisionModel`) video_processor (`WanAnimate2VideoProcessor`) vae (`AutoencoderKLWan`) transformer (`WanAnimate2Transformer3DModel`) scheduler (`SchedulerMixin`) guider (`ClassifierFreeGuidance`) | |
| 입력: prompt (`str`): 이미지 생성을 안내할 프롬프트입니다. negative_prompt (`str`, *선택 사항*): 이미지 생성을 안내하지 않을 프롬프트입니다. prompt_ref (`str`, *선택 사항*, 기본값 人物动作的参考视频): 구동 비디오 컨텍스트를 위한 참조 프롬프트입니다. max_sequence_length (`int`, *선택 사항*, 기본값 512): 프롬프트 인코딩을 위한 최대 시퀀스 길이입니다. image (`Image | list`): 애니메이션 처리할 캐릭터를 포함하는 참조 이미지입니다. height (`int`, *선택 사항*, 기본값 800): `width`와 함께 생성된 비디오의 대상 *영역*을 결정합니다. 종횡비는 `image`에서 가져옵니다. 해석된 프레임 높이로 덮어쓰기됩니다. width (`int`, *선택 사항*, 기본값 640): `height`를 참조하세요. 해석된 프레임 너비로 덮어쓰기됩니다. driving_video (`list`): `VideoProcessor.preprocess_video`가 허용하는 모든 형식의 모션을 제공하는 구동 비디오입니다. driving_video_fps (`float`, *선택 사항*): `driving_video`가 캡처된 프레임 레이트입니다. `load_video(..., return_fps=True)`가 이를 보고합니다. 설정된 경우, 구동 프레임은 `fps`로 재샘플링됩니다. `None`인 경우 그대로 사용됩니다. fps (`int`, *선택 사항*, 기본값 24): 모델이 생성하는 프레임 레이트입니다. segment_frame_length (`int`, *선택 사항*, 기본값 81): 각 추론 세그먼트의 프레임 수입니다. prev_segment_conditioning_frames (`int`, *선택 사항*, 기본값 1): 이전 세그먼트에서 가져오는 조건 프레임 수입니다. generator (`Generator`, *선택 사항*): 결정론적 생성을 위한 Torch 생성기입니다. num_inference_steps (`int`, *선택 사항*, 기본값 40): 디노이징 단계 수입니다. **denoiser_input_fields (`None`, *선택 사항*): 디노이저의 조건부 모델 입력입니다. 예: prompt_embeds, negative_prompt_embeds 등. output_type (`str`, *선택 사항*, 기본값 np): 디코딩된 비디오의 출력 형식입니다. | |
| Outputs: videos (`list`): 생성된 비디오. | |
| ## WanAnimate2DistilledBlocks[[diffusers.WanAnimate2DistilledBlocks]] | |
| #### diffusers.WanAnimate2DistilledBlocks[[diffusers.WanAnimate2DistilledBlocks]] | |
| ```python | |
| diffusers.WanAnimate2DistilledBlocks() | |
| ``` | |
| [소스](https://github.com/huggingface/diffusers/blob/main/src/diffusers/modular_pipelines/wan_animate_2/modular_blocks_wan_animate_2_distilled.py#L254) | |
| Classifier-free guidance 없이 몇 단계의 샘플링로 동작하는, 증류된 Wan-Animate-2 캐릭터 애니메이션을 위한 모듈형 파이프라인 블록 | |
| 구성 요소: text_encoder (`UMT5EncoderModel`) tokenizer (`AutoTokenizer`) image_processor (`WanAnimate2VideoProcessor`) image_encoder (`CLIPVisionModel`) video_processor (`WanAnimate2VideoProcessor`) vae (`AutoencoderKLWan`) transformer (`WanAnimate2Transformer3DModel`) scheduler (`SchedulerMixin`) guider (`ClassifierFreeGuidance`) | |
| 입력: prompt (`str`): 이미지 생성을 안내할 프롬프트입니다. negative_prompt (`str`, *선택 사항*): 이미지 생성을 안내하지 않을 프롬프트입니다. prompt_ref (`str`, *선택 사항*, 기본값 人物动作的参考视频): 구동 비디오 컨텍스트를 위한 참조 프롬프트입니다. max_sequence_length (`int`, *선택 사항*, 기본값 512): 프롬프트 인코딩을 위한 최대 시퀀스 길이입니다. image (`Image | list`): 애니메이션 처리할 캐릭터를 포함하는 참조 이미지입니다. height (`int`, *선택 사항*, 기본값 800): `width`와 함께 생성된 비디오의 대상 *영역*을 결정합니다. 종횡비는 `image`에서 가져옵니다. 해석된 프레임 높이로 덮어쓰기됩니다. width (`int`, *선택 사항*, 기본값 640): `height`를 참조하세요. 해석된 프레임 너비로 덮어쓰기됩니다. driving_video (`list`): `VideoProcessor.preprocess_video`가 허용하는 모든 형식의 모션을 제공하는 구동 비디오입니다. driving_video_fps (`float`, *선택 사항*): `driving_video`가 캡처된 프레임 레이트입니다. `load_video(..., return_fps=True)`가 이를 보고합니다. 설정된 경우, 구동 프레임은 `fps`로 재샘플링됩니다. `None`인 경우 그대로 사용됩니다. fps (`int`, *선택 사항*, 기본값 24): 모델이 생성하는 프레임 레이트입니다. segment_frame_length (`int`, *선택 사항*, 기본값 81): 각 추론 세그먼트의 프레임 수입니다. prev_segment_conditioning_frames (`int`, *선택 사항*, 기본값 1): 이전 세그먼트에서 가져오는 조건 프레임 수입니다. generator (`Generator`, *선택 사항*): 결정론적 생성을 위한 Torch 생성기입니다. num_inference_steps (`int`, *선택 사항*, 기본값 10): 디노이징 단계 수입니다. **denoiser_input_fields (`None`, *선택 사항*): 디노이저의 조건부 모델 입력입니다. 예: prompt_embeds, negative_prompt_embeds 등. output_type (`str`, *선택 사항*, 기본값 np): 디코딩된 비디오의 출력 형식입니다. | |
| Outputs: videos (`list`): 생성된 비디오. | |
Xet Storage Details
- Size:
- 12.3 kB
- Xet hash:
- ce2dfc08884ac486d8872a9088555fb5c32ea1355d06e6e0932c8ab79920994b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.