Update README.md
Browse files
README.md
CHANGED
@@ -2664,10 +2664,11 @@ def mean_pooling(model_output, attention_mask):
|
|
2664 |
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
|
2665 |
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
|
2666 |
|
2667 |
-
sentences = ['
|
2668 |
|
2669 |
tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')
|
2670 |
-
model = AutoModel.from_pretrained('nomic-ai/nomic-embed-text-v1-
|
|
|
2671 |
|
2672 |
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
2673 |
|
|
|
2664 |
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
|
2665 |
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
|
2666 |
|
2667 |
+
sentences = ['What is TSNE?', 'Who is Laurens van der Maaten?']
|
2668 |
|
2669 |
tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased')
|
2670 |
+
model = AutoModel.from_pretrained('nomic-ai/nomic-embed-text-v1-ablated', trust_remote_code=True)
|
2671 |
+
model.eval()
|
2672 |
|
2673 |
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt')
|
2674 |
|