(self,query)
| 21 | self.pdist = nn.PairwiseDistance(2) |
| 22 | |
| 23 | def predict_vec(self,query): |
| 24 | q_id = self.tokenizer(query, max_length = 200, truncation=True, padding="max_length", return_tensors='pt') |
| 25 | with torch.no_grad(): |
| 26 | q_id_input_ids = q_id["input_ids"].squeeze(1).to(self.DEVICE) |
| 27 | q_id_attention_mask = q_id["attention_mask"].squeeze(1).to(self.DEVICE) |
| 28 | q_id_token_type_ids = q_id["token_type_ids"].squeeze(1).to(self.DEVICE) |
| 29 | q_id_pred = self.model(q_id_input_ids, q_id_attention_mask, q_id_token_type_ids) |
| 30 | |
| 31 | return q_id_pred |
| 32 | |
| 33 | def predict_vec_request(self, query): |
| 34 | q_id_pred = self.predict_vec(query) |
no outgoing calls
no test coverage detected