GithubHelp home page GithubHelp logo

yunxier / pytorch_bert_vec Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nutalk/pytorch_bert_vec

0.0 1.0 0.0 25.03 MB

一条命令产生bert、albert句向量,用于相似度计算和文本分类等。

Python 100.00%

pytorch_bert_vec's Introduction

pytorch版Bert、Albert、Robert等模型的句向量生成

基于Transformersalbert_pytorch,用来简化生成句向量的代码,方便后续进行文本相似度计算等。

依赖

见requirements.txt

使用

  1. 下载中文bertalbert的预训练模型。
  2. 使用flask_api.py。

效果

直接运行flask_api.py,用cosine距离判断句子的相似度,可以看到相似句子的bert和albert直接输出的向量相余弦距离比较小。

参考

句向量输出代码主要参考了Bert提取句子特征(pytorch_transformers)

pytorch_bert_vec's People

Contributors

nutalk avatar

Watchers

James Cloos 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.