Views
No views yet
all-MiniLM-L6-v2 (BERT) with custom surgery.SentenceTransformer(
(0): Transformer({'max_seq_length': 4096, 'do_lower_case': False}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 384, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, ...})
(2): Dense({'in_features': 384, 'out_features': 512, 'bias': True, 'activation_function': 'torch.nn.modules.linear.Identity'})
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("Zeolit/lettuce-emb-512d-v2")
5
6# Run inference on Narrative/RP text
7sentences = [
8 '"You raised a flag."',
9 '*I take a deep breath, my mind racing with possibilities...* "Leap to an even earlier time."',
10 'The quick brown fox jumps over the lazy dog.'
11]
12embeddings = model.encode(sentences)
13print(embeddings.shape)
14# [3, 512]
15
16# Get the similarity scores for the embeddings
17similarities = model.similarity(embeddings, embeddings)sentence-transformers/all-nli (Logic & Reasoning anchors).| Epoch | Step | Training Loss |
|---|---|---|
| 0.1064 | 500 | 0.0021 |
| 0.2128 | 1000 | 0.0016 |
| 0.3191 | 1500 | 0.0012 |
| 0.4255 | 2000 | 0.0011 |
| 0.5319 | 2500 | 0.001 |
| 0.6383 | 3000 | 0.0009 |
| 0.7447 | 3500 | 0.001 |
| 0.8511 | 4000 | 0.0009 |
| 0.9574 | 4500 | 0.0009 |
| 1.0638 | 5000 | 0.0006 |
| 1.1702 | 5500 | 0.0005 |
| 1.2766 | 6000 | 0.0005 |
| 1.3830 | 6500 | 0.0006 |
| 1.4894 | 7000 | 0.0006 |
| 1.5957 | 7500 | 0.0005 |
| 1.7021 | 8000 | 0.0005 |
| 1.8085 | 8500 | 0.0005 |
| 1.9149 | 9000 | 0.0005 |
per_device_train_batch_size: 4 (Gradient Accumulation simulated larger batches)num_train_epochs: 2fp16: Trueloss: CosineSimilarityLoss1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}