MLRetrieval.load() ignores user supplied SentenceTransformer path
MLRetrieval.load(path=...) ignored the supplied path argument and passed self.path to SentenceTransformer instead.
Location:ontoaligner/aligner/retrieval/retrieval.py:268
Current code:
self.model = SentenceTransformer(self.path, device=self.kwargs["device"])
Since self.path is not assigned from the path argument, the model loader can receive an empty or stale path instead of the requested model.
SentenceTransformer received path: ''
SentenceTransformer received device: 'cpu'
AssertionError: BUG CONFIRMED: load(path='requested-model') ignored the path.
Fix
Use the supplied path argument directly like :
self.model = SentenceTransformer(path, device=self.kwargs["device"])
This matches the existing BiEncoderRetrieval.load() style:
self.model = SentenceTransformer(path, device=self.kwargs["device"], trust_remote_code=True)
After fix
PASS: MLRetrieval.load() forwarded the supplied path correctly.
MLRetrieval.load() ignores user supplied SentenceTransformer path
MLRetrieval.load(path=...)ignored the suppliedpathargument and passedself.pathtoSentenceTransformerinstead.Location:
ontoaligner/aligner/retrieval/retrieval.py:268Current code:
Since
self.pathis not assigned from thepathargument, the model loader can receive an empty or stale path instead of the requested model.Fix
Use the supplied
pathargument directly like :This matches the existing
BiEncoderRetrieval.load()style:After fix