Skip to content

Commit ecc2fe9

Browse files
committed
fix: ColBERT linear size for smaller model
1 parent 7f881ec commit ecc2fe9

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ packages = [
1414
name = "rerankers"
1515

1616

17-
version = "0.5.2"
17+
version = "0.5.2post1"
1818

1919
description = "A unified API for various document re-ranking models."
2020

rerankers/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
from rerankers.documents import Document
33

44
__all__ = ["Reranker", "Document"]
5-
__version__ = "0.5.2"
5+
__version__ = "0.5.2post1"

rerankers/models/colbert_ranker.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,14 @@ class ColBERTModel(BertPreTrainedModel):
8888
def __init__(self, config):
8989
super().__init__(config)
9090
self.bert = BertModel(config)
91-
self.linear = nn.Linear(config.hidden_size, 128, bias=False)
91+
92+
# TODO: Load from artifact.metadata
93+
if "small" in config._name_or_path:
94+
linear_dim = 96
95+
else:
96+
linear_dim = 128
97+
print("Linear Dim set to: {linear_dim} for downcasting")
98+
self.linear = nn.Linear(config.hidden_size, linear_dim, bias=False)
9299
self.init_weights()
93100

94101
def forward(

0 commit comments

Comments
 (0)