MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / _generate

Method _generate

deepspeed/inference/engine.py:620–635  ·  view source on GitHub ↗
(self, *inputs, **kwargs)

Source from the content-addressed store, hash-verified

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)

Callers 1

generateMethod · 0.80

Calls 2

reset_cacheMethod · 0.80
generateMethod · 0.80

Tested by

no test coverage detected