(self, filename, dtype=torch.float16, alpha=300.0, *args, **kwargs)
| 413 | |
| 414 | class TransparentVAEEncoder(torch.nn.Module): |
| 415 | def __init__(self, filename, dtype=torch.float16, alpha=300.0, *args, **kwargs): |
| 416 | super().__init__(*args, **kwargs) |
| 417 | sd = sf.load_file(filename) |
| 418 | self.dtype = dtype |
| 419 | |
| 420 | model = LatentTransparencyOffsetEncoder() |
| 421 | model.load_state_dict(sd, strict=True) |
| 422 | model.to(dtype=self.dtype) |
| 423 | model.eval() |
| 424 | |
| 425 | self.model = model |
| 426 | |
| 427 | # similar to LoRA's alpha to avoid initial zero-initialized outputs being too small |
| 428 | self.alpha = alpha |
| 429 | return |
| 430 | |
| 431 | @torch.no_grad() |
| 432 | def forward(self, sd_vae, list_of_np_rgba_hwc_uint8, use_offset=True): |
nothing calls this directly
no test coverage detected