From cc92aaa9c55bf2eb5dcb0695d27f9980202636f8 Mon Sep 17 00:00:00 2001 From: Jack Urbanek Date: Wed, 10 Aug 2022 12:34:17 -0400 Subject: [PATCH] [LIGHT] Who Am I - Preventing doubleloading model --- projects/light_whoami/agents/pacer.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/projects/light_whoami/agents/pacer.py b/projects/light_whoami/agents/pacer.py index 7ea2674c47a..8301cfdfc9a 100644 --- a/projects/light_whoami/agents/pacer.py +++ b/projects/light_whoami/agents/pacer.py @@ -74,10 +74,14 @@ def add_cmdline_args( def __init__(self, opt: Opt, shared=None): super().__init__(opt, shared) reranker_class = self.get_partial_only_reranker_class() - if not (shared and 'classifier' in shared): - self.classifier = reranker_class(opt) - else: + if shared and 'classifier' in shared: self.classifier = shared['classifier'] + elif shared and 'reranker' in shared: + self.classifier = shared['reranker'] + elif hasattr(self, 'reranker'): + self.classifier = self.reranker + else: + self.classifier = reranker_class(opt) assert opt[ 'beam_block_full_context' ], 'must set --beam-block-full-context True to use PACER'