During generation, decide whether to pass the `past` variable to the next forward pass.
(self, outputs, use_cache)
| 808 | return logits |
| 809 | |
| 810 | def _use_cache(self, outputs, use_cache): |
| 811 | """During generation, decide whether to pass the `past` variable to the next forward pass.""" |
| 812 | if len(outputs) <= 1 or use_cache is False: |
| 813 | return False |
| 814 | if hasattr(self.config, "mem_len") and self.config.mem_len == 0: |
| 815 | return False |
| 816 | return True |
| 817 | |
| 818 | def enforce_repetition_penalty_(self, lprobs, batch_size, num_beams, prev_output_tokens, repetition_penalty): |
| 819 | """repetition penalty (from CTRL paper https://arxiv.org/abs/1909.05858). """ |
no outgoing calls
no test coverage detected