(txts)
| 84 | else: |
| 85 | with torch.no_grad(): |
| 86 | def extract_mean_emb(txts): |
| 87 | tokens = self.tokenizer( |
| 88 | txts, padding='max_length', truncation=True, max_length=self.max_token_num, return_tensors='pt' |
| 89 | ) |
| 90 | clss_embedding = self.forward_language((tokens['input_ids'].cuda(), tokens['attention_mask'].cuda()), norm=norm) |
| 91 | clss_embedding = clss_embedding.mean(dim=0) |
| 92 | clss_embedding /= clss_embedding.norm() |
| 93 | return clss_embedding |
| 94 | |
| 95 | templates = get_prompt_templates() |
| 96 | clss_embeddings = [] |
nothing calls this directly
no test coverage detected