From 003c811be15d43606d52ddab61539a8bfb8848b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CAndrew?= Date: Wed, 13 Nov 2024 17:20:09 +0000 Subject: [PATCH] not quite fitting the paradigm yet but itll do --- rankers/modelling/pyterrier/sparse.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rankers/modelling/pyterrier/sparse.py b/rankers/modelling/pyterrier/sparse.py index 468dd79..1bb0527 100644 --- a/rankers/modelling/pyterrier/sparse.py +++ b/rankers/modelling/pyterrier/sparse.py @@ -32,6 +32,10 @@ def __init__(self, model_name_or_path, device=None, batch_size=32, text_field='t self.text_field = text_field self.topk = topk + @classmethod + def from_pretrained(cls, model_name_or_path, device=None, batch_size=32, text_field='text', fp16=False, topk=None): + return cls(model_name_or_path, device, batch_size, text_field, fp16, topk) + def encode_queries(self, texts, out_fmt='dict', topk=None): outputs = [] if out_fmt != 'dict':