| 563 | return prompt + ":" |
| 564 | |
| 565 | def generate_chatml(self, prompt: str, data: Union[str, torch.Tensor]): |
| 566 | if isinstance(data, str): |
| 567 | return [ |
| 568 | {"role": "system", "content": "You are a helpful assistant."}, |
| 569 | {"role": "user", "content": f"{prompt}<|startofspeech|>!{data}<|endofspeech|>"}, |
| 570 | {"role": "assistant", "content": "null"}, |
| 571 | ] |
| 572 | elif isinstance(data, torch.Tensor): |
| 573 | return [ |
| 574 | {"role": "system", "content": "You are a helpful assistant."}, |
| 575 | { |
| 576 | "role": "user", |
| 577 | "content": f"{prompt}<|startofspeech|>!!<|endofspeech|>", |
| 578 | "audio": data, |
| 579 | }, |
| 580 | {"role": "assistant", "content": "null"}, |
| 581 | ] |
| 582 | |
| 583 | def inference( |
| 584 | self, |