Instructions to use johngiorgi/declutr-sci-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use johngiorgi/declutr-sci-base with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("johngiorgi/declutr-sci-base") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Notebooks
- Google Colab
- Kaggle
Commit ·
2ce3cc6
1
Parent(s): 96b4361
Update call to forward pass to match latest API
Browse files
README.md
CHANGED
|
@@ -31,7 +31,7 @@ inputs = tokenizer(text, padding=True, truncation=True, return_tensors="pt")
|
|
| 31 |
|
| 32 |
# Embed the text
|
| 33 |
with torch.no_grad():
|
| 34 |
-
sequence_output
|
| 35 |
|
| 36 |
# Mean pool the token-level embeddings to get sentence-level embeddings
|
| 37 |
embeddings = torch.sum(
|
|
|
|
| 31 |
|
| 32 |
# Embed the text
|
| 33 |
with torch.no_grad():
|
| 34 |
+
sequence_output = model(**inputs)[0]
|
| 35 |
|
| 36 |
# Mean pool the token-level embeddings to get sentence-level embeddings
|
| 37 |
embeddings = torch.sum(
|