MCPcopy Create free account
hub / github.com/CompVis/zigma / forward

Method forward

datasets/clip.py:31–45  ·  view source on GitHub ↗
(self, text)

Source from the content-addressed store, hash-verified

29 param.requires_grad = False
30
31 def forward(self, text):
32 batch_encoding = self.tokenizer(
33 text,
34 truncation=True,
35 max_length=self.max_length,
36 return_length=True,
37 return_overflowing_tokens=False,
38 padding="max_length",
39 return_tensors="pt",
40 )
41 tokens = batch_encoding["input_ids"].to(self.device)
42 outputs = self.transformer(input_ids=tokens)
43
44 z = outputs.last_hidden_state
45 return z
46
47 def encode(self, text):
48 return self(text)

Callers

nothing calls this directly

Calls 1

toMethod · 0.80

Tested by

no test coverage detected