Sentence Similarity
Transformers
PyTorch
Safetensors
English
bert
feature-extraction
text-embeddings-inference
Instructions to use SAP/miCSE with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SAP/miCSE with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("SAP/miCSE") model = AutoModel.from_pretrained("SAP/miCSE", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -40,7 +40,9 @@ batch = tokenizer.batch_encode_plus(
|
|
| 40 |
|
| 41 |
# Compute the embeddings and keep only the _**[CLS]**_ embedding (the first token)
|
| 42 |
|
| 43 |
-
|
|
|
|
|
|
|
| 44 |
|
| 45 |
embeddings = outputs.last_hidden_state[:,0]
|
| 46 |
|
|
|
|
| 40 |
|
| 41 |
# Compute the embeddings and keep only the _**[CLS]**_ embedding (the first token)
|
| 42 |
|
| 43 |
+
# Get raw embeddings (no gradients)
|
| 44 |
+
with torch.no_grad():
|
| 45 |
+
outputs = model(**batch, output_hidden_states=True, return_dict=True)
|
| 46 |
|
| 47 |
embeddings = outputs.last_hidden_state[:,0]
|
| 48 |
|