Sentence Similarity
Safetensors
sentence-transformers
Korean
PyLate
modernbert
ColBERT
feature-extraction
Generated from Trainer
text-embeddings-inference
Instructions to use yjoonjang/colbert-ko-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use yjoonjang/colbert-ko-v1 with sentence-transformers:
from pylate import models queries = [ "Which planet is known as the Red Planet?", "What is the largest planet in our solar system?", ] documents = [ ["Mars is the Red Planet.", "Venus is Earth's twin."], ["Jupiter is the largest planet.", "Saturn has rings."], ] model = models.ColBERT(model_name_or_path="yjoonjang/colbert-ko-v1") queries_emb = model.encode(queries, is_query=True) docs_emb = model.encode(documents, is_query=False) - Notebooks
- Google Colab
- Kaggle
Add Sentence Transformers usage
#2
by tomaarsen HF Staff - opened
Hello!
Starting with the next Sentence Transformers release (v6.0.0, planned for around the 18th), this checkpoint loads directly as a multi-vector (ColBERT-style late interaction) retriever through the new MultiVectorEncoder, alongside its existing PyLate usage. This PR adds a Sentence Transformers usage section to the model card and a multi-vector tag. The weights and the existing usage are untouched.
I'd love to feature this model in that release's blog post and documentation, especially once it loads without the revision pin (that is, once this PR is merged).
pip install "sentence-transformers @ git+https://github.com/huggingface/sentence-transformers.git"
from sentence_transformers import MultiVectorEncoder
model = MultiVectorEncoder("yjoonjang/colbert-ko-v1", revision="refs/pr/2")
query = "λΆμ νμ±μΌλ‘ μλ €μ§ νμ±μ 무μμΈκ°μ?"
documents = [
"κΈμ±μ ν¬κΈ°μ κ·Όμ μ±μ΄ λΉμ·νμ¬ μ’
μ’
μ§κ΅¬μ μλ₯μ΄λΌκ³ λΆλ¦°λ€.",
"νμ±μ λΆμ κ²λͺ¨μ΅ λλ¬Έμ μ’
μ’
λΆμ νμ±μ΄λΌκ³ λΆλ¦°λ€.",
"νμκ³μμ κ°μ₯ ν° νμ±μΈ λͺ©μ±μλ λλ ·ν λΆμ λ°μ μ΄ μλ€.",
"κ³ λ¦¬λ‘ μ λͺ
ν ν μ±μ λλλ‘ λΆμ νμ±μΌλ‘ μ€μΈλλ€.",
]
query_embeddings = model.encode_query(query)
document_embeddings = model.encode_document(documents)
print(query_embeddings.shape, document_embeddings[0].shape)
# (32, 128) (19, 128)
# MaxSim late-interaction scoring (higher is more relevant)
scores = model.similarity(query_embeddings, document_embeddings)
print(scores)
# tensor([[10.9423, 22.7836, 19.7410, 22.4239]])
- Tom Aarsen
tomaarsen changed pull request status to open