mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-04-30 19:21:21 +00:00
Intergrate CLIP
This commit is contained in:
11
backend/nn/clip.py
Normal file
11
backend/nn/clip.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import torch
|
||||
|
||||
from transformers import CLIPTextModel, CLIPTextConfig
|
||||
|
||||
|
||||
class IntegratedCLIP(torch.nn.Module):
|
||||
def __init__(self, config: CLIPTextConfig):
|
||||
super().__init__()
|
||||
self.transformer = CLIPTextModel(config)
|
||||
self.text_projection = torch.nn.Parameter(torch.eye(self.transformer.get_input_embeddings().weight.shape[1]))
|
||||
self.logit_scale = torch.nn.Parameter(torch.tensor(4.6055))
|
||||
Reference in New Issue
Block a user