Download sentence_transformers/datasets/SentencesDataset.py from lengocduc195/SentenceTransformer: direct link, hf CLI and curl.
- Browser
- Download file 732 Bytes
-
https://huggingface.co/lengocduc195/SentenceTransformer/resolve/main/sentence_transformers/datasets/SentencesDataset.py
- Command line
-
hf download hf://lengocduc195/SentenceTransformer/sentence_transformers/datasets/SentencesDataset.py
-
curl -L -o SentencesDataset.py https://huggingface.co/lengocduc195/SentenceTransformer/resolve/main/sentence_transformers/datasets/SentencesDataset.py
732 Bytes
| from torch.utils.data import Dataset | |
| from typing import List | |
| import torch | |
| from .. import SentenceTransformer | |
| from ..readers.InputExample import InputExample | |
| class SentencesDataset(Dataset): | |
| """ | |
| DEPRECATED: This class is no longer used. Instead of wrapping your List of InputExamples in a SentencesDataset | |
| and then passing it to the DataLoader, you can pass the list of InputExamples directly to the dataset loader. | |
| """ | |
| def __init__(self, | |
| examples: List[InputExample], | |
| model: SentenceTransformer | |
| ): | |
| self.examples = examples | |
| def __getitem__(self, item): | |
| return self.examples[item] | |
| def __len__(self): | |
| return len(self.examples) | |