Datasets:
Tasks:
Question Answering
Modalities:
Text
Sub-tasks:
closed-domain-qa
Languages:
English
Size:
1M - 10M
License:
Add 'sentence-transformers' tag for easier discoverability
#2
by
tomaarsen
HF staff
- opened
Hello!
Pull Request overview
- Add the
sentence-transformers
tag.
Details
The upcoming Sentence Transformers v3 update will introduce training directly with Dataset
instances, e.g. like so:
from datasets import load_dataset
from sentence_transformers import SentenceTransformer, SentenceTransformerTrainer
from sentence_transformers.losses import MultipleNegativesRankingLoss
# 1. Load a model to finetune
model = SentenceTransformer("microsoft/mpnet-base")
# 2. Load a dataset to finetune on
dataset = load_dataset("sentence-transformers/all-nli", "pair")
train_dataset = dataset["train"]
eval_dataset = dataset["dev"]
# 3. Define a loss function
loss = MultipleNegativesRankingLoss(model)
# 4. Create a trainer & train
trainer = SentenceTransformerTrainer(
model=model,
train_dataset=train_dataset,
eval_dataset=eval_dataset,
loss=loss,
)
trainer.train()
# 5. Save the trained model
model.save("models/mpnet-base-all-nli")
In preparation for the release, I'm going through and tagging some excellent datasets that immediately match one of the dataset formats required for one of the loss functions as sentence-transformers
. Then I can link to datasets with this tag in the Sentence Transformers documentation.
This dataset in particular matches the (anchor, positive) pairs
without any label, allowing this dataset to be used out of the box for CachedMultipleNegativesRankingLoss, MultipleNegativesRankingLoss, MultipleNegativesSymmetricRankingLoss, MegaBatchMarginLoss, CachedGISTEmbedLoss, and GISTEmbedLoss.
- Tom Aarsen