(self, text)
| 239 | param.requires_grad = False |
| 240 | |
| 241 | def forward(self, text): |
| 242 | dev = next(self.parameters()).device |
| 243 | batch_encoding = self.tokenizer(text, truncation=True, max_length=self.max_length, return_length=True, |
| 244 | return_overflowing_tokens=False, padding="max_length", return_tensors="pt") |
| 245 | tokens = batch_encoding["input_ids"].to(dev) |
| 246 | outputs = self.transformer(input_ids=tokens) |
| 247 | |
| 248 | z = outputs.last_hidden_state |
| 249 | return z |
| 250 | |
| 251 | def encode(self, text): |
| 252 | return self(text) |
nothing calls this directly
no outgoing calls
no test coverage detected