pyrit/auxiliary_attacks/gcg/attack/base/attack_manager.py [1209:1252]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        if logfile is not None:
            with open(logfile, "w") as f:
                json.dump(
                    {
                        "params": {
                            "goals": goals,
                            "targets": targets,
                            "test_goals": test_goals,
                            "test_targets": test_targets,
                            "control_init": control_init,
                            "test_prefixes": test_prefixes,
                            "models": [
                                {
                                    "model_path": worker.model.name_or_path,
                                    "tokenizer_path": worker.tokenizer.name_or_path,
                                    "conv_template": worker.conv_template.name,
                                }
                                for worker in self.workers
                            ],
                            "test_models": [
                                {
                                    "model_path": worker.model.name_or_path,
                                    "tokenizer_path": worker.tokenizer.name_or_path,
                                    "conv_template": worker.conv_template.name,
                                }
                                for worker in self.test_workers
                            ],
                        },
                        "controls": [],
                        "losses": [],
                        "runtimes": [],
                        "tests": [],
                    },
                    f,
                    indent=4,
                )

    @staticmethod
    def filter_mpa_kwargs(**kwargs):
        mpa_kwargs = {}
        for key in kwargs.keys():
            if key.startswith("mpa_"):
                mpa_kwargs[key[4:]] = kwargs[key]
        return mpa_kwargs
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



pyrit/auxiliary_attacks/gcg/attack/base/attack_manager.py [1420:1463]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        if logfile is not None:
            with open(logfile, "w") as f:
                json.dump(
                    {
                        "params": {
                            "goals": goals,
                            "targets": targets,
                            "test_goals": test_goals,
                            "test_targets": test_targets,
                            "control_init": control_init,
                            "test_prefixes": test_prefixes,
                            "models": [
                                {
                                    "model_path": worker.model.name_or_path,
                                    "tokenizer_path": worker.tokenizer.name_or_path,
                                    "conv_template": worker.conv_template.name,
                                }
                                for worker in self.workers
                            ],
                            "test_models": [
                                {
                                    "model_path": worker.model.name_or_path,
                                    "tokenizer_path": worker.tokenizer.name_or_path,
                                    "conv_template": worker.conv_template.name,
                                }
                                for worker in self.test_workers
                            ],
                        },
                        "controls": [],
                        "losses": [],
                        "runtimes": [],
                        "tests": [],
                    },
                    f,
                    indent=4,
                )

    @staticmethod
    def filter_mpa_kwargs(**kwargs):
        mpa_kwargs = {}
        for key in kwargs.keys():
            if key.startswith("mpa_"):
                mpa_kwargs[key[4:]] = kwargs[key]
        return mpa_kwargs
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



