langchain_community.cross_encoders.huggingface
.HuggingFaceCrossEncoder¶
- class langchain_community.cross_encoders.huggingface.HuggingFaceCrossEncoder¶
基础类:
BaseModel
,BaseCrossEncoder
HuggingFace 交叉编码器模型。
示例
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 )
初始化 sentence_transformer。
- param model_kwargs: Dict[str, Any] [Optional]¶
传递给模型的参数。
- param model_name: str = 'BAAI/bge-reranker-base'¶
要使用的模型名称。