This task lets you easily train or fine-tune a Sentence Transformer model on your own dataset.
AutoTrain supports the following types of sentence transformer finetuning:
pair
: dataset with two sentences: anchor and positivepair_class
: dataset with two sentences: premise and hypothesis and a target labelpair_score
: dataset with two sentences: sentence1 and sentence2 and a target scoretriplet
: dataset with three sentences: anchor, positive and negativeqa
: dataset with two sentences: query and answerSentence Transformers finetuning accepts data in CSV/JSONL format. You can also use a dataset from Hugging Face Hub.
For pair
training, the data should be in the following format:
anchor | positive |
---|---|
hello | hi |
how are you | I am fine |
What is your name? | My name is Abhishek |
Which is the best programming language? | Python |
For pair_class
training, the data should be in the following format:
premise | hypothesis | label |
---|---|---|
hello | hi | 1 |
how are you | I am fine | 0 |
What is your name? | My name is Abhishek | 1 |
Which is the best programming language? | Python | 1 |
For pair_score
training, the data should be in the following format:
sentence1 | sentence2 | score |
---|---|---|
hello | hi | 0.8 |
how are you | I am fine | 0.2 |
What is your name? | My name is Abhishek | 0.9 |
Which is the best programming language? | Python | 0.7 |
For triplet
training, the data should be in the following format:
anchor | positive | negative |
---|---|---|
hello | hi | bye |
how are you | I am fine | I am not fine |
What is your name? | My name is Abhishek | Whats it to you? |
Which is the best programming language? | Python | Javascript |
For qa
training, the data should be in the following format:
query | answer |
---|---|
hello | hi |
how are you | I am fine |
What is your name? | My name is Abhishek |
Which is the best programming language? | Python |
( data_path: str = None model: str = 'microsoft/mpnet-base' lr: float = 3e-05 epochs: int = 3 max_seq_length: int = 128 batch_size: int = 8 warmup_ratio: float = 0.1 gradient_accumulation: int = 1 optimizer: str = 'adamw_torch' scheduler: str = 'linear' weight_decay: float = 0.0 max_grad_norm: float = 1.0 seed: int = 42 train_split: str = 'train' valid_split: Optional = None logging_steps: int = -1 project_name: str = 'project-name' auto_find_batch_size: bool = False mixed_precision: Optional = None save_total_limit: int = 1 token: Optional = None push_to_hub: bool = False eval_strategy: str = 'epoch' username: Optional = None log: str = 'none' early_stopping_patience: int = 5 early_stopping_threshold: float = 0.01 trainer: str = 'pair_score' sentence1_column: str = 'sentence1' sentence2_column: str = 'sentence2' sentence3_column: Optional = None target_column: Optional = None )
Parameters
SentenceTransformersParams is a configuration class for setting up parameters for training sentence transformers.