Giter Site home page Giter Site logo

Comments (2)

mayurbhangale avatar mayurbhangale commented on July 17, 2024 1

@beekbin added a script to do all that you have mentioned above in
this pull request.

from bert-cosine-sim.

beekbin avatar beekbin commented on July 17, 2024

Hi @gauravkoradiya

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