FlagAutoReranker#
- class FlagEmbedding.inference.FlagAutoReranker[source]#
Automatically choose the appropriate class to load the reranker model.
Methods#
- classmethod FlagAutoReranker.from_finetuned(model_name_or_path: str, model_class: str | RerankerModelClass | None = None, use_fp16: bool = False, trust_remote_code: bool | None = None, **kwargs)[source]#
Load a finetuned model according to the provided vars.
- Parameters:
model_name_or_path (str) – If it’s a path to a local model, it loads the model from the path. Otherwise tries to download and load a model from HuggingFace Hub with the name.
model_class (Optional[Union[str, RerankerModelClass]], optional) – The reranker class to use.. Defaults to
None
.use_fp16 (bool, optional) – If true, use half-precision floating-point to speed up computation with a slight performance degradation. Defaults to
False
.trust_remote_code (Optional[bool], optional) – trust_remote_code for HF datasets or models. Defaults to
None
.
- Raises:
ValueError –
- Returns:
The reranker class to load model, which is child class of
AbsReranker
.- Return type: