(self)
| 420 | self.logger.info("Loading Encoder Models...") |
| 421 | |
| 422 | # T5 Text Encoder |
| 423 | text_encoders = load_wan_text_encoder(self.config) |
| 424 | self.text_encoder = text_encoders[0] if text_encoders else None |
| 425 | |
| 426 | # CLIP Image Encoder (Optional per usage in wan_i2v.py) |
| 427 | if self.config.get("use_image_encoder", False): |
| 428 | self.image_encoder = load_wan_image_encoder(self.config) |
| 429 | |
| 430 | # VAE Encoder (Required for I2V) |
| 431 | # Note: wan_i2v.py logic: if vae_encoder is None: raise RuntimeError |
| 432 | # But we only load if needed or always? Let's check the config flags. |
| 433 | # It seems always loaded for I2V task, but might be offloaded. |
| 434 | # For simplicity of this service, we load it if the task implies it or just try to load. |
| 435 | # But `load_wan_vae_encoder` will look at the config. |
| 436 | self.vae_encoder = load_wan_vae_encoder(self.config) |
| 437 | |
| 438 | self.logger.info("Encoder Models loaded successfully.") |
| 439 | |
| 440 | def _get_latent_shape_with_lat_hw(self, latent_h, latent_w): |
| 441 | return [ |
| 442 | self.config.get("num_channels_latents", 16), |
| 443 | (get_input_value(self.config, "num_frames") - 1) // self.config["vae_stride"][0] + 1, |
| 444 | latent_h, |
no test coverage detected