MCPcopy Create free account
hub / github.com/Monalissaa/DisenDiff / __init__

Method __init__

src/custom_modules.py:227–240  ·  view source on GitHub ↗
(self, modifier_token, version="openai/clip-vit-large-patch14", device="cuda", max_length=77)

Source from the content-addressed store, hash-verified

225class FrozenCLIPEmbedderWrapper(AbstractEncoder):
226 """Uses the CLIP transformer encoder for text (from Hugging Face)"""
227 def __init__(self, modifier_token, version="openai/clip-vit-large-patch14", device="cuda", max_length=77):
228 super().__init__()
229 self.tokenizer = CLIPTokenizer.from_pretrained(version)
230 self.transformer = CLIPTextModel.from_pretrained(version)
231 self.device = device
232 self.max_length = max_length
233 self.modifier_token = modifier_token
234 if '+' in self.modifier_token:
235 self.modifier_token = self.modifier_token.split('+')
236 else:
237 self.modifier_token = [self.modifier_token]
238
239 self.add_token()
240 self.freeze()
241
242 def add_token(self):
243 self.modifier_token_id = []

Callers

nothing calls this directly

Calls 3

add_tokenMethod · 0.95
freezeMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected