mteb/stsbenchmark-sts
Viewer β’ Updated β’ 8.63k β’ 31.4k β’ 18
How to use LNTTushar/tryn-mini-7m with sentence-transformers:
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("LNTTushar/tryn-mini-7m")
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]How to use LNTTushar/tryn-mini-7m with Transformers:
# Load model directly
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("LNTTushar/tryn-mini-7m")
model = AutoModel.from_pretrained("LNTTushar/tryn-mini-7m")pip install -r api/requirements.txt
from api.inference_api import SentenceEmbeddingInference
# Initialize model
model = SentenceEmbeddingInference("./")
# Generate embeddings
texts = ["Your text here", "Another text"]
embeddings = model.get_embeddings(texts)
# Compute similarity
similarity = model.compute_similarity("Text 1", "Text 2")
# Find similar texts
query = "Search query"
candidates = ["Text A", "Text B", "Text C"]
results = model.find_similar_texts(query, candidates, top_k=3)
from sentence_transformers import SentenceTransformer
# Load the model
model = SentenceTransformer('LNTTushar/sentence-embedding-model-production-release')
# Generate embeddings
sentences = ["Machine learning is transforming AI", "AI includes machine learning"]
embeddings = model.encode(sentences)
# Compute similarity
similarity = model.similarity(sentences[0], sentences[1])
print(f"Similarity: {similarity:.4f}")
βββ models/ # Model weights and configuration
βββ tokenizer/ # Auto-generated vocabulary and mappings
βββ exports/ # Optimized model exports (TorchScript)
βββ api/ # Python inference API
β βββ inference_api.py
β βββ requirements.txt
βββ README.md # This file
This model represents a complete from-scratch development:
get_embeddings(texts, batch_size=8): Generate sentence embeddingscompute_similarity(text1, text2): Calculate cosine similarityfind_similar_texts(query, candidates, top_k=5): Find most similar textsbenchmark_performance(num_texts=100): Run performance benchmarksBuilt with automated tokenizer using comprehensive stopwords and domain vocabulary
π No more manual word lists - fully automated vocabulary building!
# Load model directly from transformers import AutoTokenizer, AutoModel tokenizer = AutoTokenizer.from_pretrained("LNTTushar/tryn-mini-7m") model = AutoModel.from_pretrained("LNTTushar/tryn-mini-7m")