(self, *inputs, **kwargs)
| 618 | return outputs |
| 619 | |
| 620 | def _generate(self, *inputs, **kwargs): |
| 621 | # Reset KV-cache at the beginning of generate |
| 622 | if hasattr(self.module, 'reset_cache'): |
| 623 | self.module.reset_cache() |
| 624 | num_beams = 1 |
| 625 | if "generation_config" in kwargs: |
| 626 | gen_config = kwargs["generation_config"] |
| 627 | num_beams = getattr(gen_config, "num_beams", 1) |
| 628 | if "num_beams" in kwargs: |
| 629 | num_beams = kwargs["num_beams"] |
| 630 | |
| 631 | if num_beams > 1: |
| 632 | raise NotImplementedError("DeepSpeed does not support `num_beams` > 1, if this is important to you please " |
| 633 | "add your request to: https://github.com/microsoft/DeepSpeed/issues/2506") |
| 634 | |
| 635 | return self.module.generate(*inputs, **kwargs) |
no test coverage detected