GithubHelp home page GithubHelp logo

lshy687 / contrastivelearning4chinese Goto Github PK

View Code? Open in Web Editor NEW

This project forked from kimiest/contrastivelearning4chinese

0.0 0.0 0.0 11.57 MB

用于中文句子表征的对比学习,超简洁实现,可扩展可复用,中文注释,另配说明图

Python 100.00%

contrastivelearning4chinese's Introduction

ContrastiveLearning4Chinese

🧡💛💚用于中文句子表征的对比学习,模型为SimCSE🧡💛💚



采用两种正负例构建方式:
1)无监督。同一个句子在不同Dropout下的BERT表征为正例,不同句子的BERT表征为负例;
2)有监督。基于文本蕴含数据集,相互蕴含的句子为正例,相互冲突的句子为负例。

代码结构简洁,可扩展和复用性强,包含大量中文注释

基于2023年最新的PytorchHugginFace Transformers框架实现

第一张图:有监督和无监督条件下数据的流入和流出格式

图1

第二张图:无监督训练方式对应的损失函数计算方式示意图

图2

第三张图:有监督训练方式对应的损失函数计算方式示意图

图3

contrastivelearning4chinese's People

Contributors

kimiest avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.