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

Method detect_embedding_model

examples/server/server.py:11883–11897  ·  view source on GitHub ↗
(cls, llama_model: Any)

Source from the content-addressed store, hash-verified

11881
11882 @classmethod
11883 def detect_embedding_model(cls, llama_model: Any) -> bool:
11884 for index in range(int(llama_cpp.llama_model_meta_count(llama_model))):
11885 key = cls._model_meta_key_by_index(llama_model, index)
11886 if key is None or not key.endswith(".pooling_type"):
11887 continue
11888 value = cls._model_meta_value(llama_model, key)
11889 if value is None:
11890 continue
11891 pooling_type = cls._parse_pooling_type(value)
11892 return pooling_type in {
11893 llama_cpp.LLAMA_POOLING_TYPE_MEAN,
11894 llama_cpp.LLAMA_POOLING_TYPE_CLS,
11895 llama_cpp.LLAMA_POOLING_TYPE_LAST,
11896 }
11897 return False
11898
11899 @classmethod
11900 def resolve_embedding_mode(

Callers 1

Calls 3

_model_meta_valueMethod · 0.80
_parse_pooling_typeMethod · 0.80

Tested by

no test coverage detected