模型:
这个模型是基于 all-mpnet-base-v2 在以下数据集上进行微调的版本: squad , newsqa , LLukas22/cqadupstack , LLukas22/fiqa , LLukas22/scidocs , deepset/germanquad , LLukas22/nq 。
在安装 sentence-transformers 后,使用这个模型就很容易:
pip install -U sentence-transformers
然后你可以这样使用模型:
from sentence_transformers import SentenceTransformer
sentences = ["This is an example sentence", "Each sentence is converted"]
model = SentenceTransformer('LLukas22/all-mpnet-base-v2-embedding-all')
embeddings = model.encode(sentences)
print(embeddings)
训练过程中使用了以下超参数:
| Epoch | Train Loss | Validation Loss |
|---|---|---|
| 0 | 0.0554 | 0.047 |
| 1 | 0.044 | 0.0472 |
| 2 | 0.0374 | 0.0425 |
| 3 | 0.0322 | 0.041 |
| 4 | 0.0278 | 0.0403 |
| 5 | 0.0246 | 0.0389 |
| 6 | 0.0215 | 0.0389 |
| 7 | 0.0192 | 0.0388 |
| 8 | 0.017 | 0.0379 |
| 9 | 0.0154 | 0.0375 |
| 10 | 0.0142 | 0.0381 |
| 11 | 0.0132 | 0.0372 |
| 12 | 0.0126 | 0.0377 |
| 13 | 0.012 | 0.0377 |
| Epoch | top_1 | top_3 | top_5 | top_10 | top_25 |
|---|---|---|---|---|---|
| 0 | 0.373 | 0.476 | 0.509 | 0.544 | 0.573 |
| 1 | 0.362 | 0.466 | 0.501 | 0.537 | 0.568 |
| 2 | 0.371 | 0.476 | 0.511 | 0.546 | 0.576 |
| 3 | 0.369 | 0.473 | 0.506 | 0.54 | 0.569 |
| 4 | 0.373 | 0.478 | 0.512 | 0.547 | 0.578 |
| 5 | 0.378 | 0.483 | 0.517 | 0.552 | 0.58 |
| 6 | 0.371 | 0.475 | 0.509 | 0.543 | 0.571 |
| 7 | 0.379 | 0.484 | 0.517 | 0.55 | 0.578 |
| 8 | 0.378 | 0.482 | 0.515 | 0.548 | 0.575 |
| 9 | 0.383 | 0.489 | 0.523 | 0.556 | 0.584 |
| 10 | 0.38 | 0.483 | 0.517 | 0.549 | 0.575 |
| 11 | 0.38 | 0.485 | 0.518 | 0.551 | 0.577 |
| 12 | 0.383 | 0.489 | 0.522 | 0.556 | 0.582 |
| 13 | 0.385 | 0.49 | 0.523 | 0.555 | 0.581 |
这个模型是我硕士论文“评估基于transformer的语言模型在服务信息系统中的应用”中训练的。源代码可在 Github 上找到。