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

Method _encode_media_chunks

examples/server/server.py:10921–10932  ·  view source on GitHub ↗
(
        self,
        media_chunks: Sequence["MTMDProcessor.MediaChunk"],
    )

Source from the content-addressed store, hash-verified

10919 mtmd_cpp.mtmd_batch_free(batch)
10920
10921 def _encode_media_chunks(
10922 self,
10923 media_chunks: Sequence["MTMDProcessor.MediaChunk"],
10924 ) -> None:
10925 uncached = [
10926 media_chunk
10927 for media_chunk in media_chunks
10928 if not self._load_cached_media_chunk(media_chunk)
10929 ]
10930 index = 0
10931 while index < len(uncached):
10932 index += self._encode_media_batch(uncached, index)
10933
10934 def _positions_for_chunk(self, chunk: Any, start_pos: int) -> np.ndarray:
10935 n_tokens = int(mtmd_cpp.mtmd_input_chunk_get_n_tokens(chunk))

Callers 1

Calls 2

_encode_media_batchMethod · 0.95

Tested by

no test coverage detected