Sentence Similarity
Safetensors
sentence-transformers
English
PyLate
modernbert
ColBERT
multi-vector
feature-extraction
late-interaction
ModernBERT
text-embeddings-inference
Instructions to use DataScience-UIBK/uibk-embedding-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use DataScience-UIBK/uibk-embedding-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="DataScience-UIBK/uibk-embedding-v1") queries_emb = model.encode(queries, is_query=True) docs_emb = model.encode(documents, is_query=False) - Notebooks
- Google Colab
- Kaggle
Load dense_branch.safetensors from the Hub when the model is given by repository id
Browse files- branched_transformer.py +10 -0
branched_transformer.py
CHANGED
|
@@ -41,6 +41,16 @@ class BranchedTransformer(Transformer):
|
|
| 41 |
if hasattr(module, "config"):
|
| 42 |
module.config = model.config
|
| 43 |
path = os.path.join(model_name_or_path, BRANCH_FILE)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
if os.path.exists(path):
|
| 45 |
self.load_dense_branch(load_file(path))
|
| 46 |
|
|
|
|
| 41 |
if hasattr(module, "config"):
|
| 42 |
module.config = model.config
|
| 43 |
path = os.path.join(model_name_or_path, BRANCH_FILE)
|
| 44 |
+
if not os.path.exists(path) and not os.path.isdir(model_name_or_path):
|
| 45 |
+
# a Hub repository id: the wrapped model's weights came from the Hub, so the dense branch must too
|
| 46 |
+
# (without it the dense top would silently stay a copy of the ColBERT top)
|
| 47 |
+
from huggingface_hub import hf_hub_download
|
| 48 |
+
|
| 49 |
+
hub = kwargs.get("model_args") or {}
|
| 50 |
+
path = hf_hub_download(model_name_or_path, BRANCH_FILE, subfolder=hub.get("subfolder") or None,
|
| 51 |
+
revision=hub.get("revision"), token=hub.get("token"),
|
| 52 |
+
cache_dir=kwargs.get("cache_dir"),
|
| 53 |
+
local_files_only=bool(hub.get("local_files_only", False)))
|
| 54 |
if os.path.exists(path):
|
| 55 |
self.load_dense_branch(load_file(path))
|
| 56 |
|