From 7bf7166400b7ae385f10b1cfe5adabe8fa0f3a5c Mon Sep 17 00:00:00 2001 From: marluxiaboss Date: Thu, 7 Nov 2024 11:59:36 +0100 Subject: [PATCH] fixed issue with keys parameter in SynthID --- detector_benchmark/watermark/synth_id/synth_id.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/detector_benchmark/watermark/synth_id/synth_id.py b/detector_benchmark/watermark/synth_id/synth_id.py index f831e4f..af1e9a8 100644 --- a/detector_benchmark/watermark/synth_id/synth_id.py +++ b/detector_benchmark/watermark/synth_id/synth_id.py @@ -502,7 +502,15 @@ def __init__( ) -> None: self.config = SynthIDConfig(algorithm_config, gen_model, transformers_config) self.utils = SynthIDUtils(self.config) + + # fix issue with the keys parameter of the config + keys_str = self.config["keys"] + keys = keys_str.replace("[", "").replace("]", "").split(",") + keys = [int(key) for key in keys] + self.config["keys"] = keys + self.logits_processor = SynthIDLogitsProcessor(self.config, self.utils) + self.detector = get_detector(self.config.detector_name, self.logits_processor) def generate_watermarked_text(self, prompt: str, *args, **kwargs) -> str: