File tree Expand file tree Collapse file tree
FlagEmbedding/baai_general_embedding/finetune Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,6 +43,9 @@ def __init__(self,
4343 if not normlized :
4444 self .temperature = 1.0
4545 logger .info ("reset temperature = 1.0 due to using inner product to compute similarity" )
46+ if normlized :
47+ if self .temperature > 0.5 :
48+ raise ValueError ("Temperature should be smaller than 1.0 when use cosine similarity (i.e., normlized=True). Recommend to set it 0.01-0.1" )
4649
4750 self .negatives_cross_device = negatives_cross_device
4851 if self .negatives_cross_device :
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ For development, install as editable:
1818pip install -e .
1919```
2020
21- The new version of Transformers may pose issues for fine-tuning. If you encounter problems, you can try to downgrade to versions 4.33-4.36.
2221
2322
2423## 2. Data format
@@ -88,7 +87,7 @@ Noted that the number of negatives should not be larger than the numbers of nega
8887Besides the negatives in this group, the in-batch negatives also will be used in fine-tuning.
8988- ` negatives_cross_device ` : share the negatives across all GPUs. This argument will extend the number of negatives.
9089- ` learning_rate ` : select a appropriate for your model. Recommend 1e-5/2e-5/3e-5 for large/base/small-scale.
91- - ` temperature ` : It will influence the distribution of similarity scores.
90+ - ` temperature ` : It will influence the distribution of similarity scores. ** Recommend set it 0.01-0.1. **
9291- ` query_max_len ` : max length for query. Please set it according the average length of queries in your data.
9392- ` passage_max_len ` : max length for passage. Please set it according the average length of passages in your data.
9493- ` query_instruction_for_retrieval ` : instruction for query, which will be added to each query. You also can set it ` "" ` to add nothing to query.
You can’t perform that action at this time.
0 commit comments