コード例 #1
0
    def run(self):
        textattack.shared.utils.set_seed(self.random_seed)
        self.checkpoint_resume = True

        # Run attack from checkpoint.
        from textattack.commands.attack.run_attack_parallel import run as run_parallel
        from textattack.commands.attack.run_attack_single_threaded import (
            run as run_single_threaded, )

        if self.parallel:
            run_parallel(self)
        else:
            run_single_threaded(self)
コード例 #2
0
    def run(self, args):
        checkpoint = parse_checkpoint_from_args(args)
        args = merge_checkpoint_args(checkpoint.args, args)
        textattack.shared.utils.set_seed(args.random_seed)
        args.checkpoint_resume = True

        # Run attack from checkpoint.
        from textattack.commands.attack.run_attack_parallel import run as run_parallel
        from textattack.commands.attack.run_attack_single_threaded import (
            run as run_single_threaded, )

        if args.parallel:
            run_parallel(args, checkpoint=checkpoint)
        else:
            run_single_threaded(args, checkpoint=checkpoint)
コード例 #3
0
    def run(self, args, database):
        # if args.checkpoint_interval and args.shuffle:
        #     # Not allowed b/c we cannot recover order of shuffled data
        #     raise ValueError("Cannot use `--checkpoint-interval` with `--shuffle=True`")

        textattack.shared.utils.set_seed(args.random_seed)
        args.checkpoint_resume = False

        from textattack.commands.attack.run_attack_parallel import run as run_parallel
        from textattack.commands.attack.run_attack_single_threaded import (
            run as run_single_threaded, )

        if args.parallel:
            run_parallel(args, database)
        else:
            run_single_threaded(args, database)