MCPcopy Create free account
hub / github.com/NVlabs/RADIO / encode_text

Method encode_text

examples/common/model_loader.py:183–190  ·  view source on GitHub ↗
(self, text, normalize: bool = False)

Source from the content-addressed store, hash-verified

181 return self._wrap_output(summary, features)
182
183 def encode_text(self, text, normalize: bool = False):
184 output = self.inner.text_model(**text, return_dict=True)
185 token = output.pooler_output
186
187 if normalize:
188 token = F.normalize(token, dim=-1)
189
190 return token
191
192 def zero_shot_postproc(self, logits: torch.Tensor):
193 logit_scale, logit_bias = self.inner.logit_scale.to(logits.device), self.inner.logit_bias.to(logits.device)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected