From a3513bf7ee03e59997a6140617c98d1807700f31 Mon Sep 17 00:00:00 2001 From: John Bauer Date: Sun, 27 Oct 2024 01:54:08 -0700 Subject: [PATCH] sentiment processor has a specific way of loading the args, different from the standard UDProcessor --- stanza/pipeline/sentiment_processor.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/stanza/pipeline/sentiment_processor.py b/stanza/pipeline/sentiment_processor.py index 45a515e62b..54f18dd5f7 100644 --- a/stanza/pipeline/sentiment_processor.py +++ b/stanza/pipeline/sentiment_processor.py @@ -60,6 +60,13 @@ def _set_up_model(self, config, pipeline, device): # batch size counted as words self._batch_size = config.get('batch_size', SentimentProcessor.DEFAULT_BATCH_SIZE) + def _set_up_final_config(self, config): + loaded_args = vars(self._model.config) + loaded_args = {k: v for k, v in loaded_args.items() if not UDProcessor.filter_out_option(k)} + loaded_args.update(config) + self._config = loaded_args + + def process(self, document): sentences = self._model.extract_sentences(document) with torch.no_grad():