svjack
Sbert-ChineseExample
Python

Sentence-Transformers Information Retrieval example on Chinese

Last updated Aug 7, 2025
30
Stars
6
Forks
0
Issues
0
Stars/day
Attention Score
14
Language breakdown
Python 100.0%
Files click to expand
README


Sbert-ChineseExample

Sentence-Transformers 中文信息检索例子


In English

内容提要

关于这个工程

About The Project

Sentence Transformers是一个多语言、多模态句子向量生成框架,可以根据Huggingface Transformers框架简单地生成句子及文本段落的分布式向量表征。

这个工程的目的是通过训练biencoder和crossencoder实现类似于ms_macro任务的中文数据集信息检索,并搭配定制化的pandas形式的elasticsearch接口使得结果产出(文本、向量)可以方便地序列化。

构建信息

Built With

开始

Getting Started

安装

Installation

  • pip
pip install -r requirements.txt
  • 安装Elasticsearch并启动服务
  • install Elasticsearch and start service

使用

Usage

2. biencoder 数据准备

3. 训练 biencoder

4. cross_encoder 训练数据准备

5. crossencoder 检测数据准备

6. 训练 cross_encoder

7. 展示 biencoder crossencoder 的推断过程

引导

Roadmap


  • 1 这个工程使用自定义的 es-pandas 的重载接口 (支持向量存储) 来使用pandas对于elasticsearch实现简单的操作。

  • 2 trysbertneg_sampler.py 抽取困难样本(模型识别困难的样本)的功能来自于
https://guzpenha.github.io/transformer_rankers/, 也可以使用 elasticsearch 生成困难样本, 相应的功能在 validcrossencoderonbi_encoder.py 中定义。
  • 3 上面在 cross_encoder 上训练的功能, 需要预先在不同的句子间检查语义区别程度,
组合相似语义的样本对于模型训练是有帮助的。
  • 4 增加了一些对Sentence-Transformers多类别结果比较的工具。

贡献

Contributing

License

Distributed under the MIT License. See LICENSE for more information.

Contact

svjack - svjackbt@gmail.com ehangzhou@outlook.com

Project Link: https://github.com/svjack/Sbert-ChineseExample

Acknowledgements

[contributors-shield]: https://img.shields.io/github/contributors/othneildrew/Best-README-Template.svg?style=flat-square [contributors-url]: https://github.com/othneildrew/Best-README-Template/graphs/contributors [forks-shield]: https://img.shields.io/github/forks/othneildrew/Best-README-Template.svg?style=flat-square [forks-url]: https://github.com/othneildrew/Best-README-Template/network/members [stars-shield]: https://img.shields.io/github/stars/othneildrew/Best-README-Template.svg?style=flat-square [stars-url]: https://github.com/othneildrew/Best-README-Template/stargazers [issues-shield]: https://img.shields.io/github/issues/othneildrew/Best-README-Template.svg?style=flat-square [issues-url]: https://github.com/othneildrew/Best-README-Template/issues [license-shield]: https://img.shields.io/github/license/othneildrew/Best-README-Template.svg?style=flat-square [license-url]: https://github.com/othneildrew/Best-README-Template/blob/master/LICENSE.txt [linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=flat-square&logo=linkedin&colorB=555 [linkedin-url]: https://linkedin.com/in/othneildrew [product-screenshot]: images/screenshot.png

🔗 More in this category

© 2026 GitRepoTrend · svjack/Sbert-ChineseExample · Updated daily from GitHub