(self, prompt: str, stop: Optional[List[str]] = None)
| 21 | return self.model_name |
| 22 | |
| 23 | def _call(self, prompt: str, stop: Optional[List[str]] = None) -> str: |
| 24 | |
| 25 | inputs = self.tokenizer( |
| 26 | prompt, |
| 27 | padding=True, |
| 28 | max_length=self.tokenizer.model_max_length, |
| 29 | truncation=True, |
| 30 | return_tensors="pt" |
| 31 | ) |
| 32 | |
| 33 | # inputs_len = inputs["input_ids"].shape[1] |
| 34 | |
| 35 | generated_outputs = self.model.generate( |
| 36 | inputs["input_ids"], |
| 37 | max_new_tokens=512, |
| 38 | ) |
| 39 | decoded_output = self.tokenizer.batch_decode( |
| 40 | generated_outputs, skip_special_tokens=True, clean_up_tokenization_spaces=False) |
| 41 | |
| 42 | output = decoded_output[0] |
| 43 | return output |
| 44 | |
| 45 | |
| 46 | @property |
nothing calls this directly
no outgoing calls
no test coverage detected