Team Ai
Apppublic

modelscope/DiffSynth-Painter

sourceHugging Faceapache-2.0updated 2y agoView on Hugging Face
14likes
sdxl_vae_encoder.py25 linesDownload Raw Back to models
1from .sd_vae_encoder import SDVAEEncoderStateDictConverter, SDVAEEncoder2 3 4class SDXLVAEEncoder(SDVAEEncoder):5    def __init__(self, upcast_to_float32=True):6        super().__init__()7        self.scaling_factor = 0.130258    9    @staticmethod10    def state_dict_converter():11        return SDXLVAEEncoderStateDictConverter()12 13 14class SDXLVAEEncoderStateDictConverter(SDVAEEncoderStateDictConverter):15    def __init__(self):16        super().__init__()17 18    def from_diffusers(self, state_dict):19        state_dict = super().from_diffusers(state_dict)20        return state_dict, {"upcast_to_float32": True}21    22    def from_civitai(self, state_dict):23        state_dict = super().from_civitai(state_dict)24        return state_dict, {"upcast_to_float32": True}25