模型:
sentence-transformers/LaBSE
任务:
句子相似度许可:
apache-2.0这是将 LaBSE 模型转换为PyTorch的端口。它可用于将109种语言映射到共享的向量空间。
在安装了 sentence-transformers 之后,使用该模型变得很简单:
pip install -U sentence-transformers
然后,您可以像这样使用该模型:
from sentence_transformers import SentenceTransformer sentences = ["This is an example sentence", "Each sentence is converted"] model = SentenceTransformer('sentence-transformers/LaBSE') embeddings = model.encode(sentences) print(embeddings)
要对该模型进行自动化评估,请参见句子嵌入基准(Sentence Embeddings Benchmark): https://seb.sbert.net
SentenceTransformer( (0): Transformer({'max_seq_length': 256, 'do_lower_case': False}) with Transformer model: BertModel (1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': True, 'pooling_mode_mean_tokens': False, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False}) (2): Dense({'in_features': 768, 'out_features': 768, 'bias': True, 'activation_function': 'torch.nn.modules.activation.Tanh'}) (3): Normalize() )
请查看 LaBSE 以获取描述LaBSE的相关出版物。