• Teriks's avatar
    Fix SD2.X clip single file load projection_dim (#10770) · 9e910c46
    Teriks authored
    
    
    * Fix SD2.X clip single file load projection_dim
    
    Infer projection_dim from the checkpoint before loading
    from pretrained, override any incorrect hub config.
    
    Hub configuration for SD2.X specifies projection_dim=512
    which is incorrect for SD2.X checkpoints loaded from civitai
    and similar.
    
    Exception was previously thrown upon attempting to
    load_model_dict_into_meta for SD2.X single file checkpoints.
    
    Such LDM models usually require projection_dim=1024
    
    * convert_open_clip_checkpoint use hidden_size for text_proj_dim
    
    * convert_open_clip_checkpoint, revert checkpoint[text_proj_key].shape[1] -> [0]
    
    values are identical
    
    ---------
    Co-authored-by: default avatarTeriks <Teriks@users.noreply.github.com>
    Co-authored-by: default avatarDhruv Nair <dhruv.nair@gmail.com>
    9e910c46
single_file_utils.py 122 KB