add: max_query/doc_length parametrization (#6)
Browse files- add: max_query/doc_length parametrization (bf1c93a54d0e7666b430d011283feeae5d9a1cf0)
- fix: deactivate automatic ordering (b39421b0c8343e2100221a9ad9b35534f0099c2e)
Co-authored-by: Quentin Herreros <qherreros@users.noreply.huggingface.co>
- modeling.py +2 -2
modeling.py
CHANGED
|
@@ -200,6 +200,8 @@ class JinaForRanking(modeling_qwen3.Qwen3ForCausalLM):
|
|
| 200 |
documents: List[str],
|
| 201 |
top_n: Optional[int] = None,
|
| 202 |
return_embeddings: bool = False,
|
|
|
|
|
|
|
| 203 |
) -> List[dict]:
|
| 204 |
"""
|
| 205 |
Rerank documents by relevance to a query.
|
|
@@ -221,8 +223,6 @@ class JinaForRanking(modeling_qwen3.Qwen3ForCausalLM):
|
|
| 221 |
|
| 222 |
# Derived from model configuration
|
| 223 |
max_length = self._tokenizer.model_max_length
|
| 224 |
-
max_query_length = 512
|
| 225 |
-
max_doc_length = 2048
|
| 226 |
|
| 227 |
# Derive block_size from max_length to fit documents efficiently
|
| 228 |
# Heuristic: allow ~125 docs per batch for typical doc sizes
|
|
|
|
| 200 |
documents: List[str],
|
| 201 |
top_n: Optional[int] = None,
|
| 202 |
return_embeddings: bool = False,
|
| 203 |
+
max_doc_length: int = 2048,
|
| 204 |
+
max_query_length: int = 512,
|
| 205 |
) -> List[dict]:
|
| 206 |
"""
|
| 207 |
Rerank documents by relevance to a query.
|
|
|
|
| 223 |
|
| 224 |
# Derived from model configuration
|
| 225 |
max_length = self._tokenizer.model_max_length
|
|
|
|
|
|
|
| 226 |
|
| 227 |
# Derive block_size from max_length to fit documents efficiently
|
| 228 |
# Heuristic: allow ~125 docs per batch for typical doc sizes
|