Skip to content

Latest commit

 

History

History
68 lines (47 loc) · 2.72 KB

文本相似度.md

File metadata and controls

68 lines (47 loc) · 2.72 KB

文本相似度 Text Similarity

计算文本之间的语义相似度。
Calculate the semantic similarity between texts.

推荐模型 Recommended Models

Erlangshen-Roberta-110M-Similarity:RoBERTa-wwm-ext-base在数个相似度任务微调后的版本。

Erlangshen-Roberta-330M-Similarity:RoBERTa-wwm-ext-large在数个相似度任务微调后的版本。

Erlangshen-MegatronBert-1.3B-Similarity:2021年登顶FewCLUE和ZeroCLUE的中文BERT,在数个情感分析任务微调后的版本。

下游效果 Performance

Model BQ BUSTM AFQMC
Erlangshen-Roberta-110M-Similarity 85.41 95.18 81.72
Erlangshen-Roberta-330M-Similarity 86.21 99.29 93.89
Erlangshen-MegatronBert-1.3B-Similarity 86.31 - -

使用 Usage

from transformers import BertForSequenceClassification
from transformers import BertTokenizer
import torch

tokenizer=BertTokenizer.from_pretrained('IDEA-CCNL/Erlangshen-Roberta-110M-Similarity')
model=BertForSequenceClassification.from_pretrained('IDEA-CCNL/Erlangshen-Roberta-110M-Similarity')

texta='今天的饭不好吃'
textb='今天心情不好'

output=model(torch.tensor([tokenizer.encode(texta,textb)]))
print(torch.nn.functional.softmax(output.logits,dim=-1))

引用 Citation

如果您在您的工作中使用了我们的模型,可以引用我们的论文

If you are using the resource for your work, please cite the our paper:

@article{fengshenbang,
  author    = {Junjie Wang and Yuxiang Zhang and Lin Zhang and Ping Yang and Xinyu Gao and Ziwei Wu and Xiaoqun Dong and Junqing He and Jianheng Zhuo and Qi Yang and Yongfeng Huang and Xiayu Li and Yanghan Wu and Junyu Lu and Xinyu Zhu and Weifeng Chen and Ting Han and Kunhao Pan and Rui Wang and Hao Wang and Xiaojun Wu and Zhongshen Zeng and Chongpei Chen and Ruyi Gan and Jiaxing Zhang},
  title     = {Fengshenbang 1.0: Being the Foundation of Chinese Cognitive Intelligence},
  journal   = {CoRR},
  volume    = {abs/2209.02970},
  year      = {2022}
}

也可以引用我们的网站:

You can also cite our website:

@misc{Fengshenbang-LM,
  title={Fengshenbang-LM},
  author={IDEA-CCNL},
  year={2021},
  howpublished={\url{https://github.com/IDEA-CCNL/Fengshenbang-LM}},
}