Download inference_code/inference/model/vae2_2/vae2_2_model.py from Agnes-AI/Agnes-Video-2.0-MoE: direct link, hf CLI and curl.
- Browser
- Download file 445 Bytes
-
https://huggingface.co/Agnes-AI/Agnes-Video-2.0-MoE/resolve/main/inference_code/inference/model/vae2_2/vae2_2_model.py
- Command line
-
hf download hf://Agnes-AI/Agnes-Video-2.0-MoE/inference_code/inference/model/vae2_2/vae2_2_model.py
-
curl -L -o vae2_2_model.py https://huggingface.co/Agnes-AI/Agnes-Video-2.0-MoE/resolve/main/inference_code/inference/model/vae2_2/vae2_2_model.py
445 Bytes
| import gc | |
| import torch | |
| from .vae2_2_module import Wan2_2_VAE | |
| def get_vae2_2(model_path, device="cuda", weight_dtype=torch.float32) -> Wan2_2_VAE: | |
| vae = Wan2_2_VAE(vae_pth=model_path, device=device).to(device).to(weight_dtype) | |
| vae.vae.requires_grad_(False) | |
| vae.vae.eval() | |
| gc.collect() | |
| if torch.cuda.is_available(): | |
| torch.cuda.empty_cache() | |
| return vae | |
| __all__ = ["Wan2_2_VAE", "get_vae2_2"] | |