(prev_tokens, tokens)
| 872 | banned_tokens = [] |
| 873 | |
| 874 | def _tokens_match(prev_tokens, tokens): |
| 875 | if len(tokens) == 0: |
| 876 | # if bad word tokens is just one token always ban it |
| 877 | return True |
| 878 | if len(tokens) > len(prev_input_ids): |
| 879 | # if bad word tokens are longer then prev input_ids they can't be equal |
| 880 | return False |
| 881 | |
| 882 | if prev_tokens[-len(tokens) :] == tokens: |
| 883 | # if tokens match |
| 884 | return True |
| 885 | else: |
| 886 | return False |
| 887 | |
| 888 | for prev_input_ids_slice in prev_input_ids: |
| 889 | banned_tokens_slice = [] |
no outgoing calls
no test coverage detected