Check whether the output contains a partial stop str.
(output: str, stop_str: str)
| 11 | |
| 12 | |
| 13 | def is_partial_stop(output: str, stop_str: str): |
| 14 | """Check whether the output contains a partial stop str.""" |
| 15 | for i in range(0, min(len(output), len(stop_str))): |
| 16 | if stop_str.startswith(output[-i:]): |
| 17 | return True |
| 18 | return False |
| 19 | |
| 20 | |
| 21 | @torch.inference_mode() |
no outgoing calls
no test coverage detected