MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / _common_prefix_len

Method _common_prefix_len

examples/server/server.py:822–831  ·  view source on GitHub ↗
(
        label: Sequence[int],
        tokens: Sequence[int],
        offset: int,
    )

Source from the content-addressed store, hash-verified

820
821 @staticmethod
822 def _common_prefix_len(
823 label: Sequence[int],
824 tokens: Sequence[int],
825 offset: int,
826 ) -> int:
827 limit = min(len(label), len(tokens) - offset)
828 match_len = 0
829 while match_len < limit and label[match_len] == tokens[offset + match_len]:
830 match_len += 1
831 return match_len
832
833 def _split_child(
834 self,

Callers 2

extendMethod · 0.95
longest_prefixMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected