Comments (2)
@beekbin added a script to do all that you have mentioned above in
this pull request.
from bert-cosine-sim.
How to use this library
-
Step0: Download the pre-trained BERT models for pytorch from huggingface /pytorch_transformers/modeling_bert.py. In the simplest case, you have to download three things:
(1) a pre-trained model, for example:
bert-base-uncased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-uncased-pytorch_model.bin",
(2) the config file:
'bert-base-uncased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-uncased-config.json",
(3) the vocal file in tokenization_bert.py:
'bert-base-uncased': "https://s3.amazonaws.com/models.huggingface.co/bert/bert-base-uncased-vocab.txt",
-
Step1: Fine-tune the
BertPairSim
on your dataset or on the STS-B dataset;
The run.sh script provides an example to do the fine-tuning on the STS-B dataset. -
Step2: After fine-tuned, the
BertPairSim
model can be used to generate sentence embeddings, and the embedding can be used to compute the Cosine similarity between sentences.
Dataset
In the example of run.sh, I am using the STS-B dataset.
The STS-B dataset can be downloaded from the GLUE GitHub:
https://github.com/nyu-mll/jiant/blob/master/scripts/download_glue_data.py
from bert-cosine-sim.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bert-cosine-sim.