HuggingFaceCrossEncoder#
- class langchain_community.cross_encoders.huggingface.HuggingFaceCrossEncoder[source]#
Bases:
BaseModel
,BaseCrossEncoder
HuggingFace cross encoder models.
Example
from langchain_community.cross_encoders import HuggingFaceCrossEncoder model_name = "BAAI/bge-reranker-base" model_kwargs = {'device': 'cpu'} hf = HuggingFaceCrossEncoder( model_name=model_name, model_kwargs=model_kwargs )
Initialize the sentence_transformer.
- param model_kwargs: Dict[str, Any] [Optional]#
Keyword arguments to pass to the model.
- param model_name: str = 'BAAI/bge-reranker-base'#
Model name to use.
Examples using HuggingFaceCrossEncoder