hppRC/defsent

DefSent: Sentence Embeddings using Definition Sentences

22

stars

6

commits

Python

primary language

Aug 5, 2021

updated

aclanthology.org/2021.acl-short.52/
bert
natural-language-processing
nlp
transformers

README

DefSent: Sentence Embeddings using Definition Sentences

This repository contains the experimetns code, pre-trained models, and examples for our paper DefSent: Sentence Embeddings using Definition Sentences

ACL Anthology: https://aclanthology.org/2021.acl-short.52/

Overview

Getting started

Install from PyPI

pip install defsent

Encode sentences into torch.Tensor

from defsent import DefSent

model = DefSent("cl-nagoya/defsent-bert-base-uncased-cls")
embeddings = model.encode([
  "A woman is playing the guitar.",
  "A man is playing guitar.",
])

Predict words from input sentences

from defsent import DefSent

model = DefSent("cl-nagoya/defsent-bert-base-uncased-cls")
predicted_words = model.predict_words([
  "be expensive for (someone)",
  "an open-source operating system modelled on unix",
  "not bad",
])

Example reults for definition sentences.

Example reults for sentences other than definition sentences.

Pretrained checkpoints

Search: https://huggingface.co/models?search=defsent

checkpointSTS12STS13STS14STS15STS16STS-BSICK-RAvg.
defsent-bert-base-uncased-cls67.6180.4470.1277.576.3475.2571.7174.14
defsent-bert-base-uncased-mean68.2482.6272.878.4476.7977.571.6975.44
defsent-bert-base-uncased-max65.3282.0073.0077.3875.8476.7471.6774.57
defsent-bert-large-uncased-cls67.0382.4171.2580.3375.4373.8373.3474.8
defsent-bert-large-uncased-mean63.9382.4373.2980.5277.8478.4173.3975.69
defsent-bert-large-uncased-max60.1580.7071.6777.1975.7176.9072.5773.55
defsent-roberta-base-cls66.1380.9672.5978.3378.8578.5174.4475.69
defsent-roberta-base-mean62.3878.4270.7974.6077.3277.3873.0773.42
defsent-roberta-base-max64.6178.7670.2476.0779.0278.3474.5474.51
defsent-roberta-large-cls62.4779.0769.8772.6277.8779.1173.9573.56
defsent-roberta-large-mean57.872.9869.1872.8476.5079.1774.3671.83
defsent-roberta-large-max64.1181.4272.5275.3780.2379.1673.7675.22

Hyperparameters for each checkpoint and fine-tuning task performance

Citation

@inproceedings{tsukagoshi-etal-2021-defsent,
    title = "{D}ef{S}ent: Sentence Embeddings using Definition Sentences",
    author = "Tsukagoshi, Hayato  and
      Sasano, Ryohei  and
      Takeda, Koichi",
    booktitle = "Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers)",
    month = aug,
    year = "2021",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2021.acl-short.52",
    doi = "10.18653/v1/2021.acl-short.52",
    pages = "411--418",
}

Contributors

hppRC

6 commits

hppRC/defsent

DefSent: Sentence Embeddings using Definition Sentences

22

stars

6

commits

Python

primary language

Aug 5, 2021

updated

aclanthology.org/2021.acl-short.52/
bert
natural-language-processing
nlp
transformers

README

DefSent: Sentence Embeddings using Definition Sentences

This repository contains the experimetns code, pre-trained models, and examples for our paper DefSent: Sentence Embeddings using Definition Sentences

ACL Anthology: https://aclanthology.org/2021.acl-short.52/

Overview

Getting started

Install from PyPI

pip install defsent

Encode sentences into torch.Tensor

from defsent import DefSent

model = DefSent("cl-nagoya/defsent-bert-base-uncased-cls")
embeddings = model.encode([
  "A woman is playing the guitar.",
  "A man is playing guitar.",
])

Predict words from input sentences

from defsent import DefSent

model = DefSent("cl-nagoya/defsent-bert-base-uncased-cls")
predicted_words = model.predict_words([
  "be expensive for (someone)",
  "an open-source operating system modelled on unix",
  "not bad",
])

Example reults for definition sentences.

Example reults for sentences other than definition sentences.

Pretrained checkpoints

Search: https://huggingface.co/models?search=defsent

checkpointSTS12STS13STS14STS15STS16STS-BSICK-RAvg.
defsent-bert-base-uncased-cls67.6180.4470.1277.576.3475.2571.7174.14
defsent-bert-base-uncased-mean68.2482.6272.878.4476.7977.571.6975.44
defsent-bert-base-uncased-max65.3282.0073.0077.3875.8476.7471.6774.57
defsent-bert-large-uncased-cls67.0382.4171.2580.3375.4373.8373.3474.8
defsent-bert-large-uncased-mean63.9382.4373.2980.5277.8478.4173.3975.69
defsent-bert-large-uncased-max60.1580.7071.6777.1975.7176.9072.5773.55
defsent-roberta-base-cls66.1380.9672.5978.3378.8578.5174.4475.69
defsent-roberta-base-mean62.3878.4270.7974.6077.3277.3873.0773.42
defsent-roberta-base-max64.6178.7670.2476.0779.0278.3474.5474.51
defsent-roberta-large-cls62.4779.0769.8772.6277.8779.1173.9573.56
defsent-roberta-large-mean57.872.9869.1872.8476.5079.1774.3671.83
defsent-roberta-large-max64.1181.4272.5275.3780.2379.1673.7675.22

Hyperparameters for each checkpoint and fine-tuning task performance

Citation

@inproceedings{tsukagoshi-etal-2021-defsent,
    title = "{D}ef{S}ent: Sentence Embeddings using Definition Sentences",
    author = "Tsukagoshi, Hayato  and
      Sasano, Ryohei  and
      Takeda, Koichi",
    booktitle = "Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers)",
    month = aug,
    year = "2021",
    address = "Online",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2021.acl-short.52",
    doi = "10.18653/v1/2021.acl-short.52",
    pages = "411--418",
}

Contributors

hppRC

6 commits

Languages

Python

87.9%

Shell

12.1%